Skip to content

Instantly share code, notes, and snippets.

@kezzico
Created May 5, 2025 16:49
Show Gist options
  • Save kezzico/3fc5db0ee1f8019e675dae61fe2d6b64 to your computer and use it in GitHub Desktop.
Save kezzico/3fc5db0ee1f8019e675dae61fe2d6b64 to your computer and use it in GitHub Desktop.
// plivoTestApp.ts
import * as plivo from 'plivo';
// Replace with your actual credentials
const AUTH_ID = 'YOUR_AUTH_ID';
const AUTH_TOKEN = 'YOUR_AUTH_TOKEN';
const SOURCE_NUMBER = '+15552123333'
const DEST_NUMBER = '+15552124444';
const client = new plivo.Client(AUTH_ID, AUTH_TOKEN);
async function sendSMS(src: string, dst: string, text: string): Promise<void> {
try {
const response = await client.messages.create(
src,
dst,
text
);
console.log('Message sent successfully. UUID:', response.messageUuid);
} catch (error) {
console.error('Error sending SMS:', error);
}
}
async function main() {
await sendSMS(
SOURCE_NUMBER, // Your Plivo phone number
DEST_NUMBER, // Destination number (E.164 format like +14155552671)
'Hello from Plivo Test App in TypeScript!'
);
}
main().catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment