Eventler
CRM’iniz iş olayını B2B Worker’a buradan gönderir.
Auth / scope
Authorization: Bearer b2b_…- Scope:
events:write(POST),events:read(GET)
POST /api/v1/events/
Event oluşturur; eşleşen aktif workflow varsa execution başlatır.
Headers
| Header | Zorunlu | Açıklama |
|---|---|---|
Authorization | evet | Bearer b2b_… |
Content-Type | evet | application/json |
Idempotency-Key | önerilir | Aynı key ile tekrar → aynı kayıt (çift tetik önler) |
Body’de idempotency_key de kabul edilir; header önceliklidir.
Body
{
"event": "FLIGHT_CHANGED",
"workflow": "flight-change",
"payload": {
"patient": { "phone": "+905551111111", "name": "Ali" },
"flight": { "airport": "IST", "time": "2026-07-20T14:30:00+03:00" }
}
}
| Alan | Açıklama |
|---|---|
event | Event type key (inbound katalog) |
workflow | Workflow key (panelde mono satır). CRM entegrasyonunda her zaman yazın. |
payload | Serbest JSON; şablon değişkenleri / koşullar buradan okunur |
Yanıt 201
{
"id": 18,
"event_type": "FLIGHT_CHANGED",
"payload": {},
"idempotency_key": "crm-123",
"source": "api",
"correlation_id": "…",
"workflow_key": "flight-change",
"created_at": "…",
"execution_id": 8
}
execution_id— eşleşen aktif akış yoksa gelmeyebilir.- 201 ≠ WhatsApp teslim. Detay: testcrm ↔ app.
curl
curl -X POST https://app.b2bworker.com/api/v1/events/ \
-H "Authorization: Bearer b2b_YOUR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: crm-patient-123" \
-d '{
"event": "FLIGHT_CHANGED",
"workflow": "flight-change",
"payload": {
"patient": { "phone": "+905551111111", "name": "Ali" },
"flight": { "airport": "IST", "time": "16:40" }
}
}'
GET /api/v1/events/
Org event listesi (panel / events:read).
GET /api/v1/events/{id}/
Tek event detayı.
Diğer
| Path | Açıklama |
|---|---|
GET /api/v1/events/catalog/ | Event katalog |
GET /api/v1/events/payload-sample/?event_type= | Örnek payload |
POST /api/v1/events/test-patient/ | Panel test tetikleyici |
Şema yönetimi: Şemalar.
UI
Panel: /events · testcrm: /events