Before You Begin
Legacy Web Forms reference. This page documents the older ChatApi.asmx integration and API demo. It does not describe the REST API in the current .NET 8 package. For a new integration, start with the current server package and its API endpoints.
If you maintain a Web Forms deployment, install its API demo site and main DChat application first to validate ChatApiKey and ChatApiNotificationUrl.
The examples below use chat.example.com for the main DChat deployment and api-demo.example.com for the API demo site. Replace those placeholders with your own domains.
The DChat API reference covers two main areas.
- Consume a web service from APP Server.
- Submit new Cases or Notes attached to Leads, including detailed debug information.
Note!
The example code is written in C#, but the same API patterns can be consumed from other languages such as PHP, Java, Ruby, or Node.js.
Consuming a Web Service from DChat APP Server
Creating a ChatApiAgent Object
ChatApiAgent class is used to store information about a chat agent who works for an organization.
class ChatApiAgent
{
bool Disabled { get; set; }
string DisplayName { get; set; }
string Email { get; set; }
bool IsAdmin { get; set; }
string LoginName { get; set; }
string Password { get; set; }
int UserId { get; set; }
}
Creating a ChatApiDepartment Object
ChatApiDepartment class is used to store information about a department.
class ChatApiDepartment
{
ChatApiAgent[] Agents { get; set; }
int DepartmentId { get; set; }
string Description { get; set; }
string Name { get; set; }
}
Creating a SupportSession Object
SupportSession class is used to store information about a single conversation.
class SupportSession
{
DateTime ActiveTime { get; set; }
int AgentRating { get; set; }
string AgentUserId { get; set; }
DateTime BeginTime { get; set; }
string Browser { get; set; }
string ContextData { get; set; }
string Culture { get; set; }
string CustomData { get; set; }
string CustomerId { get; set; }
int DepartmentId { get; set; }
string DisplayName { get; set; }
string Email { get; set; }
string Question { get; set; }
string IPAddress { get; set; }
string OAuthInfo { get; set; }
string OAuthKey { get; set; }
string PageTitle { get; set; }
string PageUrl { get; set; }
string Platform { get; set; }
string ProductKey { get; set; }
string ProductName { get; set; }
string Referrer { get; set; }
string SessionData { get; set; }
int SessionId { get; set; }
}
Creating a ChatMsgData Object
ChatMsgData class is used to store information about a chat message.
class ChatApiDepartment
{
string Html { get; set; }
int MessageId { get; set; }
string Sender { get; set; }
string SenderId { get; set; }
int SessionId { get; set; }
string Text { get; set; }
DateTime Time { get; set; }
}