Go from a verified brand to your first live RCS message. An agent is the sender your RCS messages come from. It goes through three stages: you build it, you test it with approved testers, and the carriers launch it. Each step below links the agent to the next stage.
Prerequisites: RCS enabled for your group, a brand and a campaign of that brand, a Ready number on the campaign for the SMS fallback, and funds in your wallet for the launch fees.
npm install @signalhouse-sms/sdkimport { SignalHouseSDK } from "@signalhouse-sms/sdk";
const signalHouse = new SignalHouseSDK({
apiKey: "your-api-token",
baseUrl: "https://v2.signalhouse.io",
});Save a draft on your brand and campaign. A draft may be incomplete; validate says what the next step still needs.
const { data: agent } = await signalHouse.rcs.agents.create({
brandId: "B1A2C3D",
campaignId: "C4E5F6G",
agent: {
name: "Acme Alerts",
description: "Order and delivery alerts from Acme",
logoUrl: "https://www.acme.example/rcs/logo-224.png", // 224 x 224, under 50 KB
heroUrl: "https://www.acme.example/rcs/hero-1440.png", // 1440 x 448, under 200 KB
phone: "+18005550142",
website: "https://www.acme.example",
email: "support@acme.example",
privacyPolicyUrl: "https://www.acme.example/privacy",
termsUrl: "https://www.acme.example/terms",
},
useCase: "TRANSACTIONAL",
defaultFallback: { from: "15125550100" }, // a number on the linked campaign
});
await signalHouse.rcs.agents.validate({ agentId: agent.agentId }); // what the next step still needsSubmitting creates the agent at the carrier partner, with no review first. The status moves to AGENT_CREATING, then to IN_TESTING when the partner reports it ready. Read status with signalHouse.rcs.agents.get.
await signalHouse.rcs.agents.submit({ agentId: agent.agentId });Once the agent is IN_TESTING, each number you add gets an invitation on its handset. A tester has 24 hours to accept it, and testerInvites on the agent reports where each one stands. Wait for APPROVED.
await signalHouse.rcs.agents.update({ agentId: agent.agentId, testers: ["15125559876"] });An Agent webhook receives the events of this agent only. Deliveries are signed, and a secondaryUrl gets one try when every attempt to url fails. See Webhooks and Webhook Signing.
const { data: webhook } = await signalHouse.webhooks.createWebhook({
webhookData: {
groupId: "G1234567",
name: "Acme Alerts events",
endpointType: "Agent",
agentId: agent.agentId,
url: "https://your-server.com/webhooks/rcs",
secondaryUrl: "https://backup.your-server.com/webhooks/rcs", // optional
subscribedEvents: ["MESSAGE_DELIVERED", "MESSAGE_FAILED", "MESSAGE_FALLBACK_TRIGGERED", "MESSAGE_RECEIVED", "SUGGESTION_RESPONSE", "USER_UNSUBSCRIBED", "USER_SUBSCRIBED"],
},
});
// Store webhook.signingSecret now: it is never returned again.Before any carrier launches, the agent reaches its approved testers only. Test traffic costs nothing on the RCS leg. A fallback leg is a real, billed SMS, so testing a fallback spends from your wallet.
await signalHouse.rcs.messages.send({
agentId: agent.agentId,
recipients: [{ phoneNumber: "15125559876" }],
content: { blocks: [{ id: "b1", kind: "text", text: "Your order from {{sender_name}} is ready." }] },
isTest: true,
});The launch needs every consent field, including the demonstration video you record during testing, and a contact. Blank consent fields fill from the linked campaign. The request charges launchFees from your wallet; a wallet that cannot cover them gets a 402 and the agent stays where it is. When the brand is in healthcare or insurance, also send acknowledgePhi: true to accept the protected health information disclosure.
await signalHouse.rcs.agents.update({
agentId: agent.agentId,
consent: {
optInDetails: "Customers tick a box at checkout to get order alerts.",
optInUrl: "https://www.acme.example/alerts",
optInResponse: "Acme: you will get order alerts. Reply STOP to stop.",
optOutDetails: "Reply STOP to any message.",
optOutResponse: "Acme: you are unsubscribed.",
helpResponse: "Acme: for help visit acme.example/help.",
campaignDescription: "Order confirmations and delivery updates from Acme.",
messageExamples: ["Acme: your order A-48213 has shipped."],
estimatedMonthlyVolume: "UP_TO_10K",
launchVideoUrl: "https://www.acme.example/rcs-demo.mp4",
},
contact: { firstName: "Ada", lastName: "Lovelace", role: "Marketing lead", email: "ada.lovelace@acme.example", mobile: "+15125550101" },
});
await signalHouse.rcs.agents.launch({ agentId: agent.agentId, acknowledgeFees: true });The status moves to PENDING_REVIEW while Signal House reviews the request, then to LAUNCH_SUBMITTED while the carriers review it. The agent is PARTIALLY_LAUNCHED from the first carrier that launches and LAUNCHED when every target carrier has. carriers on the agent follows each one. See RCS Agents for every status.
A handset that cannot take RCS, or whose carrier has not launched, gets the SMS fallback from your agent's default number, so one call reaches every recipient. You pay for the leg that delivers. See Messages for the full request.
const { data } = await signalHouse.rcs.messages.send({
agentId: agent.agentId,
recipients: [{ phoneNumber: "12025550187", clientMessageId: "ord-48213" }],
content: {
blocks: [
{ id: "b1", kind: "text", text: "Your order from {{sender_name}} is ready." },
{ id: "b2", kind: "suggestions", suggestions: [
{ type: "OPEN_URL", label: "Track package", postbackData: "track_pkg", url: "https://www.acme.example/track/A-48213", application: "BROWSER" },
] },
],
},
statusCallbackUrl: "https://your-server.com/webhooks/rcs-status", // optional
});
// data => { requested, enqueued, failed, bulkId, messages: [{ messageId, status, predictedChannel, billingClass, estimatedCostMicros, ... }] }A recipient who replies STOP is blocked from this agent's PROMOTION traffic and its SMS fallback leg, and USER_UNSUBSCRIBED fires. Other traffic types still reach them over RCS. A later START clears the block and USER_SUBSCRIBED fires. See Opt-outs.