https://retellai.com/?utm_source=discord&utm_medium=seo logo
How do I connect WhatsApp to a Retell AI chat agen...
# ❓・bug-report
b
I’m having trouble connecting WhatsApp to my Retell AI chat agent and haven’t been able to get it working so far. Setup: • I have a working Retell AI chat agent • Incoming WhatsApp messages arrive via Twilio WhatsApp • I’m using Make.com as the middleware What I already tried: • Sending the WhatsApp message directly to Retell via an HTTP module • Adding an HTML node in between to format or manipulate the payload before sending it to Retell • Different request methods and payload structures Problem: • I’m unsure which Retell API endpoints to use • I keep getting errors like 404 Cannot GET /create-chat • It’s unclear how to properly create and reuse a chat_id per WhatsApp user to maintain conversation context
j
I can help! The main issue is you're trying to use voice agent endpoints (/create-chat) for a text-based WhatsApp integration, which won't work. For WhatsApp, you need to use Retell's Web Chat API instead: Create chat: POST /v2/create-web-chat Send messages: POST /v2/send-chat-message Store the chat_id per WhatsApp user to maintain context Quick question: Are you using Retell's chat agent or voice agent? (They require different API approaches)
b
To answer your question first: I am using a Retell chat agent, not a voice agent. That explains why my approach with /create-chat was failing. I understand now that for a WhatsApp text integration I should be using the Web Chat API instead. I do have one follow-up question to make sure I implement this correctly: When calling POST /v2/create-web-chat What exactly should be included in the request body? For example: • Should I pass an agent_id to bind the chat to a specific chat agent? • Are there any required fields besides the agent reference (such as initial context, user metadata, or channel identifiers)? • Is the expected flow: 1. Create web chat → receive chat_id 2. Store chat_id per WhatsApp number 3. Use POST /v2/send-chat-message with that chat_id for subsequent messages If you have a minimal example of the request body for create-web-chat and send-chat-message, that would be extremely helpful. Thanks again for pointing me in the right direction.
c
https://docs.retellai.com/api-references/create-chat#create-chat: { agent_id: AGENT_123 } -> this returns a chat_id. Regarding variables. In the body: add { retell_llm_dynamic_variables: { "VARIABLE_NAME": "VARIABLE_VALUE" } So in your request... 1. Set the headers, 2. In the body. { "agent_id": YOUR_AGENT_ID, "retell_llm_dynamic_variables": { "VARIABLE_NAME": "VARIABLE_VALUE" } } 3. Retell returns...{ "chat_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6", ... } 4. Store that ID for that user. Then... https://docs.retellai.com/api-references/create-chat-completion: { "chat_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6", "content": "Hello, How are you today? :)" } Done 🙂
b
Can i send you maybe a private message :)?
c
Sure, I can try to help you but i've never done anything like what you're trying to do. I just use the script to create the webchat for myself and for inbound calls I'm just a developer that knows his way around API's really
s
hey @Boooyd 👋 you’re on the right track now. for whatsapp you need the web chat api, not voice endpoints. basic flow is: * POST
/v2/create-web-chat
with
{ agent_id: YOUR_AGENT_ID }
→ this gives you a
chat_id
* store that
chat_id
against the whatsapp number * for every new message, call POST
/v2/send-chat-message
with that
chat_id
and the message content optional: you can pass variables using
retell_llm_dynamic_variables
if you want user metadata or context. the 404 was happening because
/create-chat
is for voice, not chat. if you’re still stuck, share your workspace id and how you’re sending the request from Make, and we can take a closer look.
b
I’ve connected Retell AI successfully. The first user message works: I create a chat, store the chat_id, and receive the agent’s response. However, when I send a second message using the same chat_id, the message is received but the agent does not respond correctly (or I only get an “accepted” response). Am I missing something for follow-up messages? Do I need a different endpoint or to reference the agent again? Could this be related to using a voice agent vs a chat agent? Any help appreciated.