Send SMS Using the SDK

sendSms(payload: { phone_number: string; caller_id: string; sms_body: string; pool_id: string; opt_in: boolean; })


Returns: Promise<object> — API response with a status (status value should be "queued").

Example:

// Download the helper library from https://www.npmjs.com/package/dropcowboy
const { DropCowboy } = require("dropcowboy"); // Or, for ESM: import { DropCowboy } from "dropcowboy";

// Find your Team ID and Secret at dropcowboy.com/appv1/#/api
// and set the environment variables.
const teamId = process.env.DROPCOWBOY_TEAM_ID;
const secret = process.env.DROPCOWBOY_SECRET;
const client = new DropCowboy({ teamId: teamId, secret: secret });

async function sendMessage() {
      const sms = await client.sendSms({
            phone_number: "+15552223333",
            caller_id: "+15557778888",
            pool_id: "text",
            sms_body: "Hello world",
            opt_in: true,
            callback_url: "http://example.com",
            foreign_id: "00000000-0000-0000-0000-000000000000"
      });

      console.log(sms.status); // "queued"
};

sendMessage();

Parameters:

Name
Type
Required
Description

team_id

string

yes

Located on the API Setting tab.

Example: <Your Team ID>

secret

string

yes

Located on the API Setting tab.

Example: <Your Team Secret>

caller_id

string

yes

Phone number to forward calls/texts when contact replies. Must be in E.164 format.

Example: +15557778888

phone_number

string

yes

Your contact's phone number in E.164 format.

Example: +15552223333

pool_id

string

yes

ID of the private number pool registered to send SMS messages

sms_body

string

yes

Plain text message. Character limit: 160.

Example: Hello World

opt_in

boolean

yes

Confirmation that you obtained OPT-IN permission.

Example: true

foreign_id

string

optional

Value to identify this drop in your system. Passed through to webhook callback. Max length 256 characters.

Example: <Your system's ID>

callback_url

string

optional

Override default RVM webhook URL.

Example: http://example.com

Last updated

Was this helpful?