convoup Docs
Docs / Guides / Sending Invoices

Sending Invoices and Bills

Use sendInvoice() to send invoices, receipts, and billing notifications. This method supports attaching a PDF or image.

Basic Invoice (Text Only)

TypeScript
await client.sendInvoice({
  to: '+918851479441',
  template: 'test_welcome_template',
  params: ['INV-2024-001', 'Rs. 2,500', 'Jul 15, 2026'],
});

Invoice with PDF Attachment

TypeScript
await client.sendInvoice({
  to: '+918851479441',
  template: 'test_welcome_template',
  params: ['INV-2024-001', 'Rs. 2,500', 'Jul 15, 2026'],
  pdfUrl: 'https://files.yourapp.com/invoices/INV-2024-001.pdf',
});

Invoice with Image Header

TypeScript
await client.sendInvoice({
  to: '+918851479441',
  template: 'test_welcome_template',
  params: ['INV-2024-001', 'Rs. 2,500'],
  headerMedia: {
    type: 'image',
    link: 'https://files.yourapp.com/invoices/INV-2024-001.png',
  },
});

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": "INV-2024-001"},
      {"type": "text", "text": "Rs. 2,500"},
      {"type": "text", "text": "Jul 15, 2026"}
    ],
    "header_media": {
      "type": "document",
      "link": "https://files.yourapp.com/invoices/INV-2024-001.pdf"
    }
  }'

Per-Customer Dynamic PDFs

Each customer gets a unique PDF URL. The SDK handles this naturally:

TypeScript
const customers = [
  { phone: '+918851479441', invoiceId: 'INV-001', amount: 'Rs. 2,500', pdf: 'https://api.yourapp.com/invoices/INV-001.pdf' },
  { phone: '+919876543210', invoiceId: 'INV-002', amount: 'Rs. 4,800', pdf: 'https://api.yourapp.com/invoices/INV-002.pdf' },
  { phone: '+917654321098', invoiceId: 'INV-003', amount: 'Rs. 1,200', pdf: 'https://api.yourapp.com/invoices/INV-003.pdf' },
];

for (const c of customers) {
  await client.sendInvoice({
    to: c.phone,
    template: 'test_welcome_template',
    params: [c.invoiceId, c.amount],
    pdfUrl: c.pdf,
  });
}

Media Requirements

RequirementDetail
URL accessibilityMust be publicly reachable (no auth, no IP restrictions)
HTTPSURLs must use HTTPS
File sizeMax 5MB for images, 16MB for videos, 100MB for documents
Supported formatsImages: JPG, PNG; Videos: MP4; Documents: PDF
CachingMeta caches media for 30 days; use unique URLs for unique content

Next Steps