Integrating Twilio with D365 CRM Online to send SMS Messages using Microsoft Flow
Introduction:
SMS Messages can be sent from a D365 CRM Online to an individual using the Twilio. In this blog, we will see how we can send SMS Messages from CRM using Twilio and we will be using Microsoft flows to achieve this.
Pre-Requisites:
- Twilio Account
- D365 CRM
- Microsoft Flow
Steps to be followed:
Dynamics 365-
- Create two fields in Contact Entity, named as
a. Send SMS
b. SMS Sent
Data Type (Two options)
Twilio-
To Connect Twilio in Microsoft Flow You require:
- Twilio Account Id
- Twilio Access Token
Steps:
- Sign in to your Twilio account
- Click on Dashboards
- Under Project info tab you can find the Account SID and Auth Token (Copy this value and paste it somewhere you will require this values in MS Flows)
- Setup Phone Number.
a. Click on “All Products & services”b. # Phone Numbers
MS Flow
- Login to Microsoft flow.
- Select Create from Blank.
- Select Dynamics 365 connector.
a. Select when a record is updated trigger.
b. Select the organization name and Entity.
- Select “+New Step” and “Add a condition”
a. Enter condition in “Edit in advance mode”.
Condition:
@and ( equals(triggerBody()?['cf_sendsms'], true), equals(triggerBody()?['new_smssent'], false) )
- If Yes
a. Enter Twilio Account Id which is Acoount SID and Twilio Access Token which is Auth Token.
b. After Connection is being established.
- Enter the From and To Phone Number.
- Enter Text message which you want to send.
- Click on “Add a connection” –> Dynamics 365 – Update a record.
Overall Flow: