Microsoft Dynamics 365

Create Dynamics 365 Lead

Adds a new lead to Dynamics 365 Sales.

Unverified

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 lead in Dynamics 365. Get an access token first if you do not have one. Confirm the name, email address, phone number and what they are interested in with the customer first. Returns the new lead including its leadid.

Request

POSThttps://YOUR_ORG.crm.dynamics.com/api/data/v9.2/leads?$select=leadid,fullname

Headers

  • AuthorizationBearer {{accessToken}}
  • OData-MaxVersion4.0
  • OData-Version4.0
  • Acceptapplication/json
  • Content-Typeapplication/json; charset=utf-8
  • Preferreturn=representation

Body

{
  "subject": "{{topic}}",
  "firstname": "{{firstName}}",
  "lastname": "{{lastName}}",
  "emailaddress1": "{{email}}",
  "telephone1": "{{phone}}"
}

Parameters

  • topic stringA short description of what the lead is interested in.
  • 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": "5867069b-6494-4430-8fbd-0e50a3efb9d8",
    "type": "HTTP_REQUEST",
    "label": "Create Dynamics 365 Lead",
    "name": "create_dynamics_365_lead",
    "customName": false,
    "description": "Create a new lead in Dynamics 365. Get an access token first if you do not have one. Confirm the name, email address, phone number and what they are interested in with the customer first. Returns the new lead including its leadid.",
    "parameters": [
      {
        "name": "topic",
        "type": "string",
        "description": "A short description of what the lead is interested in."
      },
      {
        "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/leads?$select=leadid,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  \"subject\": \"{{topic}}\",\n  \"firstname\": \"{{firstName}}\",\n  \"lastname\": \"{{lastName}}\",\n  \"emailaddress1\": \"{{email}}\",\n  \"telephone1\": \"{{phone}}\"\n}",
      "timeout": null
    }
  }
}

IDs are regenerated on every copy.