-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - esendex #16943
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 - esendex #16943
Changes from 4 commits
Commits
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
This file was deleted.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
components/esendex/actions/send-sms-message/send-sms-message.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,76 @@ | ||
| import esendex from "../../esendex.app.mjs"; | ||
| import constants from "../../common/constants.mjs"; | ||
|
|
||
| export default { | ||
| key: "esendex-send-sms-message", | ||
| name: "Send SMS Message", | ||
| description: "Send an SMS message to a recipient. [See the documentation[(https://developers.esendex.com/api-reference/#messagedispatcher)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| esendex, | ||
| accountReference: { | ||
| propDefinition: [ | ||
| esendex, | ||
| "accountReference", | ||
| ], | ||
| }, | ||
| to: { | ||
| type: "string", | ||
| label: "To", | ||
| description: "The phone number to send the message to. E.g. `447700900123`", | ||
| }, | ||
| message: { | ||
| type: "string", | ||
| label: "Message", | ||
| description: "The message to send", | ||
| }, | ||
| from: { | ||
| type: "string", | ||
| label: "From", | ||
| description: "The default alphanumeric originator that the message appears to originate from. This must be either a valid phone number or an alphanumeric value with a maximum length of 11 characters, that may contain letters, numbers and the following special characters: * $ ? ! ” # % & _ - , @ ' +. Special characters may not work for all networks in France.", | ||
| optional: true, | ||
| }, | ||
| sendAt: { | ||
| type: "string", | ||
| label: "Send At", | ||
| description: "The scheduled time to send the messages in this request. The format is `yyyy-MM-ddThh:mm:ssZ` where y=year, M=month, d=day, T=separator, h=hour, m=min and s=seconds. The value is treated as per ISO 8601 semantics, e.g. without time zone information the value is assumed to be the local time of the server, otherwise as an offset from UTC with Z representing a UTC time.", | ||
| optional: true, | ||
| }, | ||
| characterSet: { | ||
| type: "string", | ||
| label: "Character Set", | ||
| description: "The character set of the message to be used. Valid values are: GSM, Unicode and Auto. When using Auto the most appropriate character set is automatically detected. The default value is GSM. When using auto, if unicode characters are detected, the number of characters available in a message will change from 160 to 70.", | ||
| options: constants.CHARACTER_SETS, | ||
| optional: true, | ||
| }, | ||
| validity: { | ||
| type: "integer", | ||
| label: "Validity", | ||
| description: "The validity period for this message in hours (default to 0 which indicates the MAX allowed). The maximum allowed validity period is 72 hours.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.esendex.sendMessage({ | ||
| $, | ||
| data: { | ||
| accountreference: this.accountReference, | ||
| sendat: this.sendAt, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| messages: [ | ||
| { | ||
| to: this.to, | ||
| body: this.message, | ||
| from: this.from, | ||
| type: "SMS", | ||
| sendat: this.sendAt, | ||
| characterset: this.characterSet, | ||
| validity: this.validity, | ||
| }, | ||
| ], | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully sent SMS message to ${this.to}`); | ||
| return response; | ||
| }, | ||
| }; | ||
83 changes: 83 additions & 0 deletions
83
components/esendex/actions/send-voice-message/send-voice-message.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,83 @@ | ||
| import esendex from "../../esendex.app.mjs"; | ||
| import constants from "../../common/constants.mjs"; | ||
|
|
||
| export default { | ||
| key: "esendex-send-voice-message", | ||
| name: "Send Voice Message", | ||
| description: "Send a voice message to a recipient. [See the documentation[(https://developers.esendex.com/api-reference/#messagedispatcher)", | ||
michelle0927 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| esendex, | ||
| accountReference: { | ||
| propDefinition: [ | ||
| esendex, | ||
| "accountReference", | ||
| ], | ||
| }, | ||
| to: { | ||
| type: "string", | ||
| label: "To", | ||
| description: "The phone number to send the message to. E.g. `447700900123`", | ||
| }, | ||
| message: { | ||
| type: "string", | ||
| label: "Message", | ||
| description: "The message to send", | ||
| }, | ||
| from: { | ||
| type: "string", | ||
| label: "From", | ||
| description: "The default alphanumeric originator that the message appears to originate from. This must be either a valid phone number or an alphanumeric value with a maximum length of 11 characters, that may contain letters, numbers and the following special characters: * $ ? ! ” # % & _ - , @ ' +. Special characters may not work for all networks in France.", | ||
| optional: true, | ||
| }, | ||
| sendAt: { | ||
| type: "string", | ||
| label: "Send At", | ||
| description: "The scheduled time to send the messages in this request. The format is `yyyy-MM-ddThh:mm:ssZ` where y=year, M=month, d=day, T=separator, h=hour, m=min and s=seconds. The value is treated as per ISO 8601 semantics, e.g. without time zone information the value is assumed to be the local time of the server, otherwise as an offset from UTC with Z representing a UTC time.", | ||
| optional: true, | ||
| }, | ||
| characterSet: { | ||
| type: "string", | ||
| label: "Character Set", | ||
| description: "The character set of the message to be used. Valid values are: GSM, Unicode and Auto. When using Auto the most appropriate character set is automatically detected. The default value is GSM. When using auto, if unicode characters are detected, the number of characters available in a message will change from 160 to 70.", | ||
| options: constants.CHARACTER_SETS, | ||
| optional: true, | ||
| }, | ||
| lang: { | ||
| type: "string", | ||
| label: "Language", | ||
| description: "The language to use for this Voice message", | ||
| options: constants.LANGUAGES, | ||
| }, | ||
| retries: { | ||
| type: "integer", | ||
| label: "Retries", | ||
| description: "The number of times to attempt to call and deliver a Voice message", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.esendex.sendMessage({ | ||
| $, | ||
| data: { | ||
| accountreference: this.accountReference, | ||
| sendat: this.sendAt, | ||
| messages: [ | ||
| { | ||
| to: this.to, | ||
| body: this.message, | ||
| from: this.from, | ||
| type: "Voice", | ||
| sendat: this.sendAt, | ||
michelle0927 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| characterset: this.characterSet, | ||
| lang: this.lang, | ||
| retries: this.retries, | ||
| }, | ||
| ], | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully sent voicemessage to ${this.to}`); | ||
| return response; | ||
| }, | ||
| }; | ||
This file was deleted.
Oops, something went wrong.
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,58 @@ | ||
| const CHARACTER_SETS = [ | ||
| "GSM", | ||
| "Unicode", | ||
| "Auto", | ||
| ]; | ||
|
|
||
| const LANGUAGES = [ | ||
| { | ||
| label: "English UK", | ||
| value: "en-GB", | ||
| }, | ||
| { | ||
| label: "English Australian", | ||
| value: "en-AU", | ||
| }, | ||
| { | ||
| label: "French", | ||
| value: "fr-FR", | ||
| }, | ||
| { | ||
| label: "Spanish", | ||
| value: "es-ES", | ||
| }, | ||
| { | ||
| label: "German", | ||
| value: "de-DE", | ||
| }, | ||
| ]; | ||
|
|
||
| const MESSAGE_STATUSES = [ | ||
| "Acknowledged", | ||
| "Authorised", | ||
| "Connecting", | ||
| "Delivered", | ||
| "Dispatched", | ||
| "Expired", | ||
| "Failed", | ||
| "FailedAuthorisation", | ||
| "PartiallyDelivered", | ||
| "Processing", | ||
| "Queued", | ||
| "Rejected", | ||
| "Scheduled", | ||
| "Sent", | ||
| "Submitted", | ||
| ]; | ||
|
|
||
| const MESSAGE_TYPES = [ | ||
| "SMS", | ||
| "Voice", | ||
| ]; | ||
|
|
||
| export default { | ||
| CHARACTER_SETS, | ||
| LANGUAGES, | ||
| MESSAGE_STATUSES, | ||
| MESSAGE_TYPES, | ||
| }; |
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,56 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "esendex", | ||
| propDefinitions: { | ||
| accountReference: { | ||
| type: "string", | ||
| label: "Account Reference", | ||
| description: "The account reference to use for the request", | ||
| async options() { | ||
| const { accounts } = await this.listAccounts(); | ||
| return accounts.map((account) => ({ | ||
| label: account.label, | ||
| value: account.reference, | ||
| })); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| methods: { | ||
| _baseUrl() { | ||
| return "https://api.esendex.com/v1.0"; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, path, ...opts | ||
| }) { | ||
| return axios($, { | ||
| url: `${this._baseUrl()}${path}`, | ||
| auth: { | ||
| username: `${this.$auth.username}`, | ||
| password: `${this.$auth.api_password}`, | ||
| }, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| listAccounts(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/accounts", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| listMessages(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/messageheaders", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| sendMessage(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/messagedispatcher", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
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,16 +1,19 @@ | ||
| { | ||
| "name": "@pipedream/esendex", | ||
| "version": "0.0.2", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Esendex Components", | ||
| "main": "dist/app/esendex.app.mjs", | ||
| "main": "esendex.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "esendex" | ||
| ], | ||
| "files": ["dist"], | ||
| "homepage": "https://pipedream.com/apps/esendex", | ||
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3", | ||
| "simple-xml2json": "^1.2.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.