Methods Reference
Complete reference for all Convoup SDK methods.
client.sendOtp(args)
Send an OTP (one-time password) message.
| Arg | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone in international format (e.g. +918851479441) |
template | string | Yes | Name of the approved template |
code | string | number | Yes | OTP code to send |
language | string | No | Language code (default: en_US) |
extraParams | (string | number)[] | No | Additional body params after the code |
Example
TypeScript
await client.sendOtp({
to: '+918851479441',
template: 'test_welcome_template',
code: '123456',
extraParams: ['Acme Corp'],
});
client.sendInvoice(args)
Send an invoice or billing notification with optional media attachment.
| Arg | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone |
template | string | Yes | Name of the approved template |
params | (string | number)[] | No | Body placeholder values |
pdfUrl | string | No | PDF URL for document header (shorthand for headerMedia) |
headerMedia | HeaderMedia | No | Full media control (overrides pdfUrl) |
language | string | No | Language code (default: en_US) |
Example
TypeScript
await client.sendInvoice({
to: '+918851479441',
template: 'test_welcome_template',
params: ['INV-2024-001', 'Rs. 2,500'],
pdfUrl: 'https://files.example.com/invoices/INV-2024-001.pdf',
});
client.sendReminder(args)
Send an appointment reminder or follow-up.
| Arg | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone |
template | string | Yes | Name of the approved template |
params | (string | number)[] | No | Body placeholder values |
language | string | No | Language code (default: en_US) |
Example
TypeScript
await client.sendReminder({
to: '+918851479441',
template: 'test_welcome_template',
params: ['Rahul', 'Jul 20, 3:00 PM'],
language: 'hi_IN',
});
client.sendTemplate(args)
Full-control template send with header, body, and button parameters.
| Arg | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone |
template | string | Yes | Name of the approved template |
language | string | No | Language code (default: en_US) |
bodyParams | (string | number)[] | No | Body placeholder values |
headerParams | (string | number)[] | No | Text header placeholder values |
headerMedia | HeaderMedia | No | Media attachment |
buttonParams | ButtonParam[] | No | Dynamic button values |
Example
TypeScript
await client.sendTemplate({
to: '+918851479441',
template: 'test_welcome_template',
language: 'en_US',
headerParams: ['Acme Store'],
bodyParams: ['ORD-99', 'shipped'],
buttonParams: [
{ subType: 'url', index: 0, text: 'TRACK123' },
],
});
Types
HeaderMedia
TypeScript
{
type: 'image' | 'video' | 'document';
link: string;
}
ButtonParam
TypeScript
{
subType?: 'url' | 'quick_reply';
index?: number;
text: string;
}
ConvoupResponse
TypeScript
{
messageId: string;
waId: string;
}
Next Steps
- Client Constructor - SDK initialization options
- Template Discovery - Discover template parameters
- Error Codes - Handle all error scenarios
