Preview: The API is still being rolled out and details may change before launch. Follow progress in the changelog.
Reply token
A reply token is a code that comes with every message event (in the reply_token field). It lets you answer that message through the API. Use it when your bot needs more than 10 seconds to answer, or wants to send several messages.
curl -s -X POST https://api.sukson.dev/v1/chats/0b6c3a52-5d0e-4c8e-9a51-6f1e7f6f2b10/messages \ -H "Authorization: Bearer $SUKSON_BOT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"reply_token":"rt_q8Jf3vYb0kZ2mW9xT1sLr6PaN4cVe7Hd","messages":[{"type":"text","text":"70% chance of rain tomorrow"}]}'- Single use. That one request can carry up to 5 messages, and each of them replies to the message that called the bot.
- Valid for 60 seconds from when Sukson prepared the event. For anything slower, push instead (send without a
reply_token). - Only in the event’s chat. The
chat_idin the path must be the event’schat.id. If it isn’t, the request is refused and you can still use the token. - Only for the bot that received the event. Other bots can’t use it.
reply_to_message_idcan’t be combined withreply_token: the token already says which message it answers.- The token counts as used even when the request is refused at a later step (a rate limit or a blocked term, say). Message format checks (empty or too long) happen before the token is used, so failing those leaves the token unused.
Unknown, used, expired or another bot’s tokens all get the same answer, 400 REPLY_TOKEN_INVALID; the API doesn’t say which case it was.
Reply token, push and {"reply"}
Section titled “Reply token, push and {"reply"}”| Way | Use it when | Counts against the quota |
|---|---|---|
{"reply": "..."} in the webhook answer |
You can answer within 10 seconds, with one message | Yes |
reply_token |
You need longer (up to 60 seconds) or several messages | Each message |
Push (no reply_token) |
Any time, in any chat the bot is in, e.g. scheduled notices | Each message |
All three count against the monthly message quota and share the same per-chat limits.