Sending SMS Messages

Prerequisites

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

Installation

Initialize a new Node.js project:

$npm init -y

Install the Pinnacle TypeScript SDK and dotenv:

$npm i rcs-js dotenv

Install node types:

$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:

PINNACLE_API_KEY="your_api_key" # pnclk_
SENDER_NUMBER="your_phone_number" # +12345678910

Sending Your First SMS

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

Run the script:

$npx tsx index.ts

If successful, the recipient will receive your SMS message! You should also see the result of the message send in your console.