-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - waboxapp #16715
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 - waboxapp #16715
Changes from all 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 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,66 @@ | ||
| import waboxapp from "../../waboxapp.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "waboxapp-send-image", | ||
| name: "Send Image", | ||
| description: "Send an image in WhatsApp to a specific phone number. [See the documentation](https://www.waboxapp.com/assets/doc/waboxapp-API-v3.pdf)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| waboxapp, | ||
| uid: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "uid", | ||
| ], | ||
| }, | ||
| to: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "to", | ||
| ], | ||
| }, | ||
| customUid: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "customUid", | ||
| ], | ||
| }, | ||
| url: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "url", | ||
| ], | ||
| label: "Image URL", | ||
| description: "URL of the image to send", | ||
| }, | ||
| caption: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "caption", | ||
| ], | ||
| }, | ||
| description: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "description", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.waboxapp.sendImage({ | ||
| $, | ||
| data: { | ||
| uid: this.uid, | ||
| to: this.to, | ||
| custom_uid: this.customUid, | ||
| url: this.url, | ||
| caption: this.caption, | ||
| description: this.description, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully sent image to ${this.to}`); | ||
| return response; | ||
| }, | ||
| }; |
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,73 @@ | ||
| import waboxapp from "../../waboxapp.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "waboxapp-send-link", | ||
| name: "Send Link", | ||
| description: "Send a link with preview in WhatsApp to a specific phone number. [See the documentation](https://www.waboxapp.com/assets/doc/waboxapp-API-v3.pdf)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| waboxapp, | ||
| uid: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "uid", | ||
| ], | ||
| }, | ||
| to: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "to", | ||
| ], | ||
| }, | ||
| customUid: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "customUid", | ||
| ], | ||
| }, | ||
| url: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "url", | ||
| ], | ||
| label: "Link URL", | ||
| description: "URL of the link to send", | ||
| }, | ||
| caption: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "caption", | ||
| ], | ||
| }, | ||
| description: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "description", | ||
| ], | ||
| }, | ||
| urlThumb: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "urlThumb", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.waboxapp.sendLink({ | ||
| $, | ||
| data: { | ||
| uid: this.uid, | ||
| to: this.to, | ||
| custom_uid: this.customUid, | ||
| url: this.url, | ||
| caption: this.caption, | ||
| description: this.description, | ||
| url_thumb: this.urlThumb, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully sent link to ${this.to}`); | ||
| return response; | ||
| }, | ||
| }; |
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,73 @@ | ||
| import waboxapp from "../../waboxapp.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "waboxapp-send-media", | ||
| name: "Send Media", | ||
| description: "Send any kind of file in WhatsApp to a specific phone number. [See the documentation](https://www.waboxapp.com/assets/doc/waboxapp-API-v3.pdf)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| waboxapp, | ||
| uid: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "uid", | ||
| ], | ||
| }, | ||
| to: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "to", | ||
| ], | ||
| }, | ||
| customUid: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "customUid", | ||
| ], | ||
| }, | ||
| url: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "url", | ||
| ], | ||
| label: "File URL", | ||
| description: "URL of the file to send", | ||
| }, | ||
| caption: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "caption", | ||
| ], | ||
| }, | ||
| description: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "description", | ||
| ], | ||
| }, | ||
| urlThumb: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "urlThumb", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.waboxapp.sendMedia({ | ||
| $, | ||
| data: { | ||
| uid: this.uid, | ||
| to: this.to, | ||
| custom_uid: this.customUid, | ||
| url: this.url, | ||
| caption: this.caption, | ||
| description: this.description, | ||
| url_thumb: this.urlThumb, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully sent media file to ${this.to}`); | ||
| return response; | ||
| }, | ||
| }; | ||
49 changes: 49 additions & 0 deletions
49
components/waboxapp/actions/send-text-message/send-text-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,49 @@ | ||
| import waboxapp from "../../waboxapp.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "waboxapp-send-text-message", | ||
| name: "Send Text Message", | ||
| description: "Send a WhatsApp message to a specific phone number. [See the documentation](https://www.waboxapp.com/assets/doc/waboxapp-API-v3.pdf)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| waboxapp, | ||
| uid: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "uid", | ||
| ], | ||
| }, | ||
| to: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "to", | ||
| ], | ||
| }, | ||
| customUid: { | ||
| propDefinition: [ | ||
| waboxapp, | ||
| "customUid", | ||
| ], | ||
| }, | ||
| text: { | ||
| type: "string", | ||
| label: "Message Text", | ||
| description: "The text message to send", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.waboxapp.sendMessage({ | ||
| $, | ||
| data: { | ||
| uid: this.uid, | ||
| to: this.to, | ||
| custom_uid: this.customUid, | ||
| text: this.text, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully sent message to ${this.to}`); | ||
| return response; | ||
| }, | ||
| }; |
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
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,11 +1,94 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "waboxapp", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| uid: { | ||
| type: "string", | ||
| label: "UID", | ||
| description: "Your account phone number with international code. E.g. 34666123456", | ||
| }, | ||
| to: { | ||
| type: "string", | ||
| label: "To", | ||
| description: "Recipient's phone number with international code. E.g. 34666789123", | ||
| }, | ||
| customUid: { | ||
| type: "string", | ||
| label: "Custom UID", | ||
| description: "Your custom unique ID for the new message to be send. **Must be unique**. Will be sent back to you on ACK events", | ||
| }, | ||
| url: { | ||
| type: "string", | ||
| label: "URL", | ||
| description: "URL of the content to send", | ||
| }, | ||
| caption: { | ||
| type: "string", | ||
| label: "Caption", | ||
| description: "Title to show on the preview", | ||
| optional: true, | ||
| }, | ||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "Extended description to show on the preview", | ||
| optional: true, | ||
| }, | ||
| urlThumb: { | ||
| type: "string", | ||
| label: "Thumbnail URL", | ||
| description: "URL of the thumbnail image to show on the preview", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://www.waboxapp.com/api"; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, | ||
| path, | ||
| params, | ||
| ...otherOpts | ||
| }) { | ||
| return axios($, { | ||
| url: `${this._baseUrl()}${path}`, | ||
| params: { | ||
| ...params, | ||
| token: this.$auth.api_token, | ||
| }, | ||
| ...otherOpts, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sendMessage(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/send/chat", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| sendImage(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/send/image", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| sendLink(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/send/link", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| sendMedia(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/send/media", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
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.