This post explains how to integrate Amazon Connect with Dynamics 365 in a call center environment. When customers call in, they can use DTMF (Dual-Tone Multi-Frequency) to identify themselves. As a result, when an agent answers the call, it opens the customer’s form automatically in Dynamics 365. The integration leverages the Amazon Connect Contact Control Panel (CCP) embedded in Dynamics 365, along with JavaScript, to facilitate the integration. My previous post covers setting up and embedding CCP in a Power App and this expands on that post.
To prompt the customer to enter their account number I created an Amazon Connect Flow with a “Store customer input” flow block prompting the customer to enter their account number.
I then added a “Set contact attributes” flow block to add the entered account number as an attribute to the connect contact which gets passed to the CCP, Contract Control Panel, embedded in Dynamics 365.
I modified my CCP html web resource and added Javscript to do the following.
When a user answers a call using the embedded CCP control it raises an onConnected event and the Javascript code hooks into this event to access the Amazon Connect contact’s attributes.
contact.onConnected(function () {
var ccpContact = contact.getAttributes();
var phoneNo = ccpContact.phoneNumber.value
var accountNo = ccpContact.accountNumber.value
openPhoneCall(accountNo, phoneNo);
});
I had previously added a Alt Key column on Dataverse contact table to hold a customers account number. This allowed me to add a JavaScript function to retrieve the contact record using an account number
async function getContact(accountNo) {
const clientUrl = Xrm.Utility.getGlobalContext().getClientUrl();
const url = `${clientUrl}/api/data/v9.1/contacts(jg_accountno='${accountNo}')?$select=contactid,fullname`;
try {
const response = await fetch(url);
const contact = await response.json();
contactId = contact.contactid;
fullname = contact.fullname;
} catch (error) {
console.error(error.message);
}
}
I wrote JavaScript function named openPhoneCall that invokes the getContact function and opens the Phone Call quick create form. The form’s fields are pre-filled within the JavaScript, and the “Regarding” field is populated with the retrieved contact details.
async function openPhoneCall(accountNo, phoneNo) {
await getContact(accountNo);
var entityFormOptions = {};
entityFormOptions["entityName"] = "phonecall";
entityFormOptions["useQuickCreateForm"] = true;
var formParameters = {};
formParameters["subject"] = "Amazon Connect Call";
formParameters["phonenumber"] = phoneNo;
formParameters["directioncode"] = false;
formParameters["description"] = "Demo of Amazon Connect Integration!";
formParameters["regardingobjectid"] = contactId
formParameters["regardingobjectidname"] = fullname;
formParameters["regardingobjectidtype"] = "contact";
Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
function (success) {
console.log("Form opened successfully:", success);
},
function (error) {
console.error("Error opening form:", error);
}
);
}
A customer phoning the call center is prompted to enter their account number. The embedded CCP control is available in the agent’s Dynamics 365 side pane. With the CCP open when the agent answers a call the Javascript is triggered, it retrieves the contact opening the a phone call form with the regarding field populated.
My previous post covered how easy it is to create a Digital Contact Center using Amazon Connect and how to embed it’s CCP control in a model-driven app. This post aims to expand on the previous post and suggest how you can integrate Amazon Connect with Dynamics 365 in a call center environment. When a customer phones the call center and enters their account number, their details are automatically retrieved and displayed to the agent when they answer the call. This integration enhances both handling times and service quality.