I wrote a workflow to watch for stale live chats, closing them if they are stale for too long, and now I’m trying to figure out how to inject a message (e.g., “Are you still there?”, “I’m closing this chat. Please follow up if you would like further assistance.”)
I’m defining a message and posting it per how I understand the docs for the conversations API, which I believe is what I should use but I’m getting a 500 error. It makes me wonder if the API really allows for injecting messages into live chats.
message = {
"type": "MESSAGE",
"text": "Can I help you with any further questions?",
"senderActorId": "A-[ACTORID]",
"recipients": [
{
"deliveryIdentifier": {
"type": "CHANNEL_SPECIFIC_OPAQUE_ID",
"value": "[ID Taken from live chat conversation]",
"recipientField": "TO"
}
}
],
"channelId": channel_id,
"channelAccountId": channel_account_id
}
message_string = json.dumps(message,indent=4)
url2 = "https://api.hubapi.com/conversations/v3/conversations/threads/" + conversation_id + "/messages"
response = requests.post(url=url2,headers=headers,data=message_string)
I’m able to send a message to a conversation that’s not a live chat (i.e., that’s email using the above template) but I can’t get the message into a live chat.
I would appreciate any pointers!