OverviewPlatformsAPI ReferenceResources
Messages

Search conversations

GEThttps://zernio.com/api/v1/inbox/conversations/search

Search your conversations two ways at once, and get back the matching conversations, most-recent match first.

Authentication

AuthorizationBearer tokenRequired

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

Query parameters

querystring, max 200Required

Text to search for, in message content and in the contact's name, username, or phone number

directionstringOne of incoming | outgoing

Only match messages sent to you (incoming) or by you (outgoing). Contact-identity matching is not applied when this is set.

profileIdstring

Filter by profile ID

platformstringOne of facebook | instagram | telegram | whatsapp | sms | rcs | slack | imessage

Filter by platform (searchable platforms only)

accountIdstring

Filter by specific account ID

limitintegerDefault 20

Maximum number of conversations to return

cursorstring

Opaque pagination cursor. Pass back pagination.nextCursor verbatim; do not construct one.

Responses

Success· the request worked

Errors· the request failed

How it behaves

Message text

Matches words inside message bodies. Case-insensitive and accent-insensitive, exact tokens only (no substrings, no stemming). Each hit carries up to 3 most-recent matching messages.

With direction=outgoing you can collect examples of how you write to customers, for example to teach an AI agent your tone of voice.

Contact identity

Matches the participant's name, username, or phone number as a case-insensitive substring. These hits have matchCount 0 and an empty matches array.

A conversation that matches both ways is returned once, carrying its message matches.

Searchable platforms

Only platforms whose messages are stored by Zernio are searchable: WhatsApp, SMS, Telegram, Facebook, Instagram, X and Reddit.

Bluesky conversations are fetched live from the platform and cannot be searched; those accounts are listed in meta.accountsSkipped.

List conversations

Fetch conversations (DMs) from all connected messaging accounts in a single API call. Supports filtering by profile and platform. Results are aggregated and deduplicated. Supported platforms: Facebook, Instagram, X, Bluesky, Reddit, Telegram, WhatsApp, iMessage and SMS. ### X limitation X has replaced traditional DMs with encrypted "X Chat" for many accounts. Messages sent or received through encrypted X Chat are not accessible via X's API (the /2/dm_events endpoint only returns legacy unencrypted DMs). This means some X conversations may show only outgoing messages or appear empty. This is an X platform limitation that affects all third-party applications. See X's docs on encrypted messaging for more details. ### Instagram and Facebook pre-connect history When one of these accounts is connected, Zernio replays the DM history the account already holds on Meta, so conversations that began before the account was connected appear here. Up to 500 conversations per account are replayed. - The replay runs in the background and can finish after a listing you have already taken. - Replayed conversations keep their original lastMessageAt, so they sort into date order rather than appearing at the top. - If you mirror this endpoint into your own store, re-run the sweep rather than relying on a single pass at connect time. - Replayed history emits no webhooks and is stored as already read, so it never affects unread counts. - Threads that Meta refuses to serve are skipped. - An account whose Instagram "connected tools" message access is turned off is not replayed at all.

Create conversation

