Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions components/waboxapp/actions/send-image/send-image.mjs
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;
},
};
73 changes: 73 additions & 0 deletions components/waboxapp/actions/send-link/send-link.mjs
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;
},
};
73 changes: 73 additions & 0 deletions components/waboxapp/actions/send-media/send-media.mjs
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;
},
};
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;
},
};
2 changes: 1 addition & 1 deletion components/waboxapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/waboxapp",
"version": "0.6.0",
"version": "0.7.0",
"description": "Pipedream waboxapp Components",
"main": "waboxapp.app.mjs",
"keywords": [
Expand Down
91 changes: 87 additions & 4 deletions components/waboxapp/waboxapp.app.mjs
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,
});
},
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,
});
},
},
};
Loading