Sending Reminders
Use sendReminder() for appointment reminders, payment due notices, and follow-ups.
Basic Reminder
TypeScript
await client.sendReminder({
to: '+918851479441',
template: 'test_welcome_template',
params: ['Rahul', 'Jul 20, 3:00 PM', 'Dr. Sharma'],
});cURL Equivalent
bash
curl -X POST https://api.convoup.com/api/v1/templates \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"to": "+918851479441",
"template_name": "test_welcome_template",
"language": "en_US",
"body_params": [
{"type": "text", "text": "Rahul"},
{"type": "text", "text": "Jul 20, 3:00 PM"},
{"type": "text", "text": "Dr. Sharma"}
]
}'Reminder with Language Override
TypeScript
await client.sendReminder({
to: '+918851479441',
template: 'test_welcome_template',
params: ['Rahul', 'Jul 20, 3:00 PM'],
language: 'hi_IN', // Hindi
});Response
JSON
{
"messageId": "meta-msg-abc123",
"waId": "918851479441"
}Error Handling
TypeScript
import { Convoup, ConvoupError } from 'convoup';
try {
await client.sendReminder({
to: '+918851479441',
template: 'test_welcome_template',
params: ['Rahul', 'Jul 20, 3:00 PM', 'Dr. Sharma'],
});
} catch (err) {
if (err instanceof ConvoupError) {
switch (err.code) {
case 'TEMPLATE_NOT_FOUND':
console.error('Template not found. Create it in the Convoup dashboard.');
break;
case 'TEMPLATE_PARAM_MISMATCH':
console.error('Param mismatch:', err.message);
break;
case 'RECIPIENT_SUPPRESSED':
console.error('Recipient is blocked.');
break;
default:
console.error(`API error ${err.status}: ${err.message}`);
}
}
}Next Steps
- Sending OTPs - Login codes and verification messages
- Sending Invoices - Bills with PDF attachments
- Language Support - Multi-language reminders
