-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - smstools #14378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Components - smstools #14378
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
components/smstools/actions/add-contact-opt-out/add-contact-opt-out.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import smstools from "../../smstools.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "smstools-add-contact-opt-out", | ||
| name: "Add Contact to Opt-Out List", | ||
| description: "Adds a selected contact to the opt-out list, stopping further communications. [See the documentation](https://www.smstools.com/en/sms-gateway-api/add_optout)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| smstools, | ||
| contactNumber: { | ||
| propDefinition: [ | ||
| smstools, | ||
| "contactNumber", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const response = await this.smstools.addOptOut({ | ||
| $, | ||
| data: { | ||
| number: this.contactNumber, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully added contact number ${this.contactNumber} to the opt-out list.`); | ||
| return response; | ||
| } catch (e) { | ||
| throw new ConfigurationError("The number is already opted-out or does not exist in the database."); | ||
| } | ||
| }, | ||
| }; | ||
114 changes: 114 additions & 0 deletions
114
components/smstools/actions/add-contact/add-contact.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import smstools from "../../smstools.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "smstools-add-contact", | ||
| name: "Add Contact to Group", | ||
| description: "Adds a new contact to an existing contact list. [See the documentation](https://www.smstools.com/en/sms-gateway-api/add_contact)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| smstools, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone Number", | ||
| description: "The phone number of the contact.", | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| groupid: { | ||
| propDefinition: [ | ||
| smstools, | ||
| "groupId", | ||
| ], | ||
| }, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "First name of the contact.", | ||
| optional: true, | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "Last name of the contact.", | ||
| optional: true, | ||
| }, | ||
| birthday: { | ||
| type: "string", | ||
| label: "Birthday", | ||
| description: "Birthday of the contact. **Format: YYYY-MM-DD**.", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| extra1: { | ||
| type: "string", | ||
| label: "Extra 1", | ||
| description: "Extra field 1 for the contact.", | ||
| optional: true, | ||
| }, | ||
| extra2: { | ||
| type: "string", | ||
| label: "Extra 2", | ||
| description: "Extra field 2 for the contact.", | ||
| optional: true, | ||
| }, | ||
| extra3: { | ||
| type: "string", | ||
| label: "Extra 3", | ||
| description: "Extra field 3 for the contact.", | ||
| optional: true, | ||
| }, | ||
| extra4: { | ||
| type: "string", | ||
| label: "Extra 4", | ||
| description: "Extra field 4 for the contact.", | ||
| optional: true, | ||
| }, | ||
| extra5: { | ||
| type: "string", | ||
| label: "Extra 5", | ||
| description: "Extra field 5 for the contact.", | ||
| optional: true, | ||
| }, | ||
| extra6: { | ||
| type: "string", | ||
| label: "Extra 6", | ||
| description: "Extra field 6 for the contact.", | ||
| optional: true, | ||
| }, | ||
| extra7: { | ||
| type: "string", | ||
| label: "Extra 7", | ||
| description: "Extra field 7 for the contact.", | ||
| optional: true, | ||
| }, | ||
| extra8: { | ||
| type: "string", | ||
| label: "Extra 8", | ||
| description: "Extra field 8 for the contact.", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| unsubscribed: { | ||
| type: "boolean", | ||
| label: "Unsubscribed", | ||
| description: "Indicates if the contact is unsubscribed.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const { | ||
| smstools, | ||
| ...data | ||
| } = this; | ||
|
|
||
| const response = await smstools.addContact({ | ||
| $, | ||
| data, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully added contact with ID: ${response.ID}`); | ||
| return response; | ||
| } catch (e) { | ||
| throw new ConfigurationError(e.response.data.errorMsg); | ||
| } | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import smstools from "../../smstools.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "smstools-send-sms", | ||
| name: "Send SMS or WhatsApp Message", | ||
| description: "Sends a SMS or WhatsApp message to a specified contact. [See the documentation](https://www.smstools.com/en/sms-gateway-api/send_message)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| smstools, | ||
| message: { | ||
| type: "string", | ||
| label: "Message", | ||
| description: "The message to be sent.", | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| to: { | ||
| propDefinition: [ | ||
| smstools, | ||
| "contactNumber", | ||
| ], | ||
| type: "string[]", | ||
| description: "The contact(s) to send the message to.", | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sender: { | ||
| propDefinition: [ | ||
| smstools, | ||
| "sender", | ||
| ], | ||
| }, | ||
| date: { | ||
| type: "string", | ||
| label: "Scheduled Date", | ||
| description: "The date to send the message. **Format: yyyy-MM-dd HH:mm**. If not provided, the message will be sent as soon as possible.", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| reference: { | ||
| type: "string", | ||
| label: "Reference", | ||
| description: "Reference for the message.", | ||
| optional: true, | ||
| }, | ||
| test: { | ||
| type: "boolean", | ||
| label: "Test", | ||
| description: "Test mode for the message.", | ||
| optional: true, | ||
| }, | ||
| subId: { | ||
| propDefinition: [ | ||
| smstools, | ||
| "subId", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.smstools.sendMessage({ | ||
| $, | ||
| data: { | ||
| message: this.message, | ||
| to: this.to, | ||
| sender: this.sender, | ||
| date: this.date, | ||
| reference: this.reference, | ||
| test: this.test, | ||
| subId: this.subId, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Message sent successfully with ID: ${response.messageid}`); | ||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/smstools", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream SMSTools Components", | ||
| "main": "smstools.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.