Invoices
API for sending invoices via WhatsApp
Reading time: 2 minutes
Invoices
Comprehensive API for sending invoices via WhatsApp with PDF attachment support.
Send Invoice via WhatsApp
POST
{{base_url}}/invoice-messageSend a complete invoice with attached PDF file to your customer via WhatsApp.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
phone_number_id | string | Yes | Sender phone number ID |
Request Body (form-data)
| Parameter | Type | Required | Description |
|---|---|---|---|
phone | string | Yes | Recipient phone number in international format (e.g., 96650000000) |
message_text | string | Yes | Message text (max 1024 characters) |
header_type | string | Yes | Header type: TEXT, IMAGE, DOCUMENT, VIDEO, LOCATION |
header_media | file | No | PDF invoice file (max 100MB) |
header_value | string | No | Header value (URL for media, text for text) |
name | string | No | Contact name (for new contacts) |
email | string | No | Email address (for new contacts) |
Tip: Use header_type="DOCUMENT" with header_media to attach a PDF invoice file.
Example Request
Example Requestbash
curl -X POST "https://api.awalchat.com/api/developer/invoice-message?phone_number_id=123456" \
-H "Accept: application/json" \
-H "X-Awal-Signature-256: sha256=abc..." \
-H "X-Timestamp: 1704124800" \
-H "X-Domain: your-workspace" \
-H "X-Client-ID: your-client-id" \
-F "phone=96650000000" \
-F "message_text=Dear Ahmed, š Invoice #INV-2024-001 Your invoice has been issued for 1,250 SAR..." \
-F "header_type=DOCUMENT" \
-F "header_media=@/path/to/invoice.pdf"Example Response
Response200 OK
{
"status": true,
"message": {
"id": 281,
"messageId": "wamid.HBgMOTY2NTAwMDAwMDAwFQIAERgS...",
"status": "sent",
"date": "2024-01-15T10:30:00Z"
}
}Message Text Example
Message Text Templatetext
Dear Ahmed,
š Invoice #INV-2024-001
Your invoice has been issued for 1,250 SAR dated January 15, 2024.
Invoice Details:
- Tax Amount: 125 SAR
- Total: 1,375 SAR
- Due Date: January 30, 2024
Always at your service.Important Notes
ā ļø
Files
- File must be in PDF format
- Maximum file size: 100MB
- File will be attached as message header
- Ensure the file is readable on mobile devices
š”
Text
- You can use Emoji in text to enhance the experience
- Maximum length: 1024 characters
- Use clear and organized formatting
ā
Best Practices
- Use clear and sequential invoice numbers
- Include invoice details in the text
- Verify phone number before sending
- Test sending on a test number first
Use Cases
1. Send Simple Invoice
curl -X POST "https://api.awalchat.com/api/developer/invoice-message?phone_number_id=123456" \
-F "phone=96650000000" \
-F "message_text=Your invoice is ready! š" \
-F "header_type=TEXT" \
-F "header_value=Invoice #INV-001"2. Send Invoice with PDF
curl -X POST "https://api.awalchat.com/api/developer/invoice-message?phone_number_id=123456" \
-F "phone=96650000000" \
-F "message_text=Your attached invoice š" \
-F "header_type=DOCUMENT" \
-F "header_media=@invoice.pdf"Error Codes
| Code | Description | Cause | Solution |
|---|---|---|---|
| 400 | Bad Request | Invalid data | Check sent data |
| 413 | Payload Too Large | File too large | Use file smaller than 100MB |
| 415 | Unsupported Media Type | Unsupported file type | Use PDF only |
Related Sections
Technical Support
Need help?
- š§ Email: support@awalchat.com
- š¬ Live Chat: Available in the dashboard
- š± WhatsApp: Contact us directly via WhatsApp
- š Examples: Check Code Examples