Zay Aung

Dynamics 365, Power Platform, and everything in between

Tag: Consent Management

  • Integrate Twilio Inbound Messages with Real-time Customer Insights Journey for Automated Consent Management

    In this blog post, I’ll walk you through how you can capture inbound SMS messages sent to your Twilio number, bring them into Dataverse, and trigger actions such as updating Text Message Contact Point Consent records in Dynamics 365 Customer Insights – Journeys (CI-J).

    TL;DR – The Solution

    Customer texts “STOP” → Twilio catches it → Sends webhook to Power Automate → Updates consent in Customer Insights – Journeys

    What You’ll Need

    To follow along, of course, you’ll need a Twilio number (trial or paid) to send SMS. For me, I’ve created a trial account that allows to send text message to the verified number. If you already have a Twilio number, you can skip the trial account setup. Otherwise, sign up for a free Twilio trial, verify your mobile number, and you’re good to go.

    Use Case Example

    Consider you’re running SMS campaigns through Customer Insights – Journeys using Twilio. Someone gets your promotional text and replies “STOP” because they’re not interested anymore.Twilio stops sending them messages (which is good), but your Customer Insights – Journeys has no clue they opted out.

    The result? Your reports show they’re still Opted In for Text Message, your data is wrong, and you might accidentally try to reach them again via the Text Message channel.

    Supported SMS Providers

    You can use below providers to send text messages in Customer Insights – Journeys. However, in this blog, I’ll be using Twilio to show you how you can receive inbound message.

    • Azure Communication Services
    • Infobip
    • LINK Mobility
    • TeleSign
    • Twilio
    • Vibes

    Understanding STOP/START Keywords in Twilio

    In general, there’re some keywords reserved for SMS Stop filtering as industry standards – examples are STOP, UNSUBSCRIBE, STOPALL , CANCEL, REVOKE or OPTOUT. This, of course, applies to Twilio too. So When someone replies with a STOP keyword, Twilio adds the sender’s number to a block list and stops sending SMS to them. To resume, the user can reply with START, YES, or UNSTOP.

    By default, Twilio does not forward these inbound replies (or any replies) to Dynamics 365. You must configure an inbound webhook for Customer Insights – Journeys to “catch” the responses. More details here.

    Overview of Power Automate Flow

    This is the overview of the Power Automate Flow that we’re about to create.

    Scope of this blog: I’ll just create a simple Flow, and end it at showing the output of STOP/START – as the purpose of this blog is to show you how you can receive the responses.

    Out of scope: From there, you can extend the Flow to update Contact Point Consents or to facilate other business requirements.

    Fig: Flow Overview

    Build Power Automate Flow

    To do that, first, create a new flow with the trigger: When an HTTP request is received as a first action. Configure the action as below.

    • Who can trigger the flow? → Anyone
    • Method → POST

    Once save the action, the URL will be generated. This will be our callback (webhook) URL that Twilio will post the customer’s response. We will copy the HTTP URL and paste in Webhook URL later.

    Fig: When an HTTP request is received action

    We will then add a Compose action to read the Body message from the above HTTP request.

    Fig: Compose Body Value

    Here is the expression I’ve used to read the response from the customer.

    replace(uriComponentToString(coalesce(triggerBody()?['body']?['Body'],first(split(last(split(concat('&', string(triggerBody())),'&Body=')),'&')))),'+',' ')

    Then we will check the message whether it’s STOP or START. For example,

    • If Body = STOP → update consent (Do Not Allow)
    • If Body = START → update consent (Allow)
    Fig: STOP Condition
    Fig: START Condition

    Once complete, Save and Publish the Flow.

    Verify Caller ID in Twilio

    Next, we are going to configure webhook in Twilio. For that, login to Twilio account. Before we send the SMS from Twilio, we need to add a new Caller ID, and verify that you’re the owner the number.

    Fig: Twilio Add A New Caller ID

    Add your number and enter verification code sent to your mobile.

    Fig: Twilio Add a Caller ID

    Once verified, you will see the number added to Verified Caller IDs list.

    Fig: Twilio Added Verified Caller ID

    Configure Webhook URL in Twilio

    Next, we’re going to configure Webhook URL. Let’s copy the HTTP URL from the Flow and paste it in Webhook URL. Once configured as per the screenshot, click Save configuration.

    Now Twilio will POST any inbound SMS to your flow.

    Fig: Configure Twilio Webhook URL

    Testing the Setup

    We’re now ready to test by sending SMS to the verified number. In this example, I’m going to send a Sale alert SMS to my verified number.

    Fig: Twilio Send SMS

    Once clicked Send an SMS, Twilio will send the SMS to the verified number.

    Reply with Stop. Twilio will POST ‘the reply’ to the flow. The flow will capture it and follow the Stop path.

    Fig: SMS Sent to Verified Number
    Fig: Response Stop from Verified Number
    Fig: Flow Triggered and Flow Through to Stop Path

    Reply with Start. The flow will capture it, and follow the Start path.

    Fig: Response Start from Verified Number
    Fig: Flow Triggered and Flow Through to Start Path

    At this point, you can extend your flow to update Contact Point Consents records.

    Summary

    In this post, we explored how to make Twilio and Dynamics 365 Customer Insights – Journeys work together for inbound SMS. By configuring a callback URL and using Power Automate as a listener, you can capture customer replies in real time. This allows you to keep SMS consent fully in sync when customers text STOP or START.

  • Add the Contactability Grid (Communication Tab) to Custom Forms in Dynamics 365

    In this post, I’ll walk you through how to add the Contactability grid to a custom form in Dynamics 365. While this grid is included by default in Customer Insights – Journeys, you may need to add it to other applications like Customer Service Hub.

    1. What is the Contactability Grid?
    2. Use Case Example
    3. Access the Form Designer
    4. Security Permissions Reminder

    What is the Contactability Grid?

    The contactability grid is a powerful tool that allows you to manage consent across every channel and line of business in your organisation. It provides a comprehensive view of customer communication preferences, making it easy to see and update consent settings for email, SMS, and custom channels.

    Use Case Example

    Consider a scenario where customers call your contact center to manage their communication preferences. By adding the contactability grid to your Customer Service Hub forms, agents can quickly update these preferences without switching applications.

    Access the Form Designer

    The steps are pretty simple, same as what you would design the Form, and add components.

    First, Open the form in Power Apps where you want to add the Contactability grid. Add a 1-column tab to the form canvas – for example, name it Communication. Additionally, make sure to select Expand this tab by default and Expand first component to full tab.

    Fig: Add Communication tab to Contact Form

    Next, add 1-column section to Communication tab.

    Fig: Add section to Communication tab

    Next, we’re going to add Contactability grid to the Form. If you cannot find it in More components section, click Get more components and add it.

    Fig: Add Contactability grid to Form

    Once added, select which platforms the Contactability grid should be available for (Web, Movile, Tablet) and click Done.

    Fig: Select Platform to Show Component

    Once added, you’ll see Contactability grid added to the Form. Click Save and publish.

    Fig: Save and Publish Contact Form

    Finally, you will see Communication tab with Contactablity grid – the same as what you’d see in Customer Insights – Journey – Contact form by default. This will allow other application or team – for example, Customer Service team to update Contact’s contactability preference.

    Fig: Added Communcation Tab with Contactablity Grid

    Security Permissions Reminder

    Update: One thing to call out – make sure users have the required security permissions to see or interact with the Contactability control. Thanks to Megan V Walker for highlighting this! If user is not given right priviliges, the below error will be prompted.

    Fig: The error users will encounter without the right privileges

    Ensure the relevant privileges are granted for the below five tables covering Email and SMS channels (and any custom channel tables, if applicable).

    Fig: Security Privileges