Skip to content

Find WhatsApp Contact

Type: mosend-find-contact  ·  Package: Mosend WhatsApp Activities v1.0.4  ·  Output: List<object>

Finds contacts of the Mosend account by phone or by part of the name. Use it to know whether a customer already exists in Mosend, which tags they have, whether they agreed to receive messages or when their last activity was, before deciding what to send them.

Gets the Mosend session of the integration and searches with the query text:

  • If query has 8 or more digits, it is treated as a phone number: only the digits are searched (Mosend stores numbers without +, spaces or dashes). So +57 300 000 0001 and 573000000001 find the same contact.
  • Otherwise it is searched as text (for example, part of the name).

Returns up to max contacts (20 by default, 200 at most). If none is found, it returns an empty list (not an error).

ParameterTypeDefaultDescription
integrationstring—Name of the Mosend account in the environment’s Centro › Recursos › Integraciones (Center › Resources › Integrations), Mensajería section. E.g.: mosend.
querystring—Phone in international format or part of the name. E.g.: +57 300 000 0001.
ParameterTypeDefaultDescription
maxint20Maximum number of results. Defaults to 20; at most 200.

Returns a List<object>, one entry per contact:

FieldDescription
idContact id in Mosend.
nameContact name.
phoneContact phone.
emailEmail, if Mosend has it.
tagsContact tags in Mosend.
optInStatusConsent status for receiving messages.
lastActivityAtDate of the contact’s last activity.

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.
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.

Send the welcome template only if the customer is not in Mosend yet:

Find WhatsApp Contact integration = "mosend" query = "+57 300 000 0001" → output: contacts
If condition = count(contacts) == 0
└─ then:
Send WhatsApp Template integration = "mosend" from = "+57 300 000 0000"
to = "+57 300 000 0001" template = "welcome"
variables = ["Test Customer"]