Skip to content
Open
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
3 changes: 1 addition & 2 deletions components/sendblue/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
*.js
*.mjs
dist
dist
56 changes: 56 additions & 0 deletions components/sendblue/actions/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
export default {
SEND_STYLES: [
{
label: "Celebration",
value: "celebration",
},
{
label: "Shooting Star",
value: "shooting_star",
},
{
label: "Fireworks",
value: "fireworks",
},
{
label: "Lasers",
value: "lasers",
},
{
label: "Love",
value: "love",
},
{
label: "Confetti",
value: "confetti",
},
{
label: "Balloons",
value: "balloons",
},
{
label: "Spotlight",
value: "spotlight",
},
{
label: "Echo",
value: "echo",
},
{
label: "Invisible",
value: "invisible",
},
{
label: "Gentle",
value: "gentle",
},
{
label: "Loud",
value: "loud",
},
{
label: "Slam",
value: "slam",
},
],
};
58 changes: 58 additions & 0 deletions components/sendblue/actions/send-message/send-message.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import sendblue from "../../sendblue.app.mjs";
import constants from "../common/constants.mjs";

export default {
name: "Send Message",
version: "0.0.1",
key: "sendblue-send-message",
description: "Sends an iMessage or SMS to any enabled phone globally. [See docs here](https://sendblue.co/docs/outbound/#sending-imessages)",
type: "action",
props: {
sendblue,
number: {
label: "Number",
description: "The number of the recipient of the message. E.g. `+19998887777`",
type: "string",
},
content: {
label: "Content",
description: "The content of the message",
type: "string",
},
sendStyle: {
label: "Send Style",
description: "The style of delivery of the message",
type: "string",
options: constants.SEND_STYLES,
default: "invisible",
},
mediaUrl: {
label: "Media URL",
description: "The URL of the image you want to send. E.g. `https://source.unsplash.com/random.png`",
type: "string",
},
statusCallback: {
label: "Status Callback URL",
description: "The URL where you want to receive the status updates of the message. E.g. `https://example.com/message-status/1234abcd`",
type: "string",
},
},
async run({ $ }) {
const response = await this.sendblue.sendMessage({
$,
data: {
number: this.number,
content: this.content,
send_style: this.sendStyle,
media_url: this.mediaUrl,
statusCallback: this.statusCallback,
},
});

if (response) {
$.export("$summary", `Successfully ${response.status.toLowerCase()} message with id ${response.message_handle}`);
}

return response;
},
};
13 changes: 0 additions & 13 deletions components/sendblue/app/sendblue.app.ts

This file was deleted.

13 changes: 9 additions & 4 deletions components/sendblue/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{
"name": "@pipedream/sendblue",
"version": "0.0.1",
"version": "0.0.2",
"description": "Pipedream Sendblue Components",
"main": "dist/app/sendblue.app.mjs",
"main": "sendblue.app.mjs",
"keywords": [
"pipedream",
"sendblue"
],
"files": ["dist"],
"files": [
"dist"
],
"homepage": "https://pipedream.com/apps/sendblue",
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.1.1"
}
}
}
37 changes: 37 additions & 0 deletions components/sendblue/sendblue.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "sendblue",
propDefinitions: {},
methods: {
_apiKey() {
return this.$auth.api_key;
},
_apiSecret() {
return this.$auth.api_secret;
},
_apiUrl() {
return "https://api.sendblue.co/api";
},
async _makeRequest({
$ = this, path, ...args
}) {
return axios($, {
url: `${this._apiUrl()}${path}`,
headers: {
"sb-api-key-id": this._apiKey(),
"sb-api-secret-key": this._apiSecret(),
},
...args,
});
},
async sendMessage({ ...args }) {
return this._makeRequest({
path: "/send-message",
method: "post",
...args,
});
},
},
};
5 changes: 4 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.