Send SMS Using the SDK
sendSms(payload: { phone_number: string; caller_id: string; sms_body: string; pool_id: string; opt_in: boolean; })
sendSms(payload: { phone_number: string; caller_id: string; sms_body: string; pool_id: string; opt_in: boolean; })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
Last updated
Was this helpful?