Create an RCS agent, define a welcome message, and send it to a test device in four steps.
Prerequisites
- API credentials (client ID and client secret) from the Developer tab in RCS Studio
- A brand already created in RCS Studio — you'll need its
brandId(copy it from the Brands & Agents page or retrieve it viaGET /brands) - A test device registered in RCS Studio (Adding a test device)
Step 1: Authenticate
Exchange your credentials for an access token.
curl -X POST https://auth.rcsstudio.ai/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=$CLIENT_ID" \
-d "client_secret=$CLIENT_SECRET"const response = await fetch('https://auth.rcsstudio.ai/oauth2/token', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: process.env.CLIENT_ID,
client_secret: process.env.CLIENT_SECRET,
}),
});
const { access_token } = await response.json();Save the returned access_token — you'll use it in all subsequent requests.
Step 2: Create an agent
curl -X POST https://api.rcsstudio.ai/agents \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My First Agent",
"brandId": "br_abc123",
"useCase": "TRANSACTIONAL"
}'const response = await fetch('https://api.rcsstudio.ai/agents', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'My First Agent',
brandId: 'br_abc123',
useCase: 'TRANSACTIONAL',
}),
});
const { agentId } = await response.json();Request fields
| Field | Type | Description |
|---|---|---|
name | string | Display name for the agent |
brandId | string | ID of the brand this agent belongs to |
useCase | string | TRANSACTIONAL, PROMOTIONAL, MULTI_USE, or OTP |
Save the returned agentId — you'll need it for all subsequent steps.
New agents start in test mode. Messages can only be sent to registered test devices until the agent is launched.
Step 3: Create a state
A state defines a message in your conversation flow. Create a simple welcome state that sends a text message.
curl -X POST https://api.rcsstudio.ai/agents/ag_abc123/states/welcome \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"flowEntryStateId": "welcome",
"template": {
"contentMessage": {
"text": "Hello! Welcome to My First Agent."
}
}
}'await fetch(`https://api.rcsstudio.ai/agents/${agentId}/states/welcome`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
flowEntryStateId: 'welcome',
template: {
contentMessage: {
text: 'Hello! Welcome to My First Agent.',
},
},
}),
});The stateId (welcome) is set in the URL path — it cannot be changed after creation.
Step 4: Send to a test number
Trigger the state for a registered test device using its E.164 phone number.
curl -X POST https://api.rcsstudio.ai/agents/ag_abc123/states/welcome/send/+15551234567 \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}'await fetch(
`https://api.rcsstudio.ai/agents/${agentId}/states/welcome/send/+15551234567`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
}
);Replace +15551234567 with your registered test device's phone number in E.164 format.
A 200 response means the message was enqueued for delivery. Check the device — you should see the RCS message arrive within a few seconds.