Find WhatsApp Contact
Find WhatsApp Contact
Section titled “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.
How it works
Section titled “How it works”Gets the Mosend session of the integration and searches with the query text:
- If
queryhas 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 0001and573000000001find 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).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
integration | string | — | Name of the Mosend account in the environment’s Centro › Recursos › Integraciones (Center › Resources › Integrations), Mensajería section. E.g.: mosend. |
query | string | — | Phone in international format or part of the name. E.g.: +57 300 000 0001. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
max | int | 20 | Maximum number of results. Defaults to 20; at most 200. |
Output
Section titled “Output”Returns a List<object>, one entry per contact:
| Field | Description |
|---|---|
id | Contact id in Mosend. |
name | Contact name. |
phone | Contact phone. |
email | Email, if Mosend has it. |
tags | Contact tags in Mosend. |
optInStatus | Consent status for receiving messages. |
lastActivityAt | Date of the contact’s last activity. |
Common errors
Section titled “Common errors”The activity fails with these messages, without a prefix; catch them with Try / Catch:
| Message | Cause 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. |
Example
Section titled “Example”Send the welcome template only if the customer is not in Mosend yet:
Find WhatsApp Contact integration = "mosend" query = "+57 300 000 0001" → output: contactsIf 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"]Related activities
Section titled “Related activities”- Send WhatsApp Template — write to the contact.
- List WhatsApp Templates — see the available templates.