Integrating Twilio Web Service with D365 CRM Online to send SMS Messages | CloudFronts

Integrating Twilio Web Service with D365 CRM Online to send SMS Messages

Introduction:

SMS Messages can be sent from a D365 CRM Online to an individual using the Twilio Web Services. In this blog, we will see how can we send SMS Messages from CRM using Twilio Web Service

Scenario:

We will create a message record from CRM which on save will call the Twilio web service via a plugin and send the message to the destination based on the information passed to Twilio from the D365 CRM.

Process:

Step 1: Creating Entities

Create the following 2 Entities which are ‘SMS Configuration’ and ‘SMS Message’. The SMS Config entity will only consist of three fields which are

  • Username which will have the value of ‘Account Sid’.
  • Password which will have the value of ‘Authentication Key’.
  • From which will have the value of Twilio ‘Account Phone number’.

The SMS Message entity will consist of the following two fields which are as follows

  • To which will have the value of the ‘Receiver’s Phone number’.
  • Message Body which will have the value of the ‘Message text’ that the receiver will receive.

 **Note: The purpose is to provide dynamic data and to not hardcode any value.

Step 2: Creating Plugin Code to Call the Twilio Web Service

The plugin code will be consisting of two main code blocks:

  1. Web Service Code Block
  2. Main Execute Code Block

Web Service Code Block
We will be using the Web Service code in our plugin code while calling the Twilio Web Service from CRM. For more information on how to call Web Service using plugin refer the following link : https://www.cloudfronts.com/call-web-service-plugin-dynamics-crm/

In this case we need to make modifications to the Web Call Service function block of the Web Service plugin code.

  • Changes made to the ‘Try Block’ of the Web Service Call.

  • We won’t require to make any changes to the WebClientEx code block of the Web Service Call Code.


Main Execute Code Block

  • In the Main Execute Code Block we will be calling the above Web Service Code Block.
  • Retrieving of the SMS Configuration Record can be done using fetch XML method.

Conclusion:

Thus, in this way we can send SMS Messages from D365 CRM Online using Twilio Web Services. Hope you find this helpful.


Share Story :

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close