For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
SupportDashboard
DocsAPI ReferenceWebhooksMethodsUI ComponentsMCP ServerChangelog
  • Documentation
    • Introduction
    • Authentication
    • RCS Support
  • Quickstart
    • SMS
    • RCS
      • Python
      • TypeScript
        • Send
        • Receive
      • Ruby
  • Guides
    • Purchase Phone Numbers
    • Brands
    • Campaigns
    • Messages
    • Branded Test Agents
    • Handling Expired URLs
LogoLogo
SupportDashboard
QuickstartRCSTypeScript

Sending RCS Messages

1import { config } from "dotenv";
2import { PinnacleClient } from "rcs-js";
3
4// Load environment variables from .env file
5config();
6
7const client = new PinnacleClient({ apiKey: process.env.PINNACLE_API_KEY });
8
9async function send_basic_text(text: string) {
10const res = await client.messages.rcs.send({
11 quickReplies: [
12 {
13 type: "openUrl",
14 payload: "https://docs.pinnacle.sh/",
15 title: "View docs",
16 },
17 ],
18 options: {
19 validate: true,
20 },
21 text: text,
22 from: process.env.AGENT_ID || "",
23 to: "+18708977103",
24});
25
26return res;
27}
28
29async function send_rich_card(
30title: string,
31media_url: string,
32subtitle?: string
33) {
34const res = await client.messages.rcs.send({
35 quickReplies: [
36 {
37 type: "openUrl",
38 payload: "https://docs.pinnacle.sh/",
39 title: "View docs",
40 },
41 ],
42 cards: [
43 {
44 media: media_url,
45 title: title,
46 subtitle: subtitle,
47 buttons: [
48 {
49 type: "openUrl",
50 metadata: "",
51 payload: "https://docs.pinnacle.sh/quickstart/rcs",
52 title: "RCS Quickstart Guide",
53 },
54 {
55 type: "openUrl",
56 metadata: "",
57 payload: "https://docs.pinnacle.sh/api-reference/messages/send-rcs",
58 title: "RCS API Reference",
59 },
60 ],
61 },
62 ],
63 options: {
64 validate: true,
65 },
66 from: process.env.AGENT_ID || "",
67 to: "+12345678910",
68});
69
70return res;
71}
72
73const basic = await send_basic_text("This is a basic RCS text message");
74const rich = await send_rich_card(
75"Hello, world!",
76"https://server.trypinnacle.app/storage/v1/object/sign/vault/3/67330f56-8fc4-4d9e-882d-161b84fc8e31/Your_image_here.png?token=eyJraWQiOiJzdG9yYWdlLXVybC1zaWduaW5nLWtleV9hOGI0YTI0NC00NzY4LTRhOTktYWI4MS1iNmZhNTZhNGQyZWYiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJ2YXVsdC8zLzY3MzMwZjU2LThmYzQtNGQ5ZS04ODJkLTE2MWI4NGZjOGUzMS9Zb3VyX2ltYWdlX2hlcmUucG5nIiwiaWF0IjoxNzYwOTg0OTEwLCJleHAiOjMxNzEyMDk4NDkxMH0.bcIMtiBAvV8C7Gw7uYaR5TMGsCep7w1TvRMjoRlP_-g",
77"This is an example RCS card message."
78);
79
80console.log(
81"Basic RCS with quick replies:",
82basic,
83"Rich card with quick replies",
84rich
85);
Was this page helpful?
Previous

Receiving RCS Messages

Next
Built with

Prerequisites

Before proceeding, ensure you have obtained a phone number and API key as described in the prerequisites.

Installation

Install the Pinnacle TypeScript SDK, dotenv, and TypeScript type definitions:

$npm i rcs-js dotenv
$npm i --save-dev @types/node

This guide uses version rcs-js>=2.0.3. It’s compatible with the following runtimes: Node.js 18+, Vercel, Cloudflare Workers, Deno v1.25+, Bun 1.0+, and React Native.

Configuration

Create an .env file in your project root and add your Pinnacle API key and RCS agent ID:

PINNACLE_API_KEY="your_api_key" # pnclk_
AGENT_ID="your_agent_id" # agent_

Sending Your First RCS Message

Create a new TypeScript file (e.g., index.ts) and add the following code to the right.

Quick replies are optional. For sending media urls, you can also use storage on the dashboard under System > Storage or via our API

Run the script:

$npx tsx index.ts

If successful, you should receive 2 texts to your device (a basic text with quick replies and a card with quick replies). You can see more properties for RCS messages in the API reference.