I’m trying to automate the sending of a canned response during a live chat interaction. The goal is to push a standard adherence greeting to the participant immediately after the agent joins. We are using the Python SDK.
Here is the code I’m running:
from platformclientv2 import ConversationApi, MessageSendEvent
api_instance = ConversationApi()
cid = "current-chat-id"
body = MessageSendEvent(
participant_id="agent-id",
content_type="text",
content="Welcome to support. Please hold."
)
try:
api_instance.post_conversations_message_event(cid, body)
except Exception as e:
print(e)
I keep getting a 400 Bad Request. The error message says Invalid participantId or something about the event type. I thought MessageSendEvent was the right object for this.
I checked the docs and it seems like I need to use a different endpoint or payload structure for canned responses specifically. Is there a specific way to format the JSON for canned text versus free-form text? The docs are a bit vague on the distinction.
I just need the text to appear in the chat window as if the agent typed it. Any help would be appreciated.