Threading interval error when creating a conversation using API

I am getting the following error when trying to create a new conversation:

{"code":400,"status":"BAD_REQUEST","message":"Threading interval for this Conversation has been expired and thereby cannot be created when the first message is agent message."}

But the data I am sending doesn’t even have an agent message in:

{"messages": [{"message_parts": [{"text": {"content": "This is a greeting message. Click to edit"}}], "channel_id": "d0b5b909-22e9-4cd1-86dd-aee1790ef717", "actor_type": "bot"}, {"message_parts": [{"text": {"content": "handover"}}], "channel_id": "d0b5b909-22e9-4cd1-86dd-aee1790ef717", "actor_type": "user", "actor_id": "cbc81cd3-d178-467e-86e6-e7b5db730a01"}, {"message_parts": [{"text": {"content": "handover"}}], "channel_id": "d0b5b909-22e9-4cd1-86dd-aee1790ef717", "actor_type": "bot"}, {"message_parts": [{"text": {"content": "Please hold"}}], "channel_id": "d0b5b909-22e9-4cd1-86dd-aee1790ef717", "actor_type": "bot"}], "status": "new", "channel_id": "d0b5b909-22e9-4cd1-86dd-aee1790ef717", "users": [{"id": "cbc81cd3-d178-467e-86e6-e7b5db730a01"}]}

Sometimes creating new conversations works and sometimes it doesn’t.

Hey @Will_Emmerson

The error message {"code":400,"status":"BAD_REQUEST","message":"Threading interval for this Conversation has been expired and thereby cannot be created when the first message is agent message."} suggests that there is a threading interval (a conversation timeout) in place, which governs when a new conversation can be started. Specifically, this error occurs when the system detects that the first message in a conversation is coming from an “agent” (or bot), which violates the rules of conversation threading.

From the data you’re sending, I can see that the conversation starts with a message from a bot ("actor_type": "bot"), followed by a message from a user. The system might be enforcing a rule that a conversation cannot begin with a bot message if a previous conversation is too old (thread expired). Even though you don’t have an explicit agent message (the actor is marked as “bot”), the system might be treating bot messages similarly to agent messages.

The ones that work, can you check whether those have ("actor_type": "bot" ) or not?

Also, have you tried testing the API on Postman? If not please do try and get back to us.