Skip to content

Send WhatsApp Template

Type: mosend-send-template  ·  Package: Mosend WhatsApp Activities v1.0.4  ·  Output: object

Sends an approved WhatsApp template (notification, reminder, confirmation) with the Mosend account. It is the only way to write to someone outside the 24-hour window: the first message to a customer, a shipping notice, a payment reminder. The variables fill the {{1}}, {{2}}… placeholders of the template.

  1. Gets the Mosend session of the integration and identifies the sender number from.
  2. Builds the message with the template name (template), the language (language, if set) and the variables.
  3. Sends it to to and returns the message id and status.

The body variables (variables) go in order: the first fills {{1}}, the second {{2}}, and so on. You can pass them as a list or as text separated by commas (,), pipes (|) or semicolons (;). All of them are sent as text.

If the template has an image or document header or dynamic buttons, use headerVariables with the keys Mosend expects; the body variables are added automatically under the body key.

ParameterTypeDefaultDescription
integrationstring—Name of the Mosend account in the environment’s Centro › Recursos › Integraciones (Center › Resources › Integrations), Mensajería section. E.g.: mosend.
fromstring—WhatsApp number of the sending account, as shown in Mosend (e.g. +57 300 000 0000), or its Mosend id.
tostring—Recipient phone in international format, with or without +. E.g.: +57 300 000 0001.
templatestring—Name of the approved template in Meta. E.g.: pedido_enviado.
ParameterTypeDefaultDescription
languagestring—Template language code (es, es_CO, en_US…). Empty = the language of the first approved template with that name.
variablesList—Body variables in order: the first fills {{1}}, the second {{2}}… E.g.: ["Test Customer", "#0001", "tomorrow"].
headerVariablesDictionary—Header or button variables when the template has a media header or dynamic buttons (key → value, as Mosend expects them). Leave empty for text-only templates.

Returns an object with:

FieldDescription
idMessage id in Mosend.
statusStatus reported by Mosend (defaults to sent).
toRecipient number, digits only.
conversationIdConversation id in Mosend.

The activity fails with these messages, without a prefix; catch them with Try / Catch:

MessageCause and fix
'…' is required.A required parameter is missing (the message names it).
The Mosend integration '…' does not exist in this environment. Create it in Center › Resources › Integrations.The integration name doesn’t match any Mosend integration in the environment where the robot runs. Check it under Integrations in Zoan Cloud.
Mosend activities need the Zoan Cloud runtime context (…).The process isn’t running from Zoan Cloud or from the Designer signed in.
'to' must be a phone number in international format (e.g. +57 300 123 4567).to has fewer than 8 digits.
The 'from' WhatsApp number was not found in the Mosend organization. …from doesn’t match any number in the account. Use the number as shown in Mosend or its id.
Mosend responded HTTP 400: …Mosend or Meta rejected the template: a name or language that doesn’t exist, a template that isn’t approved, or a number of variables different from what it expects.
Zoan Cloud refused the Mosend session for '…': HTTP …: …Zoan Cloud couldn’t hand out the integration’s session (for example, the OAuth authorization expired or was revoked). Reconnect the integration.
Mosend rejected the session (401). Reconnect the integration in Center › Resources › Integrations.The API key or token is no longer valid. Reconnect the integration.
Mosend denied the operation (403): the account lacks the permission. …The Mosend account doesn’t have permission for that operation.
Mosend rate limit reached (429). Retry later.Too many requests in a row. Retry with Retry and a wait.
Mosend responded HTTP …: …Another Mosend error; the detail (up to 300 characters of the response) follows the colon.

The order_shipped template says: “Hi {{1}}, your order {{2}} arrives {{3}}.”

Send WhatsApp Template integration = "mosend" from = "+57 300 000 0000"
to = "+57 300 000 0001"
template = "order_shipped" language = "en_US"
variables = ["Test Customer", "#0001", "tomorrow"]
→ output: notice

The customer receives: “Hi Test Customer, your order #0001 arrives tomorrow.”