Start a direct message conversation with a user. If a conversation with that recipient already exists, the message is added to the existing thread. Supported platforms: X, Bluesky, Reddit, WhatsApp, SMS, Slack, iMessage, and email (Google and Microsoft accounts). Other platforms return PLATFORM_NOT_SUPPORTED. ### Email (Google / Microsoft) Pass the recipient address as participantId with `subject`, `message` and optionally `cc`. The mail is sent from the mailbox and mirrored into the inbox. The response names the inbox conversation it opened (the provider thread id, usable with the other inbox endpoints). - 412 `account_scope_missing`: the account was connected without the `email` area - 409: the account is disconnected - 402 `payment_required`: Gmail accounts need a card on file Sends count toward the mailbox's daily cap and never toward managed messages. ### iMessage Pass the recipient as participantId: a phone number in international format (+15551234567) or an iMessage email. Senders ordered through Zernio can message contacts who never wrote to them. #### Opening message rules The first message to such a contact must be plain text from an identifiable person or business opening a conversation. A cold introduction, including a sales one, is fine ("Hi Mark, this is John from Pratt Media. I help local roofers get more leads. Would you be open to a quick chat?"). It may not contain links, email addresses, phone numbers, prices or attachments (the provider's own rule for opening messages). One that does returns 400 with code `invalid_content` and a message saying what was flagged, and nothing is sent. #### New contact limits Each sender may open at most one new conversation every 15 minutes. A new sender warms up, allowing this many new conversations per 24 hours: - Days 1-2 after activation: 2 - Days 3-4: 5 - Days 5-7: 10 - Days 8-14: 20 - Days 15-21: 30 - After that: 50 Beyond that the request returns 429 with code `new_contact_limit` and a time to retry. The warm-up counts from when a sender ordered through Zernio went live. Senders registered from your own provider account are not warmed up by Zernio. #### Follow-ups before the contact replies Until the contact replies, the thread accepts the opening and at most two follow-ups, at least 24 hours apart. - A follow-up sooner returns 429 `new_contact_limit` with the time to retry. - A fourth message returns 409 `recipient_must_message_first`. The provider treats every message to a contact who has not replied as a new conversation. Follow-ups therefore follow the same content rule and count toward the 15-minute spacing and the daily warm-up like an opening. Once the contact has written, the thread behaves like any other and is not limited. #### Sender safety Recipients can report a first message as junk, and reports can get a sender blocked permanently, so keep the reply rate high (above roughly 30%). - A sender registered with your own provider account may lack the add-on for new contacts. Its sends to them return 409 `recipient_must_message_first`, and an opt-in link is the way in. - A contact who opted out returns 409 `recipient_opted_out`. ### Slack Pass a workspace member id as participantId (list them with GET /v1/accounts/{accountId}/slack-members). Zernio opens the DM channel with that member and sends the message. The thread then behaves like any other Slack conversation in the inbox. The member must belong to the connected workspace. ### WhatsApp This is the endpoint for sending an approved template message to a phone number. Put the recipient phone in participantId and provide: - templateName - templateLanguage - templateParams: variable values for the text header, body and dynamic URL buttons, in that order A template is required because WhatsApp does not permit freeform messages to open a conversation. A missing template returns TEMPLATE_REQUIRED. #### Template lookup Before sending, Zernio must resolve an exact APPROVED template definition matching both templateName and templateLanguage. If Meta rejects that lookup, or the exact approved definition is absent, Zernio sends no message and returns the canonical platform error instead. Lookup errors use code `platform_api_error`, type `platform_error`, and platform `whatsapp`. Sanitized Meta code, message, and `error_data.details` are returned in `platformError`. `details` identifies `phase: template_lookup`, the query-free endpoint, upstream status, and only safe provider usage or retry headers. #### Template headers, buttons and cards - Templates with media headers (image, video, document) are handled automatically: Zernio fills the header at send time with the approved template's sample asset. - To send a DIFFERENT asset per message (e.g. a distinct invoice PDF for each recipient), pass headerMedia with a public link (or a Meta media id); it overrides the sample for that send. - A template whose approved header format is LOCATION has no header asset to reconstruct: Meta only accepts the location at send time. Pass headerLocation (latitude and longitude required) whenever such a template is sent. headerMedia and headerLocation cannot both be supplied. - A button that carries its own value at send time (a copy-code button holding a Pix payment code or a coupon, a flow token) is sent with templateButtonParams, addressed by the button's index. templateParams covers text variables and dynamic URL buttons only. - CAROUSEL templates take per-card overrides via templateCards, each addressed by the card's card_index. Card body variables restart at {{1}} per card and cannot be expressed in the flat templateParams order. - Template fields are accepted on the JSON body only, not on multipart requests. #### Existing threads and the 24-hour window For a number you already have a thread with, this sends the template into that thread. That makes it the way to re-engage a contact after the 24-hour customer-service window has closed. Once the recipient replies (opening the 24h window), send freeform messages with the send-message endpoint (POST /v1/inbox/conversations/{conversationId}/messages). #### Meta Direct Send WhatsApp Business Accounts eligible for Meta Direct Send can instead open a conversation with a business-initiated utility text message and no template. Pass category: 'utility' together with message (and no templateName). See the category field below. ### X #### DM eligibility Before sending, the endpoint checks if the recipient accepts DMs from your account (via the receives_your_dm field). If not, a 422 error with code DM_NOT_ALLOWED is returned. Skip this check with skipDmCheck: true if you have already verified eligibility. #### API tier requirement DM write endpoints require X API Pro tier ($5,000/month) or Enterprise access. This applies to BYOK (Bring Your Own Key) users who provide their own X API credentials. #### Rate limits (X only) X's DM API enforces, shared across all DM endpoints: - 200 requests per 15 minutes per connected X account - 1,000 per 24 hours per connected X account - 15,000 per 24 hours per X developer app These limits do NOT apply to other platforms. WhatsApp sends are governed by Meta's per-number messaging tiers (unique business-initiated conversations per 24 hours) and per-number throughput instead.

GET/v1/inbox/conversations/search
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.messages.searchInboxConversations({  query: {    query: 'string',  },});console.log(data);
{  "data": [    {      "conversation": {        "id": "string",        "platform": "string",        "accountId": "string",        "participantName": "string",        "participantUsername": "string",        "participantPicture": "string",        "businessScopedUserId": "string",        "whatsappUsername": "string",        "status": "active",        "lastMessage": "string",        "lastMessageAt": "2019-08-24T14:15:22Z"      },      "matchCount": 0,      "matches": [        {          "id": "string",          "text": "string",          "direction": "incoming",          "timestamp": "2019-08-24T14:15:22Z"        }      ]    }  ],  "pagination": {    "hasMore": true,    "nextCursor": "string"  },  "meta": {    "accountsQueried": 0,    "accountsFailed": 0,    "failedAccounts": [      {        "accountId": "string",        "accountUsername": "string",        "platform": "string",        "error": "string"      }    ],    "lastUpdated": "2019-08-24T14:15:22Z",    "accountsSkipped": [      {        "accountId": "string",        "platform": "string"      }    ]  }}
OpenAPI specification
Was this page helpful?