Template Guidelines
Covers session windows, template messages and message types when using WhatsApp as a conversational channel.
WhatsApp suits conversational agents that keep messages short, clear and action-oriented. For the notification parameters of each message type, see WhatsApp notifications.
Session windows
WhatsApp works best when the user has recently replied and there is an active conversation window. Once the user has engaged, design the agent to keep the conversation moving naturally.
When you message outside the active session window, normal free-form messages are not sent directly. Stubber sends an interaction request instead, so the user can allow or reject the conversation. If more outbound messages are sent before the user accepts, Stubber holds them and sends them once the user approves the interaction.
For proactive or first-contact messages, prefer approved WhatsApp template messages where suitable.
Message types
Common WhatsApp message types available on Stubber are:
The most important type for starting a conversation is template. Template messages are configured and approved in advance. Use them when you start a conversation proactively, or when you need to message outside the active window without relying on an interaction request.
Designing agents for WhatsApp
- Use WhatsApp for concise, back-and-forth conversations.
- Keep replies short and easy to scan on mobile.
- Set a
stubsessionon outgoing messages so replies route back to the correct stub. - Use
templatemessages for first contact, re-engagement, reminders, or other outbound messages where the user has not recently replied. - Use
buttonsandlistmessages when the user should choose from a finite set of options. - Use
location_requestwhen the process needs the user's live location. - Use
mediaonly when the file adds clear value to the interaction. - Avoid sending many separate outbound messages in a row outside an active conversation window.
- Design the agent to continue the conversation smoothly once the user replies and the session is active again.
Typical pattern
For most agentic flows:
- start or restart the conversation with a
templatemessage when needed - set a
stubsessionon outgoing messages - handle inbound replies on
_update_from_whatsapp - continue the main conversation with normal WhatsApp messages while the session is active
WhatsApp works best when the agent is responsive, brief, and structured around clear next steps.