File tree Expand file tree Collapse file tree 6 files changed +164
-7
lines changed Expand file tree Collapse file tree 6 files changed +164
-7
lines changed Original file line number Diff line number Diff line change 1+ import smsFusion from "../../sms_fusion.app.mjs" ;
2+
3+ export default {
4+ key : "sms_fusion-get-balance" ,
5+ name : "Get Balance" ,
6+ description : "Get current account balance including credit limits in SMS Fusion. [See the documentation](https://docs.smsfusion.com.au/)" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ smsFusion,
11+ } ,
12+ async run ( { $ } ) {
13+ const response = await this . smsFusion . getBalance ( {
14+ $,
15+ } ) ;
16+ $ . export ( "$summary" , "Successfully retrieved account balance" ) ;
17+ return response ;
18+ } ,
19+ } ;
Original file line number Diff line number Diff line change 1+ import smsFusion from "../../sms_fusion.app.mjs" ;
2+
3+ export default {
4+ key : "sms_fusion-perform-hlr-lookup" ,
5+ name : "Perform HLR Lookup" ,
6+ description : "Perform HLR on a number with SMS Fusion. [See the documentation](https://docs.smsfusion.com.au/)" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ smsFusion,
11+ phoneNumber : {
12+ propDefinition : [
13+ smsFusion ,
14+ "phoneNumber" ,
15+ ] ,
16+ description : "The phone number to lookup in MSISDN format. Example: `61412345678`" ,
17+ } ,
18+ countryCode : {
19+ propDefinition : [
20+ smsFusion ,
21+ "countryCode" ,
22+ ] ,
23+ } ,
24+ } ,
25+ async run ( { $ } ) {
26+ const response = await this . smsFusion . hlrLookup ( {
27+ $,
28+ params : {
29+ num : this . phoneNumber ,
30+ cc : this . countryCode ,
31+ } ,
32+ } ) ;
33+
34+ if ( response . id ) {
35+ $ . export ( "$summary" , "Successfully performed HLR Lookup" ) ;
36+ }
37+
38+ return response ;
39+ } ,
40+ } ;
Original file line number Diff line number Diff line change 1+ import smsFusion from "../../sms_fusion.app.mjs" ;
2+
3+ export default {
4+ key : "sms_fusion-send-sms" ,
5+ name : "Send SMS" ,
6+ description : "Send an SMS using SMS Fusion. [See the documentation](https://docs.smsfusion.com.au/)" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ smsFusion,
11+ message : {
12+ type : "string" ,
13+ label : "Message" ,
14+ description : "The contents of the SMS you wish to send" ,
15+ } ,
16+ phoneNumber : {
17+ propDefinition : [
18+ smsFusion ,
19+ "phoneNumber" ,
20+ ] ,
21+ } ,
22+ countryCode : {
23+ propDefinition : [
24+ smsFusion ,
25+ "countryCode" ,
26+ ] ,
27+ } ,
28+ } ,
29+ async run ( { $ } ) {
30+ const response = await this . smsFusion . sendSMS ( {
31+ $,
32+ params : {
33+ msg : this . message ,
34+ num : this . phoneNumber ,
35+ cc : this . countryCode ,
36+ } ,
37+ } ) ;
38+ if ( response . success ) {
39+ $ . export ( "$summary" , "Successfully sent SMS message" ) ;
40+ }
41+ return response ;
42+ } ,
43+ } ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/sms_fusion" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.1.0 " ,
44 "description" : " Pipedream SMS Fusion Components" ,
55 "main" : " sms_fusion.app.mjs" ,
66 "keywords" : [
1111 "author" : " Pipedream <support@pipedream.com> (https://pipedream.com/)" ,
1212 "publishConfig" : {
1313 "access" : " public"
14+ },
15+ "dependencies" : {
16+ "@pipedream/platform" : " ^3.0.3"
1417 }
15- }
18+ }
Original file line number Diff line number Diff line change 1+ import { axios } from "@pipedream/platform" ;
2+
13export default {
24 type : "app" ,
35 app : "sms_fusion" ,
4- propDefinitions : { } ,
6+ propDefinitions : {
7+ phoneNumber : {
8+ type : "string" ,
9+ label : "Phone Number" ,
10+ description : "The phone number to send the message to in MSISDN format. Example: `61412345678`" ,
11+ } ,
12+ countryCode : {
13+ type : "string" ,
14+ label : "Country Code" ,
15+ description : "A 2 character country code ISO 3166-2 for formatting local numbers internationally" ,
16+ optional : true ,
17+ } ,
18+ } ,
519 methods : {
6- // this.$auth contains connected account data
7- authKeys ( ) {
8- console . log ( Object . keys ( this . $auth ) ) ;
20+ _baseUrl ( ) {
21+ return "http://api.smsfusion.com.au" ;
22+ } ,
23+ _makeRequest ( {
24+ $ = this ,
25+ path,
26+ params,
27+ ...opts
28+ } ) {
29+ return axios ( $ , {
30+ url : `${ this . _baseUrl ( ) } ${ path } ` ,
31+ headers : {
32+ "Accept" : "application/json" ,
33+ } ,
34+ params : {
35+ ...params ,
36+ key : `${ this . $auth . api_key } ` ,
37+ } ,
38+ ...opts ,
39+ } ) ;
40+ } ,
41+ getBalance ( opts = { } ) {
42+ return this . _makeRequest ( {
43+ path : "/balance/" ,
44+ ...opts ,
45+ } ) ;
46+ } ,
47+ hlrLookup ( opts = { } ) {
48+ return this . _makeRequest ( {
49+ path : "/hlr/" ,
50+ ...opts ,
51+ } ) ;
52+ } ,
53+ sendSMS ( opts = { } ) {
54+ return this . _makeRequest ( {
55+ path : "/sms/" ,
56+ ...opts ,
57+ } ) ;
958 } ,
1059 } ,
1160} ;
You can’t perform that action at this time.
0 commit comments