Skip to content
Longplay
Docs
Browse docs / Customer messaging

Customer messaging

Connect merchant channels, record Customer consent, send Email, SMS, Voice or Push and read receipts.

Markdown
API v1

Connect a merchant channel#

Send Email, SMS, Voice or Push to a consenting Customer. Install the SDK matching your runtime and confirm the API origin, App and environment.

  • Configure your provider account, sender identity and callbacks under Integrations → Message channels (/workspace/push-channels) in Console, then complete channel verification.
  • Email uses Resend, SMS and Voice use Twilio, and Push uses APNs or FCM. Your provider bills you directly.
  • Use a Server Key with messaging:write on your backend in the same scope. Customer Tokens manage only that Customer's consent and devices; they cannot send messages.

Send and read from your backend#

This example sends an email to a consenting Customer and reads that message. customerId must be a Customer UUID in the current App/environment. Persist requestId and a future expiresAt in your business record before sending; retain the original inputs for retries.

messaging.server.tsTypeScript
import { createLongplayServer } from "@tinkerlandai/longplay-sdk/server"; const longplay = createLongplayServer({  baseUrl: process.env.LONGPLAY_API_URL!,  apiKey: process.env.LONGPLAY_SERVER_KEY!,  scope: { projectId: process.env.LONGPLAY_PROJECT_ID!, environment: "sandbox" },}); export async function sendUpdate(  customerId: string,  requestId: string,  expiresAt: string,) {  const { message } = await longplay.sendMessage({    requestId,    customerId,    expiresAt,    message: {      channel: "email",      content: { subject: "Your offers", text: "Your saved offers are ready." },    },  });  return longplay.readMessage({ messageId: message.messageId });}

Without connectionId, Email/SMS/Voice use the scope's primary connection; Push uses each installation's verified connection. Send requests accept neither raw provider secrets nor arbitrary recipient addresses. Python uses send_message/read_message and Go uses SendMessage/ReadMessage; see each operation reference for fields and limits.

Distinguish acceptance, delivery and unknown results#

  • Store the returned messageId. Acceptance from sendMessage means the request was admitted. Use readMessage to inspect each delivery and its verified receipts; completed processing does not prove provider delivery.
  • After a request timeout, retry with the same requestId and original content to recover the accepted result. Keep that identity. When a delivery is unknown, await the original send's receipt or reconciliation result.
  • Connection deactivation, contact changes, consent withdrawal, suppression, frequency or expiry can block later dispatch. Email unsubscribe and SMS STOP update the corresponding consent; they grant no consent to another channel.

Broadcasts, Funnels and merchant notifications#

Create single-channel broadcasts under Marketing → Email, SMS, Voice or Push (/workspace/marketing/push) in Console, selecting an audience, content and schedule. Funnels can invoke the same messaging capability. Both follow current Customer consent and sending rules.

Customer messaging sends to your Customers. Merchant notifications and webhooks send purchase, usage or task results to your backend; follow their separate guide.

Related: Merchant notifications and webhooks·Errors and recovery

Related operations#