Idempotency
Every POST to the iChatUp API accepts an Idempotency-Key header. If the same account sends the same key again within 24 hours, iChatUp returns the first response instead of running the request again, so a retry after a timeout cannot send the customer a second WhatsApp message or create a second record.
要点一览
| Header | Idempotency-Key |
|---|---|
| Applies to | POST requests that carry the header |
| Remembered for | 24 hours, per account |
| Maximum length | 255 characters |
| Replay marker | Response header Idempotent-Replay: true |
How it behaves
- The first request runs normally. If its response is final (any status below 500), iChatUp stores the status and body against your key.
- A later POST from the same account with the same key gets that stored response, with
Idempotent-Replay: true, and nothing is sent or saved again. - A 5xx answer is never stored, because it is treated as temporary, so a retry after a server error really runs.
- Keys from different accounts never collide.
- GET requests ignore the header.
Example
curl -X POST https://ichatup.com/api/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Idempotency-Key: order-A1042-confirmation" \
-d '{"phone": "+919876543210", "template": "order_confirmed", "variables": ["Asha", "A-1042"]}'HTTP/1.1 202 Accepted
Idempotent-Replay: true
{"id": 98231, "status": "accepted", "to": "+919876543210"}
Choosing keys
Build the key from something that identifies the business event, not the attempt: an order number plus the message kind, a form submission id, a deal id plus stage. A random value made fresh on every attempt protects nothing. Do not reuse one key for two different messages, or the second will silently return the first one’s answer. The key is stored only as a hash.
Retries and status codes are covered in errors and rate limits.
常见问题
What if I send the same key with a different body?
The stored first response is returned. iChatUp does not compare bodies, so use a new key for a new message.
Does idempotency apply to webhooks iChatUp sends me?
No. For incoming webhooks, de-duplicate on the X-iChatUp-Delivery header, which stays the same across retries.
在您自己的号码上试试
两分钟完成连接,免费试用 7 天,无需信用卡。AI 员工会在顾客已经熟悉的 WhatsApp 号码上回复、预订并跟进。