Skip to main content

Customer Setup - MS Dynamics

This guide explains what you, as the customer, need to provide to enable the integration between MS Dynamics Livechat and our platform.


1. Steps to create app in azure​

Register a new application​

  1. Login to your account on https://portal.azure.com

    Azure portal login

  2. Go to App registration

  3. Click New registration and fill in the required details:

    • Give a name for your application (whatever works for your organization)
    • Select Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) (Recommended)
    • Redirect Uri will be optional

The suggested account type is multi-tenant as the app ID and secrets may need to be used outside the organization to integrate with custom channels.

Generate client secret​

  1. After creating the app, go back to App registration
  2. Under All applications, find your newly created app and click on it
  3. Go to Certificates & secrets under Manage
  4. Under Client secrets, create a new client secret with your desired description
  5. Copy the Value displayed after creation (you'll need this for the next step and it won't be shown again)

2. Steps to create custom channel in dynamics 365​

Access Messaging Accounts​

  1. Login to your Dynamics 365 organization account

    Dynamics 365 Messaging accounts

  2. Go to Apps > Customer Service admin center

  3. On the left sidebar, go to Channels under Customer support

  4. Click Manage under Accounts > Messaging accounts

  5. Create a new account

Configure Channel Details​

  1. Enter your preferred name
  2. Select channel as Custom

Configure Account Details​

  1. Enter the app ID of the app we created in Azure portal (https://portal.azure.com)
  2. Enter the client secret value we retrieved in https://cmcom.atlassian.net/wiki/spaces/MKT/pages/1534754846/Customer+Setup+-+MS+Dynamics#Generate-client-secret

For more details, see Configure custom messaging channels

Configure Custom Channel​

  1. Enter your preferred name for the channel
  2. Select channel as Direct line

Save Endpoint URL​

After completing the configuration, an endpoint URL will be generated in the next stage. Copy and save this URL – you'll need it in the next step.


3. Steps to create azure bot​

Create Bot Resource​

  1. Go to https://portal.azure.com

  2. Click Create a resource

  3. Search for Azure bot and click Create

    Create Azure bot resource

  4. Configure the bot:

    • Bot handle: Enter your desired name
    • Subscription: Select your subscription
    • Resource group: Select or create a resource group
    • Data residency: Select according to your needs
    • Pricing tier: Select your preferred pricing tier

Configure Microsoft App ID​

  1. Select type of app as Multi Tenant (compulsory)
  2. Select Use existing app registration for creation type
  3. Enter the App ID of the app we created in the first section

Configure Messaging Endpoint​

  1. Open the bot you just created
  2. On the left sidebar, find Configuration under Settings
  3. Under Messaging endpoint, paste the endpoint URL we received from the Custom Channel setup

Configure Direct Line Channel​

  1. Select Direct Line channel under the Channels section

  2. You should see a default site configuration. If not, create a new site

    Configure Direct Line channel

  3. Click on the default site and ensure it's enabled

  4. Copy one of the two secret keys provided (this will be used as a bearer token for authentication while communicating with agents)


4. Setting up Workstream in Customer Service Admin Center​

Create New Workstream​

  1. Login to your Dynamics 365 dashboard

  2. Go to Customer Service admin center app

  3. On the left panel, click Workstreams under Customer Support

    Workstreams panel in Customer Service admin center

  4. Click New workstream

  5. Enter your desired name

  6. Workstream type must be Messaging only

Configure Workstream​

  1. Select the workstream you created for the custom channel
  2. Select Set up Custom
  3. On the Custom channel page, select the custom messaging account you created earlier
  4. On the Language page, select the required language

Configure Behaviors​

On the Behaviors page, configure the following options:

Messages must be exactly as described in the documentation, or some features might break.

  • Trigger: Agent ended conversation
  • Message: endOfConversation

Configure User Features​

On the User features page:

  • If you want customers or agents (or both) to send file attachments, turn on File attachments and select the appropriate options

Finalize Setup​

  1. Verify the settings on the Summary page
  2. Click Finish

Additional Configuration​

If you have multiple agents and routing configured, make sure to add each agent to the respective Omnichannel from the User Management section of Customer Service admin center.

For a visual guide on setting up the Dynamics side, watch this video:
https://clubmessage.sharepoint.com/✌/r/sites/Marketplace/Shared%20Documents/MSDynamics%20Setup/msdynamics-setup-latest-secrets.mp4?csf=1&web=1&e=HcoAVX


5. Testing DirectLine Token​

You can test your DirectLine token using an HTML script provided by the Microsoft team.

Get the Test Script​

You can get the code from the Microsoft BotFramework-WebChat GitHub repository or use the script below.

Test Script​

Update the YOUR_DIRECTLINE_TOKEN_FROM_AZURE_BOT placeholder with your actual token:

<!DOCTYPE html>
<html>
<head>
<script crossorigin="anonymous" src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
<style>
html,
body {
height: 100%;
}
body {
margin: 0;
}
#webchat {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="webchat" role="main"></div>
<script>
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
token: 'YOUR_DIRECTLINE_TOKEN_FROM_AZURE_BOT'
}),
locale: 'en-US'
},
document.getElementById('webchat')
);
</script>
</body>
</html>

Next Steps​

After completing all the setup steps above, provide the bearer token retrieved from the Create Azure Bot section to the CM Team for integration. Once the integration is complete, you're ready to serve customers.


6. Troubleshooting​

Issue with Receiving Notifications for Incoming Messages​

If you're facing issues while receiving notifications for incoming messages and you've followed every step carefully, this is likely not a setup issue.

Solution Steps​

  1. Clear site cookies:
    • Clear all site cookies
    • Hard reload the page
    • Log in again and try again
  2. If the issue persists:
    • Get help from Dynamics 365 support
    • Test your channel yourself using the official testing guide

Test Your Channel​

For testing your own channel, follow the official guide:
Test the custom messaging channel