Docs/Code Samples

Code Samples

Ready-to-use code examples to get you started quickly.

Send SMS with Delivery Callback

Node.js
import WeTalk from '@wetalk/sdk';

const client = new WeTalk('YOUR_API_KEY');

const result = await client.sms.send({
  to: '+1234567890',
  message: 'Your order has shipped!',
  callback_url: 'https://your-server.com/webhook'
});

console.log('Message ID:', result.message_id);

WhatsApp with Template

Python
from wetalk import WeTalk

client = WeTalk('YOUR_API_KEY')

result = client.whatsapp.send_template(
    to='+1234567890',
    template='order_confirmation',
    variables={'name': 'John', 'order_id': 'ORD-123'}
)

print(f'Message sent: {result.message_id}')