https://retellai.com/?utm_source=discord&utm_medium=seo logo
Webhook Payload `chat.transcript` is in reverse or...
# ❓・bug-report
j
Hello! I have set up a webhook from an agent to call a generic endpoint to handle both
call_ended
and
chat_ended
events. The
call.transcript
string property is in the correct order, but the
chat.transcript
string property is in reverse order. e.g. call.transcript
Copy code
Agent: Hello. Thank you for calling. How can I help you today?
User: Hey. What are your daily rates?
Agent: Our RV daily rates start at $60.
Agent: Anything else I can help with?
User: No. That's it. Thanks.
Agent: Thanks for calling. Have a wonderful day.
chat.transcript
Copy code
Agent: Thank you for reaching out. Have a wonderful day.
User: That's it
Agent: Anything else I can help with?
Agent: We don’t have any dog restrictions.
User: What size/breed of dogs do you allow?
Agent: Hello. How can I help you today?
I'm depending on the
transcript
to pull out action items and the reverse order is confusing the LLM. Is there an option I can check to flip this, or is this a bug? I'm attempting to recreate the conversation from the
transcript_object
in the mean time.
s
Hey @julio You can use transcript_object, which preserves message order and roles consistently.
j
Yep. That's what I'm doing! Thanks for the fast reply. Is there a reason that transcript property is in reverse order?
s
chat transcripts are currently returned in reverse order due to how chat messages are stored and streamed internally.
j
Also, the
transcript_object
in the documentation is documented as
[ [Object], [Object], [Object], [Object] ]
. Is there a way you can give me that actual JSON schema?
Or point me to where it is documented.
Is it this:
Copy code
{
  "message_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
  "role": "agent",
  "content": "hi how are you doing?",
  "created_timestamp": 1703302428855
}
I pulled that from message_with_tool_calls from ChatAPI.
s
Yes that matches the format of a single item in transcript_object
j
Thanks for the help!
So it turns out that the
chat_ended
payload doesn't have a
transcript_object
at all. It has a
message_with_tool_calls
. I figured it all out. Thanks again for your help. I would like to bring up a different issue that would have made this significantly easier to deal with: The webhook documentation is very unclear about the expected payloads and what the match in the API documentation. https://docs.retellai.com/features/webhook-overview The same webhook can be used for chat in addition to calls, however the event names are
chat_started
and
chat_ended
. The payloads have a major property difference at the root
chat
vs
call
. The chat entity and the call entity are the same shape as
GET chat
and
GET call
payloads (depending on which event there may or may not be an analysis). There is no
message_object
payload equivalent of
transcript_object
, so you have to filter out the tool calls. Thanks for your time!
s
Thanks for the detailed feedback! You’re correct chat and call webhooks have different payloads, and chat_ended uses message_with_tool_calls instead of transcript_object, so filtering tool calls is necessary. It will be maked sure this feedback is passed to the docs team to improve clarity for future users.