InboboDocsMenu

Guides

Callbacks

Inbobo posts signed events to your server when a message changes status and when a customer writes to you.

Set up

Provide a callback URL when your consumer is created, or set it any time with PUT /callback. It must be an http or https URL that is reachable from the internet. You also receive a signing secret for verifying events.

Events

Event typeWhen
whatsapp.message.status
sms.message.status
email.message.status
A message you sent changes status: sent, delivered, read or failed.
whatsapp.message.received
sms.message.received
email.message.received
A customer sends a message on one of your channels.

Status event

POST to your callback URL
{
  "schema_version": "1.0",
  "event_id": "evt_8f2c1a9d3b7e4c5a6d10f2b9",
  "event_type": "whatsapp.message.status",
  "occurred_at": "2026-11-27T10:15:00Z",
  "channel_id": "ch_12",
  "message_id": "msg_981",
  "provider_message_id": "wamid.HBgMMjU1NzEyMzQ1Njc4",
  "status": "delivered",
  "status_at": "2026-11-27T10:15:00Z",
  "error_code": null,
  "correlation": { "invoice_id": "1042" }
}

correlation is exactly what you sent in the original request, so you can match the event to your own record. error_code is set when the status is failed.

Inbound event

POST to your callback URL
{
  "schema_version": "1.0",
  "event_id": "evt_31b0c2e47a9d4f1e8b6a05c3",
  "event_type": "whatsapp.message.received",
  "occurred_at": "2026-11-27T10:20:00Z",
  "channel_id": "ch_12",
  "provider_message_id": "wamid.HBgMMjU1NzEyMzQ1Njc4",
  "sender": { "wa_id": "255712345678", "name": "Amina" },
  "message": { "type": "text", "text": "Please resend my invoice", "attachments": [] },
  "conversation_id": 204
}

sender holds wa_id, phone or email depending on the channel, plus the contact name. Email events also carry message.subject. Attachments, when present, are listed in message.attachments.

Verify the signature

Every event carries the same signature in two headers, X-Inbobo-Signature and X-Niaje-Signature (so existing Niaje receivers keep working).

Header
X-Inbobo-Signature: t=1795860900,v1=5c1f0a...e2
  1. Read the raw request body before parsing it.
  2. Compute the hex HMAC-SHA256 of "<t>.<raw body>" using your signing secret.
  3. Compare it to v1 in constant time.
  4. Reject events whose timestamp t is more than a few minutes old.
func verify(secret, header string, rawBody []byte) bool {
	parts := strings.Split(header, ",") // "t=1795860900,v1=<hex>"
	if len(parts) != 2 {
		return false
	}
	timestamp := strings.TrimPrefix(parts[0], "t=")
	signature := strings.TrimPrefix(parts[1], "v1=")

	seconds, err := strconv.ParseInt(timestamp, 10, 64)
	if err != nil || time.Since(time.Unix(seconds, 0)) > 5*time.Minute {
		return false // stale or malformed: replay protection
	}

	mac := hmac.New(sha256.New, []byte(secret))
	mac.Write([]byte(timestamp + "." + string(rawBody)))
	expected := hex.EncodeToString(mac.Sum(nil))
	return hmac.Equal([]byte(expected), []byte(signature))
}

A complete handler

Go
func (h *Handler) Callback(w http.ResponseWriter, r *http.Request) {
	raw, _ := io.ReadAll(r.Body) // verify against the raw body

	if !verify(os.Getenv("INBOBO_SIGNING_SECRET"), r.Header.Get("X-Inbobo-Signature"), raw) {
		http.Error(w, "bad signature", http.StatusUnauthorized)
		return
	}

	var event map[string]any
	if err := json.Unmarshal(raw, &event); err != nil {
		http.Error(w, "bad json", http.StatusBadRequest)
		return
	}
	if h.alreadyProcessed(fmt.Sprint(event["event_id"])) { // retries reuse the same event_id
		w.WriteHeader(http.StatusOK)
		return
	}

	switch fmt.Sprint(event["event_type"]) {
	case "whatsapp.message.status", "sms.message.status", "email.message.status":
		h.recordDelivery(event["message_id"], event["status"], event["correlation"])
	case "whatsapp.message.received", "sms.message.received", "email.message.received":
		h.handleReply(event["sender"], event["message"])
	}
	w.WriteHeader(http.StatusOK) // any 2xx acknowledges the event
}

Delivery, retries and ordering

  • Return any 2xx to acknowledge an event. Anything else, or a timeout (10 seconds), is retried.
  • An event is attempted up to 8 times in total with growing delays, then dropped. Use GET /messages/:id to reconcile anything you missed.
  • Each event has a stable event_id. A redelivery carries the same id, so deduplicate on it.
  • Events can arrive out of order. Treat status as moving forward only: sent, then delivered, then read.
  • Respond quickly and do heavy work asynchronously.