OverviewProductsPlatformsAPI ReferenceResources

Create a tracked iMessage opt-in link

POSThttps://zernio.com/api/v1/imessage/senders/{senderId}/opt-in-links

Generates a per-campaign link that opens Messages on this sender with body prefilled.

Authentication

AuthorizationBearer tokenRequired

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

Path parameters

senderIdstringRequired

Body

application/json

What every request needs

bodystring, max 500Required

Prefilled message text. Must contain the literal [opt-in-code] placeholder, e.g. "Hi! My code is [opt-in-code]".

Optional parameters2 fields
parametersobject

Custom key/values (e.g. leadId, campaign) echoed back on the opt-in message.

optInCodestring, max 8

Your own code in place of the generated one (3-8 characters, no spaces or #, !, -). An unredeemed link lives 24 hours; re-issuing with the same code replaces it, and the earlier URL stops matching.

Responses

Success· the request worked

Errors· the request failed

How it behaves

Why use it

A thread the contact opens skips the pacing and the first-message content rule that apply when the sender writes first.

It is also the only way in for senders without the add-on for new contacts. Their sends to anyone else fail with recipient_must_message_first.

Attribution

Each link carries a unique code in place of the [opt-in-code] placeholder. When the contact sends it, the resulting message.received webhook (and the stored inbox message's metadata) has optIn: true and your parameters under optInParameters.

That lets you attribute the conversation to the campaign or lead that produced it.

For an untracked link, use the sender's optInLink instead.

POST/v1/imessage/senders/{senderId}/opt-in-links
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.imessage.createImessageOptInLink({  path: {    senderId: 'sender_abc123',  },  body: {    body: 'Hello, world!',  },});console.log(data);
{  "success": true,  "link": {    "id": "string",    "imessage": "string",    "sms": "string",    "whatsapp": "string",    "url": "string"  }}
OpenAPI specification
Was this page helpful?