
How it works
For each user, you need to persist one TypebotsessionId so the conversation stays stateful across messages.
Receive a webhook from the messaging app
Most messaging platforms (KakaoTalk, LINE, Telegram, etc.) let you register a webhook URL that is called whenever a user sends a message. Create an HTTP endpoint on your server to handle those calls.
Start a chat on the first message
If you don’t have a Store the returned
sessionId for this user yet, call the start chat endpoint:sessionId next to the user’s platform ID in your database.Forward subsequent messages
For every following message from the same user, call continueChat with the stored session:
Render the bot response on the messaging app
Both endpoints return a
messages array describing what the bot wants to say (text bubbles, images, buttons, etc.). Map each message to the equivalent primitive on the target platform — for example a KakaoTalk text bubble, a LINE template message, or a Telegram inline keyboard.If the response contains an input, present it to the user (buttons become quick replies, a text input just waits for the next message, etc.). When the user answers, loop back to the previous step.Things to keep in mind
- Authentication. Public endpoints (
/api/v1/typebots/<publicId>/startChat) don’t require a token. If you want to use the preview endpoint or any authenticated route, generate an API token. - Session lifetime. Sessions expire after a period of inactivity. Handle 404 errors from
continueChatby starting a new session transparently. - Block compatibility. Blocks that rely on the web embed (file upload UI, payment form, embedded videos…) don’t have a 1:1 equivalent on most messaging apps. Keep the flow text-first when you target external platforms.
- Rate limits. Messaging platforms usually enforce strict rate limits. Queue outgoing messages if the bot sends several bubbles in a row.