RCS sender
A ready-to-use RCS sender can be configured using the Provisioning API in two basic steps:
Creating a sender
The following Node.js code sample demonstrates how to make a request to add a new RCS sender for a specific project:
import fetch from "node-fetch";
async function createSender() {
const response = await fetch(
`https://provisioning.api.sinch.com/v1/projects/${PROJECT_ID}/rcs/senders`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization:
"Basic " +
Buffer.from(ACCESS_KEY + ":" + ACCESS_SECRET).toString("base64"),
},
body: JSON.stringify({
region: "EU",
billingCategory: "BASIC_MESSAGE",
useCase: "PROMOTIONAL",
details: {
brand: {
emails: [
{
label: "Contact email",
address: "contact@test.com",
},
],
phones: [
{
label: "Contact phone",
number: "+33 777-777-777",
},
{
label: "Helpdesk",
number: "+48 888-888-888",
},
],
websites: [
{
label: "Website",
url: "https://test.com",
},
],
name: "Sender name",
description: "Sender description",
color: "#000000",
bannerUrl: "https://example-banner-url.com",
logoUrl: "https://example-logo-url.com",
privacyPolicyUrl: "https://example-privacy-policy-url.com",
termsOfServiceUrl: "https://example-terms-of-service-url.com",
},
callbackUrl: "https://example-callback-url.com",
testNumbers: ["+33 000111222"],
countries: ["PL", "GB", "FR"],
questionnaire: {
general: {
answers: {
optInDescription: "By making a purchase in-store or online",
triggerDescription:
"User actions (e.g. after making a purchase)",
interactionsDescription: "Promotional offers",
optOutDescription: "Thank you for unsubscribing",
videoUris: ["https://example-video-url.com"],
},
},
verification: {
answers: {
name: "Verification contact",
email: "verification@test.com",
title: "Head of verification",
website: "https://verification.test.com",
},
},
gb: {
answers: {
brandIndustry: "Automotive",
messagesVolume: "10K - 100K messages",
messagesFrequency: "Once per month",
campaignLength: "6 months",
},
},
fr: {
answers: {
fullCompanyAddress: "123 Rue des Fleurs, 75001 Paris, France",
usersAmount: "10k - 100K users",
startDate: "Within 3 months",
},
},
},
},
}),
}
);
const data = await response.json();
return data;
}
Note that the region
, billingCategory
, and useCase
fields are all required. Other fields and objects must be populated in the details
object as well, depending on you configuration. For more information on the fields included in this example, see the API reference.
After creating a sender, you may use it to interact with test devices. In order to make the sender accessible to all devices, it must be launched.
Launching a sender
Until a sender is launched, it can only interact with specified test devices. Launching the sender makes it accessible to all devices.
The Node.js code below shows how to make a launch request for a sender:
import fetch from "node-fetch";
async function launchSender() {
const response = await fetch(
`https://provisioning.api.sinch.com/v1/projects/${PROJECT_ID}/rcs/senders/${SENDER_ID}/launch`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization:
"Basic " +
Buffer.from(ACCESS_KEY + ":" + ACCESS_SECRET).toString("base64"),
},
}
);
const data = await response.json();
return data;
}
The sender endpoints return a full sender object that includes the sender state. The state refers to the various operational statuses that a sender can have throughout its lifecycle. Normally it transitions from IN_TEST
upon sender creation to LAUNCHING
when a launch request is made, and finally to LAUNCHED
when the launch has been successful on any of the available mobile operators. To track those changes, you can set sender callbackUrl
property to the address where updates about the sender state will be posted.