Send login codes over WhatsApp
Send one-time login codes with a login code template and handle expired codes.
Your system creates the one-time code; hellomateo delivers it on WhatsApp with a login code template. Meta fixes the message text in the template's language and adds a "Copy code" button:
123456 is your verification code. For your security, do not share this code.
This code expires in 10 minutes.Before you start
- A WhatsApp channel connected through the Meta Cloud API. Other WhatsApp providers, SMS, and email cannot send login codes.
- A login code template for each language you send in, approved by Meta. Create one in the template library under New template → Login code template. Its page shows the template ID to send it with.
- An API token. Login codes can only be sent through the API, not from the inbox, campaigns, or journeys.
Send a code
Send the template with POST /v1/messages/send. Pass the code as the only
placeholder_values item:
curl https://api.getmateo.com/v1/messages/send \
--request POST \
--header "Authorization: Bearer $MATEO_API_TOKEN" \
--header "hellomateo-version: 2026-11-24" \
--header "Content-Type: application/json" \
--data '{
"channel_id": "<channel_id>",
"template_id": "<template_id>",
"to": [{ "handle": "+4915112345678" }],
"placeholder_values": ["123456"]
}'- Send to one recipient, by phone number. A WhatsApp user ID without a phone number is rejected, since WhatsApp does not deliver login codes to it.
- The code has 1 to 15 characters, without whitespace, URLs, or emojis.
- Leave out
id: hellomateo creates the message ID for login codes.
To send a different language, send the login code template of that language.
The code stays private
hellomateo keeps the code only until it expires and never stores it with the
message. The response, GET /v1/messages, webhooks, and the inbox show the
code masked:
{
"id": "<message_id>",
"placeholder_values": ["••••••"],
// ...
}Store the code on your side to check what your user enters.
Expiry and retries
The code is valid for 10 minutes. Within that time, hellomateo retries a failed delivery with the same code.
After 10 minutes, the message fails with the error code
AUTHENTICATION_CODE_EXPIRED instead of sending an expired code. This also
applies to a message scheduled with send_after for more than 10 minutes
ahead. Create a new code and send it again.
Conversations and automations
A login code does not open a conversation for your team. A new conversation
starts closed, and an existing one keeps its status unless you pass
conversation_status. Login codes do not start or resume journeys that react
to outgoing messages.