Hi All,

In this post I would like to show you how can we send SMS messages from ByD utilising REST service. Although I will be using an Australian mobile provider, the process would be similar to any other REST based service.

SDK Items used in this example:

– External Web Service Integration – to define the REST service

– Custom BO – to define the communication parameters and recipient’s phone number / message

Prerequisites:

– You will have to create a FREE account at https://dev.telstra.com and apply for the API Key and API Secret.  

– For now the SMS are restricted to Australian phone numbers.

Sending SMS in our example involves two REST services, first one is called with our API Key /Secret and returns an OAuth token. Then, the token is used to call the second service and send the SMS.

1. Create a new BO:

/wp-content/uploads/2015/06/smsbo1_726915.jpg

2. Activate and create new QA screen with the above elements.

/wp-content/uploads/2015/06/smsbo2_726916.jpg

3. Add first External Web Service Integration item  (EWS) to the solution. Select REST as the service type.

/wp-content/uploads/2015/06/smsbo3_726953.jpg

Paste the URL to the first web service (obtained from the DEV portal), you can include the parameters but it won’t matter at this stage as they will be defined in the ABSL later on anyway. As you can see the SDK will pickup the path automatically.

/wp-content/uploads/2015/06/smsbo4_726954.jpg

4. In the next screen tick the box “Create communication scenario”. Do not enter any API Keys. Click finish.

    You should end up with two new items in the solution explorer.

/wp-content/uploads/2015/06/smsbo5_726969.jpg

5. Lets now create the second EWS.

Note the new URL of the second web service.

/wp-content/uploads/2015/06/smsbo6_726978.jpg

6. After activating your objects, login to the tenant to add our new communication scenarios.

– User and Application Management -> Communication Arrangements -> New

Select our first webservice EWS_SMS_Auth

/wp-content/uploads/2015/06/smsbo7_727657.jpg

Select the associated communication system:

/wp-content/uploads/2015/06/smsbo8_727694.jpg

Ignore the Basic setting page and go straight to the Advanced settings. For our basic scenario we will set the Auth method to None and untick the “Use Basic Settings”.

/wp-content/uploads/2015/06/smsbo9_727695.jpg

Finish and active the new comm arrangement.

7. Repeat the same steps for the Second web service EWS_SMS_Send.

8. Back to studio. Create a new script file for the action we defined earlier in the BO: sendSMS.

– enter your API key and API secret.

ABSL code is fairly self explanatory, we specify the service name that we want to use, create parameters and execute the service. The only difference between the two REST services is that the second one uses POST call and has actual body content containing the message and recipient’s phone number. The only tricky bit was getting the body string right.

/wp-content/uploads/2015/06/smsbo10_727697.jpg

9. Right click on the QA screen in the SDK and select Preview.

– enter a phone number and a message

  /wp-content/uploads/2015/06/smsbo11_727698.jpg

10. After you’ve hit Send button you should see the response back from the two services. The SMS result string contains the unique message ID that can be later used to query the status of the message (pending, delivered etc).

/wp-content/uploads/2015/06/smsbo12_727699.jpg

And here is our SMS:

/wp-content/uploads/2015/06/smsbo13_727714.jpg

And that’s it!  I hope this post will be helpful to others working on something similar.

ABSL code is attached.

Cheers,

Paul

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Jacques-Antoine Ollier

    Hello Paul,

    very nice blog!

    Is it safe to assume this can work with any SMS provider in the world?

    So that it is limited to Australian number only for this example because you use the API from telstra.

    Am I right?

    Thank you for your attention.

    Best regards.

    Jacques-Antoine Ollier

    (0) 
    1. Paul Kalina Post author

      Hi!

      Unfortunately, every service provider might have a different implementation, though if it’s REST based that you could expect a similar structure.  My post was more to show how to consume Rest based service in ByD and the SMS gateway was a nice example to use.

      API for developers from Telstra is locked to Australian numbers but if you had a paid account with Telstra I should work for any number.

      Cheers,

      Paul

      (0) 
    1. Paul Kalina Post author

      Hi Komal,

      The API key and Secret are provided by the mobile network provider, in my example this is Telstra – an Australian mobile provider.

      Cheers,

      Paul

      (0) 

Leave a Reply