Chatroom
This page outlines the API documentation for creating, managing, reassigning, and activating/deactivating chatrooms in Saleschat.pro.
Roles Allowed: ADMIN
Impersonated User Allowed: False
Partner Allowed: True
leadId is the id field in contact table
API will create a chatroom or return an existing chatroom for this contact
Chatroom will be created for the provided Waba and the Phone number if they are registered for this org
Chatroom's display name will be display name if provided
Otherwise Chatroom's display name will be contact's crm_id + FN + LN
After a certain thresold number of days of inactivity a chatroom is Deactivated. After Deactivation of chatroom, a new chatroom for the same contact with a different crmId can be created
After a certain thresold number of days of creation a chatroom is Expired. After Expiry of chatroom, a new chatroom for the same contact with a different crmId can be created
At any point of time only one active chatroom (not deactivated & not expired) can exist for a unique phone number
On every chatroom creation, a new contact-waba is created if not already present
Each contact can only have one waba mapping
Every contact-waba mapping is per Waba per Waba Phone, i.e any contact with same phone can one active chatroom present across multiple Waba Phone(s)
By default (fail_if_chatroom_exists_on_other_wabaphone = true), in case of an existing contact-waba mapping, we throw a Conflict upon trying to create a chatroom for the same phone number.
For fail_if_chatroom_exists_on_other_wabaphone = false, we create chatroom with same phone number with the next available Waba Phone.
This API allows chatroom handover, that is, that the agent will only be assigned to chatroom after the lead has responded
Assignment of this chatroom can be done by specifying a user or a group from which the user can be selected
When this option is set to true, then all the existing chatrooms for the lead will be deactivated and a new chatroom would be created.
falseIf set to true, the request will fail if a chatroom already exists on a different WABA phone.
trueSuccessfully created the chatroom
Bad request
Unauthorized - Authentication is required
User or Partner does not have access to this org
Waba does not exist / WabaPhone does not exist / User or group does not exist
Active chatroom already exists
Required fields are missing or invalid values are provided
Internal Exception
POST /v3/org/{orgId}/lead/chatroom HTTP/1.1
Host: apis.saleschat.pro
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 245
{
"lead_id": "text",
"remote_waba_id": "text",
"remote_phone_id": "text",
"force_deactivate": false,
"fail_if_chatroom_exists_on_other_waba_phone": true,
"assign_details": {
"assign_mode": "USER",
"user_id": "text",
"group_id": "text",
"assign_on_handover": false
}
}{
"chatroom_id": "text",
"external_ref_id": "text",
"is_existing": true,
"is_deactivated": true,
"is_expired": true,
"expiry_ts": "2025-12-06T03:09:25.780Z",
"deactivation_ts": "2025-12-06T03:09:25.780Z"
}Roles Allowed: ADMIN
Impersonated User Allowed: False
Partner Allowed: True
This API works only for chatrooms created for waba. Hence explicitly added /waba in the API endpoint
API will revoke access of all the existing users from the chatroom and add new users to the chatroom
Depending on the room history visibility flag while creating the chatroom the new users may or may not see messages from the past
This API allows chatroom handover, that is, that the agent will only be assigned to chatroom after the lead has responded
Reassignment of this chatroom can be done by specifying a user or a group from which the user can be selected
Successfully re-assigned the chatroom
Bad request
Unauthorized - Authentication is required
User or Partner does not have access to this org
Chatroom does not exist for this org / OrgId does not exist
Required fields are missing or invalid values are provided
Internal Exception
POST /v3/org/{orgId}/lead/chatroom/{chatroomId}/reassign HTTP/1.1
Host: apis.saleschat.pro
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 103
{
"assign_details": {
"assign_mode": "USER",
"user_id": "text",
"group_id": "text",
"assign_on_handover": false
}
}{
"chatroom_id": "text",
"external_ref_id": "text",
"is_existing": true,
"is_deactivated": true,
"is_expired": true,
"expiry_ts": "2025-12-06T03:09:25.780Z",
"deactivation_ts": "2025-12-06T03:09:25.780Z"
}Roles Allowed: ADMIN
Impersonated User Allowed: False
Partner Allowed: True
contactId is the id field in contact table
API will create a chatroom or return an existing chatroom for this contact
Chatroom will be created for the provided Waba and the Phone number if they are registered for this org
Chatroom's display name will be display name if provided
Otherwise Chatroom's display name will be contact's crm_id + FN + LN
After a certain thresold number of days of inactivity a chatroom is Deactivated. After Deactivation of chatroom, a new chatroom for the same contact with a different crmId can be created
After a certain thresold number of days of creation a chatroom is Expired. After Expiry of chatroom, a new chatroom for the same contact with a different crmId can be created
At any point of time only one active chatroom (not deactivated & not expired) can exist for a unique phone number
On every chatroom creation, a new contact-waba is created if not already present
Each contact can only have one waba mapping
Every contact-waba mapping is per Waba per Waba Phone, i.e any contact with same phone can one active chatroom present across multiple Waba Phone(s)
By default (fail_if_chatroom_exists_on_other_wabaphone = true), in case of an existing contact-waba mapping, we throw a Conflict upon trying to create a chatroom for the same phone number.
For fail_if_chatroom_exists_on_other_wabaphone = false, we create chatroom with same phone number with the next available Waba Phone.
Successfully returning the chatroom
Unauthorized - Authentication is required
User or Partner does not have access to this org
OrgId, UserId, Contact or WABA does not exist
Active chatroom already exists with a different crmId
Required fields are missing or invalid values are provided
Internal Exception
POST /v2/org/{orgId}/chatroom HTTP/1.1
Host: apis.saleschat.pro
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 185
{
"user_id": "text",
"display_name": "text",
"remote_waba_id": "text",
"remote_phone_id": "text",
"contact_id": "text",
"fail_if_chatroom_exists_on_other_wabaphone": true,
"assign_on_handover": true
}{
"chatroom_id": "text",
"external_ref_id": "text",
"is_existing": true,
"is_deactivated": true,
"is_expired": true,
"expiry_ts": "2025-12-06T03:09:25.780Z",
"deactivation_ts": "2025-12-06T03:09:25.780Z"
}Roles Allowed: ADMIN
Impersonated User Allowed: False
Partner Allowed: True
This API works only for chatrooms created for waba. Hence explicitly added /waba in the API endpoint
API will revoke access of all the existing users from the chatroom and add new users to the chatroom
Depending on the room history visibility flag while creating the chatroom the new users may or may not see messages from the past
Successfully reassigned the chatroom
Unauthorized - Authentication is required
User or Partner does not have access to this org
Chatroom does not exist for this org
Required fields are missing or invalid values are provided
Internal Exception
POST /v2/org/{orgId}/waba/chatroom/{chatroomId}/reassign HTTP/1.1
Host: apis.saleschat.pro
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 18
{
"user_id": "text"
}{
"chatroom_id": "text",
"external_ref_id": "text",
"is_existing": true,
"is_deactivated": true,
"is_expired": true,
"expiry_ts": "2025-12-06T03:09:25.780Z",
"deactivation_ts": "2025-12-06T03:09:25.780Z"
}Roles Allowed: ADMIN
Impersonated User Allowed: True
Partner Allowed: True
Message aren't allowed in a deactivated chatroom.
After a certain threshold of inactivity based on org config a chatroom is marked deactivated
A deactivated chatroom can be activated
Successfully accepted request for deactivating contact chatroom
Bad request
Unauthorized - Authentication is required
Forbidden - You don't have permission to access this resource
Failed to deactivate chatroom due to some internal error
PUT /v1/org/{orgId}/contacts/chatroom/{chatroomId}/deactivate HTTP/1.1
Host: apis.saleschat.pro
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 40
{
"deactivation_reason": "LEAD_OPTED_OUT"
}textRoles Allowed: ADMIN
Impersonated User Allowed: False
Partner Allowed: True
A flag force_deactivate is used with false default value
By default we won't allow activation if any active chatroom already exists with the same phone number
If force_deactivate is set to true, then all existing active chatrooms for the same Waba Phone with same pn will be deactivated
falseSuccessfully accepted request for re-activating contact chatroom
Bad request
Unauthorized - Authentication is required
Forbidden - You don't have permission to access this resource
Failed to activate chatroom due to some internal error
PUT /v1/org/{orgId}/contacts/chatroom/{chatroomId}/activate HTTP/1.1
Host: apis.saleschat.pro
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
textRoles Allowed: MEMBER
Impersonated User Allowed: True
Partner Allowed: True
Successfully fetched chatroom by contact
Bad request
Unauthorized - Authentication is required
Forbidden - You don't have permission to access this resource
No contact waba mapping found
Required fields are missing or invalid values are provided
Failed to fetch chatroom due to some internal error
GET /v1/org/{orgId}/chatroom/contact/{contactId} HTTP/1.1
Host: apis.saleschat.pro
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"chatroom_id": "text",
"external_ref_id": "text",
"is_existing": true,
"is_deactivated": true,
"is_expired": true,
"expiry_ts": "2025-12-06T03:09:25.780Z",
"deactivation_ts": "2025-12-06T03:09:25.780Z",
"waba": {
"remote_waba_id": "text",
"matrix_host_name": "text",
"name": "text"
}
}Last updated