- Print
- DarkLight
- PDF
This API creates a message (child) in a conversation (object) on behalf of the agent, sending it to the customer, or on behalf of the customer, displaying it to the agent.
The API returns the new child’s ID.
Required path parameters include the Stream (channel) ID and the Object (conversation) ID.
Required body parameters for a message on behalf of the customer:
a) The data “Type” see Enum at https://www.commbox.io/api/#section/Enums/ObjectType
b) UserStreamProviderId – the email or phone number of the person you are sending the message on their behalf.
c) UserStreamProviderType of the channel. See Enum at https://www.commbox.io/api/#section/Enums/StreamProviderType
d) The messages
Required body parameters for a message on behalf of the agent:
a) The data “Type” - See Enum at https://www.commbox.io/api/#section/Enums/ObjectType
b) Add this Boolean field 'IsManager': true,
c) Enter the agent’s user ID 'UserIdentity' : 34168,
Get the agent's User ID by using the Get Managers API https://api.commbox.io/managers
d) UserStreamProviderId – the email or phone number of the person you are sending the message on their behalf.
e) UserStreamProviderType of the channel. See Enum at https://www.commbox.io/api/#section/Enums/StreamProviderType
f) The messages
Note: After 24 hours from last sent message, APIs messages sent to customers will be blocked by WhatsApp.
POST /streams/STREAM_ID/objects/OBJECT_ID/child
POST /streams/STREAM_ID/objects/STREAM_PROVIDER_ID/STREAM_PROVIDER_TYPE/child
API key is needed to authorize requests. You can get your API key via the management console.
A Bearer Token is needed to be set in the Authorization header of every API call. For additional support you can contact us.
The unique identifier for the stream (CommBox channel)
The unique identifier for the object (CommBox conversation)
Payload containing child object information
{
"data": {
"IsManager": true,
"UserIdentity": 36574658,
"Type": 4,
"UserStreamProviderId": "best.agent@commbox.com",
"UserStreamProviderType": 4,
"Message": "A new message on behalf of the agent"
}
}
{
"data": {
"IsManager": true,
"UserIdentity": 36574658,
"Type": 4,
"UserStreamProviderId": "972542660000",
"UserStreamProviderType": 7,
"Message": "A new message on behalf of the agent"
}
}
{
"data": {
"Type": 4,
"UserStreamProviderId": "MrDoe@gmail.com",
"UserStreamProviderType": 4,
"Message": "A message on behalf of Mr. John Doe"
}
}
The type of the object. See Enum
Indicates whether the message is from the agent or admin (true) or from a customer (false)
Enter the agent's user ID. Ignore when creating customer's message. Get the agent's User ID by using the Get Managers API
The email or phone number of the person you are sending the message on their behalf
The channel type’s code. See Enum
The message on behalf of the agent / customer
OK
Bad Request - The request could not be understood by the server. Incoming parameters might not be valid
Unauthorized - The supplied credentials, if any, are not sufficient to access the resource
Not found - The requested resource is not found
Too Many Requests - Too many requests have been made in a short period of time (Throttling)
Server Error - The server could not return the representation due to an internal server error
Not Implemented - The requested operation is not supported