Skip to content

New Components - sms_fusion #14382

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Oct 24, 2024
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
19 changes: 19 additions & 0 deletions components/sms_fusion/actions/get-balance/get-balance.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import smsFusion from "../../sms_fusion.app.mjs";

export default {
key: "sms_fusion-get-balance",
name: "Get Balance",
description: "Get current account balance including credit limits in SMS Fusion. [See the documentation](https://docs.smsfusion.com.au/)",
version: "0.0.1",
type: "action",
props: {
smsFusion,
},
async run({ $ }) {
const response = await this.smsFusion.getBalance({
$,
});
$.export("$summary", "Successfully retrieved account balance");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import smsFusion from "../../sms_fusion.app.mjs";

export default {
key: "sms_fusion-perform-hlr-lookup",
name: "Perform HLR Lookup",
description: "Perform HLR on a number with SMS Fusion. [See the documentation](https://docs.smsfusion.com.au/)",
version: "0.0.1",
type: "action",
props: {
smsFusion,
phoneNumber: {
propDefinition: [
smsFusion,
"phoneNumber",
],
description: "The phone number to lookup in MSISDN format. Example: `61412345678`",
},
countryCode: {
propDefinition: [
smsFusion,
"countryCode",
],
},
},
async run({ $ }) {
const response = await this.smsFusion.hlrLookup({
$,
params: {
num: this.phoneNumber,
cc: this.countryCode,
},
});

if (response.id) {
$.export("$summary", "Successfully performed HLR Lookup");
}

return response;
},
};
43 changes: 43 additions & 0 deletions components/sms_fusion/actions/send-sms/send-sms.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import smsFusion from "../../sms_fusion.app.mjs";

export default {
key: "sms_fusion-send-sms",
name: "Send SMS",
description: "Send an SMS using SMS Fusion. [See the documentation](https://docs.smsfusion.com.au/)",
version: "0.0.1",
type: "action",
props: {
smsFusion,
message: {
type: "string",
label: "Message",
description: "The contents of the SMS you wish to send",
},
phoneNumber: {
propDefinition: [
smsFusion,
"phoneNumber",
],
},
countryCode: {
propDefinition: [
smsFusion,
"countryCode",
],
},
},
async run({ $ }) {
const response = await this.smsFusion.sendSMS({
$,
params: {
msg: this.message,
num: this.phoneNumber,
cc: this.countryCode,
},
});
if (response.success) {
$.export("$summary", "Successfully sent SMS message");
}
return response;
},
};
7 changes: 5 additions & 2 deletions components/sms_fusion/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/sms_fusion",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream SMS Fusion Components",
"main": "sms_fusion.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
57 changes: 53 additions & 4 deletions components/sms_fusion/sms_fusion.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,60 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "sms_fusion",
propDefinitions: {},
propDefinitions: {
phoneNumber: {
type: "string",
label: "Phone Number",
description: "The phone number to send the message to in MSISDN format. Example: `61412345678`",
},
countryCode: {
type: "string",
label: "Country Code",
description: "A 2 character country code ISO 3166-2 for formatting local numbers internationally",
optional: true,
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "http://api.smsfusion.com.au";
},
_makeRequest({
$ = this,
path,
params,
...opts
}) {
return axios($, {
url: `${this._baseUrl()}${path}`,
headers: {
"Accept": "application/json",
},
params: {
...params,
key: `${this.$auth.api_key}`,
},
...opts,
});
},
getBalance(opts = {}) {
return this._makeRequest({
path: "/balance/",
...opts,
});
},
hlrLookup(opts = {}) {
return this._makeRequest({
path: "/hlr/",
...opts,
});
},
sendSMS(opts = {}) {
return this._makeRequest({
path: "/sms/",
...opts,
});
},
},
};
27 changes: 15 additions & 12 deletions pnpm-lock.yaml

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

Loading