Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 limts 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 <[email protected]> (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