For the WhatsApp team — fetch challan details and PDF URL to send to customer / sales / admin.
Also see: All API links · Service Call API · Full process API
https://erp.clarionit.in
Auth (same token as Service Call API):
Authorization: Bearer YOUR_BOT_API_TOKEN # or X-Api-Key: YOUR_BOT_API_TOKEN
Token is set in ERP .env as BOT_API_TOKEN. Share this token only with the WhatsApp provider server — never put it in a public app or website JS.
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/challans | List (status, type, visit_id, search) |
| POST | /api/challans | Create (visit_id + items) |
| GET | /api/challans/{id} | Detail |
| PUT/PATCH | /api/challans/{id} | Update items / party / payment |
| POST | /api/challans/{id}/account | Account bill status |
| GET | /api/challans/{id}/pdf | PDF URL |
| POST | /api/challans/{id}/pdf-refresh | Regenerate PDF |
| GET | /api/challans/by-number | Lookup by Sr No |
| DELETE | /api/challans/{id} | Soft delete |
Status: 1 Submitted · 2 Billed · 3 Hold · 4 Cash Received · 5 Sent Back
Type: 1 Billable · 2 Non-Billable · 3 Other
/api/challans
curl -X POST "https://erp.clarionit.in/api/challans" \
-H "Authorization: Bearer YOUR_BOT_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"visit_id": 816,
"remark": "Work done on site",
"payment_received": 0,
"items": [
{
"description": "Service charge",
"machine_no": "SN123",
"qty": 1,
"rate": 500,
"billable": 1
}
]
}'
Creates Sr No CIPL/DL/{id}, generates PDF, sends Telegram/WhatsApp notifications. One challan per visit (409 if already exists).
/api/challans/{id}
curl -X PUT "https://erp.clarionit.in/api/challans/123" \
-H "Authorization: Bearer YOUR_BOT_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"party_name": "Customer Pvt Ltd",
"remark": "Updated items",
"items": [
{ "description": "Toner", "machine_no": "", "qty": 2, "rate": 1200, "billable": 1 }
]
}'
/api/challans/{id}/account
curl -X POST "https://erp.clarionit.in/api/challans/123/account" \
-H "Authorization: Bearer YOUR_BOT_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"status": 2,
"bill_no": "CIPL/BL/123",
"accountremark": "Billed in Tally"
}'
Optional multipart: bill_file (PDF/image). Notifies sales + client.
/api/challans/{id}
curl "https://erp.clarionit.in/api/challans/123" \ -H "Authorization: Bearer YOUR_BOT_API_TOKEN" \ -H "Accept: application/json"
Response includes chalan_no, customer phone, line items, pdf_url, bill_url, status.
/api/challans/by-number?chalan_no=CIPL/DL/123
curl "https://erp.clarionit.in/api/challans/by-number?chalan_no=CIPL%2FDL%2F123" \ -H "Authorization: Bearer YOUR_BOT_API_TOKEN" \ -H "Accept: application/json"
/api/challans/{id}/pdf
curl "https://erp.clarionit.in/api/challans/123/pdf" \ -H "Authorization: Bearer YOUR_BOT_API_TOKEN" \ -H "Accept: application/json"
Success example
{
"success": true,
"data": {
"challan_id": 123,
"chalan_no": "CIPL/DL/123",
"pdf_url": "https://erp.clarionit.in/storage/challans/pdf/challan_123.pdf",
"customer_phone": "98XXXXXXXX",
"customer_name": "Customer Name",
"message_hint": "Delivery Challan CIPL/DL/123 — please find the PDF attached."
}
}
WhatsApp bot should download/send pdf_url as a document to customer_phone (and optionally sales/admin numbers).
/api/service-calls/{id}/challans
curl "https://erp.clarionit.in/api/service-calls/1371/challans" \ -H "Authorization: Bearer YOUR_BOT_API_TOKEN" \ -H "Accept: application/json"
When a Delivery Challan is created, ERP POSTs to your WhatsApp send API so the provider can message client + accounts with PDF (and image if any).
WHATSAPP_ENABLED=true WHATSAPP_API_URL=https://your-provider.com/send WHATSAPP_API_TOKEN=their_token WHATSAPP_ACCOUNT_PHONES=98XXXXXXXX,97XXXXXXXX WHATSAPP_ADMIN_PHONES=
Event payload (challan.created):
{
"event": "challan.created",
"source": "erp",
"phones": ["98CLIENTXXX", "98ACCOUNTXXX"],
"recipients": {
"client": ["98CLIENTXXX"],
"accounts": ["98ACCOUNTXXX"],
"admin": []
},
"message": "Delivery Challan Created ...",
"media_url": "https://erp.clarionit.in/storage/challans/pdf/challan_123.pdf",
"media_type": "document",
"image_url": null,
"data": {
"challan_id": 123,
"challan_no": "CIPL/DL/123",
"engineer_name": "Engineer Name",
"customer_phone": "98CLIENTXXX",
"pdf_url": "..."
}
}
Provider duty: send message + PDF (media_url) to every number in phones (or use recipients.client / recipients.accounts).
Until WHATSAPP_API_URL is set, ERP still creates the PDF — Telegram works; WhatsApp waits for their send API.
BOT_API_TOKEN on the WhatsApp server only. PDF URLs under /storage/... are public file links — treat them as sensitive customer documents.