Opting out is a legal obligation (GDPR, WhatsApp Business Policy). If your bot detects the intent, record it before
you reply.
The flow
1
Detect the intent
Your bot classifies the inbound message (
message.text in the webhook
envelope) as a request to stop marketing: “unsubscribe”, “stop”, “non
voglio più ricevere messaggi”, “cancellami”.2
Record the opt-out in Minimo
Call
POST /public/v1/contacts/opt-out with the sender’s
contact.phone. The same WhatsApp-only API key you use to send works.3
Confirm to the customer
Reply with what actually changed. The response’s
revokedChannels tells you whether it was only WhatsApp or every
marketing channel.Example
sendWhatsappText is your call to Send. The reply is a session
message inside the 24-hour window the customer just opened, so it is not marketing.
What changes
- Marketing campaigns and marketing WhatsApp templates skip this contact.
- Transactional email and utility templates keep working: order updates, reminders, account emails.
- The opt-out appears on the contact’s timeline in Minimo, with source
apiand yourreason. - Calling it again for the same contact is harmless (idempotent).
Doing it without code
- Minimo’s AI assistant does this natively when it answers the conversation itself (WhatsApp or email). Use this API only when your own bot answers.
- AI agents over MCP can call the
minimo_contact_opt-outtool. See Connect your agent.