Sending Chat interactions via Creovai API
You may view the Chat data model at the bottom of this article.
Send Chat sessions using API
Tip: See Archived Call Upload API for basics on Authentication and Call Status, as these systems also apply to the Chat APIs.Required: Chat does need to be enabled per API User, please open a "Change Request" support ticketbefore trying to use the Chat API.
Metadata
The “metaData” object can hold any standard Json object.
All data will be stored with the call data and can be made accessible in the UI, Reports, or external data feeds to other systems. An example data object that could be placed here would be an external Customer ID from a CRM platform that was located because of data the customer entered.
Sample Chat Json
{
"SessionId": "160953e6-8136-4090-a54d-44c25691149f",
"MasterCallId" : "4f5917ea-8124-4121-96a2-79bbaca7d23d",
"UtcStart": "2017-08-16T19:30:00Z",
"UtcEnd": "2017-08-16T19:33:00Z",
"Contacts": [
{
"Type": "System",
"Messages": [
{
"Content": "John joined the room.",
"UtcTimestamp": "2017-08-15T19:30:30Z"
},
{
"Content": "John left the room.",
"UtcTimestamp": "2017-08-15T19:31:30Z"
}
]
},
{
"FirstName": "Jane",
"LastName": "Doe",
"Type": "Customer",
"Messages": [
{
"Content": "I need to make an appointment to service my car.",
"UtcTimestamp": "2017-08-15T19:30:40Z"
},
{
"Content": "Need it some time this week.",
"UtcTimestamp": "2017-08-15T19:30:45Z"
},
{
"Content": "Thanks, that's all I needed!",
"UtcTimestamp": "2017-08-15T19:31:20Z"
}
]
},
{
"ReferenceId": "1234",
"FirstName": "John",
"LastName": "Smith",
"Type": "Agent",
"Messages": [
{
"Content": "Please select \"Appointments\" underneath the \"Service\" tab in the upper left.",
"UtcTimestamp": "2017-08-15T19:31:00Z"
},
{
"Content": "From there, you can schedule your appointment at an available time of your choosing.",
"UtcTimestamp": "2017-08-15T19:31:10Z"
},
{
"Content": "You're welcome, feel free to contact us anytime if you need anything else.",
"UtcTimestamp": "2017-08-15T19:31:30Z"
}
]
}
],
"Metadata": {
"ReferenceId": "1501a",
"CustomerRating": "4"
}
}
Upload Chat
curl -X POST -H "Authorization: bearer [TOKEN]" -d "@Sample.json;type=application/json" https://[INSTANCE NAME].audio.Creovai.com/chatCapture/v1
Response
The server will respond with a Creovai-Assigned call ID. Example:
{"callId":"bbsnbcbe3"}The Call ID uniquely identifies the call as it appears in Creovai. It can be used to create a GUI link to the call, for example:
https://[INSTANCE NAME].Creovai.io/calls/bbsnbcbe3
This is the primary ID for the session in Creovai, and wherever possible should be stored by the integrating system for troubleshooting purposes.
If necessary the Creovai call ID can be looked up by Session ID using the Call Status API.
Chat Data Model
The Data model below is written in C#.
public class ChatCall
{
/// <summary>
/// The SessionId is a unique identifier for each chat.
/// </summary>
public string SessionId { get; set; }
/// <summary>
/// Optional : A unique identify that may be shared between one or more chats or calls, that together represent one complete chat.
/// </summary>
public string MasterCallId { get; set; }
/// <summary>
/// The Start time of the chat in UTC.
/// </summary>
public DateTime UtcStart { get; set; }
/// <summary>
/// The End time of the chat in UTC.
/// </summary>
public DateTime UtcEnd { get; set; }
/// <summary>
/// A list of contacts that participated in the chat.
/// </summary>
public List<ChatContact> Contacts { get; set; }
/// <summary>
/// Extra call metadata
/// </summary>
public object Metadata { get; set; }
}
public class ChatContact
{
/// <summary>
/// Optional : A Reference Id or name for the contact.
/// </summary>
public string ReferenceId { get; set; }
/// <summary>
/// Optional : First name of the contact
/// </summary>
public string FirstName { get; set; }
/// <summary>
/// Optional : Email address of the contact
/// </summary>
public string Email{ get; set; }
/// <summary>
/// The type of contact. Default types are "Agent", "Customer", and "System".
/// </summary>
public string Type { get; set; }
/// <summary>
/// A list of chat messages from this contact.
/// </summary>
public List<ChatMessage> Messages { get; set; }
}
public class ChatMessage
{
/// <summary>
/// The content of the message.
/// </summary>
public string Content { get; set; }
/// <summary>
/// The timestamp when the message was posted
/// </summary>
public DateTime UtcTimestamp { get; set; }
}Articles in this section
- Archived Call Upload API
- Async Metadata API
- Call purge APIs
- Call Summary - Outbound Webhook
- Guest user token API
- Sending Chat interactions via Creovai API
- Token authentication API
