Add this first. This tool needs an access token, so add Get Dynamics 365 Access Token to the same bot. The bot calls it first and passes the token in.
What the model is told
Create a new contact in Dynamics 365. Get an access token first if you do not have one. Confirm the name, email address and phone number with the customer first, and check with Find Dynamics 365 Contact by Email that they do not already exist. Returns the new contact including its contactid.
Request
POSThttps://YOUR_ORG.crm.dynamics.com/api/data/v9.2/contacts?$select=contactid,fullname
Headers
AuthorizationBearer {{accessToken}}OData-MaxVersion4.0OData-Version4.0Acceptapplication/jsonContent-Typeapplication/json; charset=utf-8Preferreturn=representation
Body
{
"firstname": "{{firstName}}",
"lastname": "{{lastName}}",
"emailaddress1": "{{email}}",
"telephone1": "{{phone}}"
}Parameters
firstName stringThe customer's first name.lastName stringThe customer's last name.email stringThe customer's email address.phone stringThe customer's phone number in international format.accessToken stringThe access_token value returned by Get Dynamics 365 Access Token. Reuse it for the rest of the conversation.
Engage payload
{
"source": "VOICE_AI",
"tool": {
"id": "78f70175-d4cd-4b7a-a4fa-552fc65e65a9",
"type": "HTTP_REQUEST",
"label": "Create Dynamics 365 Contact",
"name": "create_dynamics_365_contact",
"customName": false,
"description": "Create a new contact in Dynamics 365. Get an access token first if you do not have one. Confirm the name, email address and phone number with the customer first, and check with Find Dynamics 365 Contact by Email that they do not already exist. Returns the new contact including its contactid.",
"parameters": [
{
"name": "firstName",
"type": "string",
"description": "The customer's first name."
},
{
"name": "lastName",
"type": "string",
"description": "The customer's last name."
},
{
"name": "email",
"type": "string",
"description": "The customer's email address."
},
{
"name": "phone",
"type": "string",
"description": "The customer's phone number in international format."
},
{
"name": "accessToken",
"type": "string",
"description": "The access_token value returned by Get Dynamics 365 Access Token. Reuse it for the rest of the conversation."
}
],
"config": {
"endpoint": {
"method": "POST",
"url": "https://YOUR_ORG.crm.dynamics.com/api/data/v9.2/contacts?$select=contactid,fullname"
},
"headers": [
{
"name": "Authorization",
"value": "Bearer {{accessToken}}"
},
{
"name": "OData-MaxVersion",
"value": "4.0"
},
{
"name": "OData-Version",
"value": "4.0"
},
{
"name": "Accept",
"value": "application/json"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Prefer",
"value": "return=representation"
}
],
"body": "{\n \"firstname\": \"{{firstName}}\",\n \"lastname\": \"{{lastName}}\",\n \"emailaddress1\": \"{{email}}\",\n \"telephone1\": \"{{phone}}\"\n}",
"timeout": null
}
}
}IDs are regenerated on every copy.