-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
New Components - sms_fusion #14382
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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,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; | ||
}, | ||
}; |
40 changes: 40 additions & 0 deletions
40
components/sms_fusion/actions/perform-hlr-lookup/perform-hlr-lookup.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,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; | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
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,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", | ||
], | ||
}, | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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; | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
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,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, | ||
}, | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
_baseUrl() { | ||
return "http://api.smsfusion.com.au"; | ||
}, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
_makeRequest({ | ||
$ = this, | ||
path, | ||
params, | ||
...opts | ||
}) { | ||
return axios($, { | ||
url: `${this._baseUrl()}${path}`, | ||
headers: { | ||
"Accept": "application/json", | ||
}, | ||
params: { | ||
...params, | ||
key: `${this.$auth.api_key}`, | ||
}, | ||
...opts, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
}, | ||
getBalance(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/balance/", | ||
...opts, | ||
}); | ||
}, | ||
hlrLookup(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/hlr/", | ||
...opts, | ||
}); | ||
}, | ||
sendSMS(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/sms/", | ||
...opts, | ||
}); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
}, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.