Sync messages and files
To sync a message with a specific chat session, please use the standard “message“ method with the sessionid parameter:
{
"method": "message",
"params":{
"from": "9003",
"to": "234567668",
"content": "Hello",
"orgid": "17076444409917912922",
"sessionid": "1710004869211-d3103a34bd2ce6023a"
}
}Response:
{
"result": {
"messageid": "1710100373597-8b065154afbbddfb96"
}
}sessionid refers to the existing chat session, which you receive as a response from the API server once a chat has been created.
A new “sessionid“ will be returned if a message is sent to a session which is already closed.
In addition, you can implicitly create a chat session for other users (if you need to sync messages with the users who don't have a chat session with an external number yet) by sending a message method without the content and sessionid parameters.
Specify the external contact number in the from parameter and user’s extension number (for whom a chat session will be created) or an SMS number (DID) added via SMS integration in the to field:
{
"method": "message",
"params":{
"from": "234567668",
"to": "9004",
"orgid": "17076444409917912922"
}
}Response:
{
"result": {
"sessionid": "1710098613465-02d8b0a8b078cf73e5"
}
}Now you can use the provided 'sessionid' in the follow-up API request to sync the message with the user's chat session:
{
"method": "message",
"params":{
"from": "9003",
"to": "234567668",
"content": "Hello",
"orgid": "17076444409917912922",
"sessionid": "1710098613465-02d8b0a8b078cf73e5"
}
}Alternatively, instead of content you can specify the messageid parameter, which is particularly useful for syncing files:
{
"method": "message",
"params":{
"from": "9003",
"to": "234567668",
"orgid": "17076444409917912922",
"messageid": "1710100665847-a1f4a223ffd202a9ea",
"sessionid": "1710098613465-02d8b0a8b078cf73e5"
}
}
Sync calls history
To sync a record about an outbound or inboud call, send a "message" method with the "content" object that describes the calls detail and the "type" parameter with the value of number 8.
{ "method": "message",
"params":{
"sessionid": "1738273559644-acb978e33dd4646786",
"content": {
"activity_type":"outbound",
"call_duration":105,
"caller_number":"9009",
"called_number":"380820432435",
"call_subject":"Brieff Utterances",
"call_summary":"The conversation consists of brief, repetitive utterances from both speakers, primarily 'Oh' and 'I don't know'.",
"call_transcription":"17191774976125638450-1759295823160-e4984da8007a55ac96.json"
},
"type": 8,
"orgid": "17076444409917912922"
}
}
