WhatsApp Business API | Integration with Microsoft Dynamics 365

Zapier logo

Hi there! 

Would you like to enrich your Microsoft Dynamics 365 communication capabilities with WhatsApp template messages?

In this tutorial, you will learn how to integrate Microsoft Dynamics with WhatsApp using the tyntec WhatsApp Business connector and Power Automate Flow. Using this integration, you can automatically send WhatsApp template messages to your contacts after a defined action happens.

You will need

  • Your tyntec API key from your tyntec account
  • Your WhatsApp Business Account Number that has been assigned to you by tyntec
  • Your WhatsApp Message Template 
  • A mobile phone with WhatsApp for testing
  • A testing Microsoft Dynamics account with the Marketing app installed
  • A Microsoft Power Automate Free license in your Dynamics Environment
  • A Contact in your Microsoft Dynamics with the mobile number set to your WhatsApp phone number
  • A testing Event record in your Microsoft Dynamics

Tip: You can use the default message template named default_welcome.

Step One: Create your Flow

To quickly start with Power Automate and the tyntec WhatsApp Business connector, you will build a sample Flow. Let’s look at what it does.

When record is created, send WhatsApp message

The sample Flow works in your Microsoft Dynamics background and automatically listens to the creation of a new Event registration (the Trigger). Once triggered, it calls the Action Send WhatsApp Template message to the assigned Contact in the Trigger. 

1. Open your Power Automate.

2. In the left dropdown menu, click the Create button.

3. From all possible Flow types, select Automatedfrom blank.

Automated flows run when an event triggers, Instant flows on a manual trigger, and Scheduled on a given time condition. 4. In the design window pop-up, use the search function to find the event When a record is created, updated or deleted from Common Data Service. Then click the Create button.

When record is created...

You are now in the UI Flow designer that can add Actions to your Flow and chain them into algorithms. The designer automatically creates When a record is created, updated or deleted trigger step. 

5. Within the When a record is created, updated or deleted step, set the Trigger condition to Create, The entity name to Event Registrations, and Scope to Organization. Your Trigger is now listening for any new event registrations.

Event registration

6. To create a new action, click the + New step. In the step selection, search for the Get Record action.

Get record

In the Get Record action step, set the Entity Name to Contacts and Item ID to Contact (Value) dynamic content.

Get the contact from event registration

7. Click the  + New step. Search for tyntec WhatsApp Business in the step selection, and select the Send WhatsApp Template message action.

8. Tyntec Connector will automatically try to create a connection. Name your Connection and set your apikey to your tyntec API key. 

Connect your tyntec account

Afterward, the Send WhatsApp Template message action updates itself to show you different fields.

9. Set the to field to Mobile Phone dynamic content, the from field to your WhatsApp Business Account, the templateId field to your templateID, the language-policy field to your template's language policy, and the language-code field to your template's language code.

Fill in your details

10. Set the components type - 1 to body, and the components parameters type - 1 to text. The components parameter text - 1 specifies the content of your WhatsApp message parameter. Set the value to your desired text.

You can use dynamic content to autofill data. For example, in the default template, you have one parameter, the user's name. To automatically use it, set the components parameters text - 1 field to First Name dynamic content.

Tip: If your message template has more parameters, you can use dynamic content to automatically fill them. If your template uses rich media, set components parameter type to media, the components parameter type - 1 to the media type (image, document, audio, etc.), components parameter url -1 to the location of your media, and add the components parameter filename.

11. Click Save.

Your Flow will now automatically run when the Trigger detects a new Event Registration.

Step Two: Test your Flow

Let's try triggering your Flow. In this testing phase, you will create the Event Registration manually. 

1. Go to your Dynamics 365 and select your Marketing instance.2. In Marketing, scroll down to Event Management. Then click on Event Registrations and + New.

Create a new event registration

3. Set the Primary role to Attendee, add contact into the Contact field, and add your event into the Event field. When you are happy with the details, click Save

Fill in the registration

4. As soon as you click Save, the Flow starts. Look at your testing phone, you will see your WhatsApp message.

WhatsApp message

Congratulations on completing your Flow!

More?

The main power of the tyntec WhatsApp Business connector is that you can use it alongside any connector (Dropbox, for example) that is in Power Automate. Using the Common Data Service you can access any entity within your Dynamics environment. 

If you would like to scale the capabilities of this flow, it could be a good idea to add analytics to it. Each time you use the Send WhatsApp Template message action the Flow receives a messageId dynamic content as a response. Using the tyntec WhatsApp Business action Status Check with the messageId returns you the status of your message (for reference, look at the API Reference). You can save the response from the Status Check within a custom entity or attach it as a note to the Event Registration using the Create a record action or the Update a record action.

Status check action

If you want to add two-way messaging to your flows, the tyntec WhatsApp Business connector has the trigger Incoming Message.

Trigger new message

It automatically listens to new messages across all channels and if a new message is detected, it starts your flow. All message details are stored in the dynamic content.