Pro testování webhooků doporučujeme využít službu https://requestbin.com/.
Webhook v automatizaci
Webhooky jsou doručeny na zadanou URL adresu metodou POST
ve formátu JSON
a to s tímto obsahem:
{
"account": "example_account",
"pipeline": 12345,
"action": "67890",
"email": "subscriber@example.com",
"subscriber": {
"id": 1000001,
"name": "John",
"surname": "Doe",
"email": "subscriber@example.com",
"gender": "male",
"vokativ": "John",
"bounce_soft": 0,
"bounce_soft_count": 0,
"bounced_hard": 0,
"bounce_message": null,
"inserted_at": "2025-05-14 09:39:15",
"rating": 5,
"nameday": "07-25",
"source": "example_source",
"company": "",
"street": "Example Street 123",
"city": "Example City",
"country": "XX",
"zip": "12345",
"phone": "+1234567890",
"pretitle": null,
"surtitle": null,
"birthday": null,
"notes": null,
"vokativ_s": "Johnny",
"optimized_delivery": null,
"tags": [
"tag1",
"tag2"
],
"last_open": "2025-07-01 13:21:23",
"last_click": "2025-06-25 14:01:33",
"last_pageview": null,
"raynet_id": null,
"last_delivery": null,
"since_last_open": null,
"since_last_click": null,
"last_transaction_id": null,
"last_transaction": null,
"automations": null,
"sends_since_open": null,
"sends_since_click": null,
"skips": null,
"attributions": null,
"active": 1
},
"subscribers": [
{
"id": 1000001,
"name": "John",
"surname": "Doe",
"email": "subscriber@example.com",
"gender": "male",
"vokativ": "John",
"bounce_soft": 0,
"bounce_soft_count": 0,
"bounced_hard": 0,
"bounce_message": null,
"inserted_at": "2025-05-14 09:39:15",
"rating": 5,
"nameday": "07-25",
"source": "example_source",
"company": "",
"street": "Example Street 123",
"city": "Example City",
"country": "XX",
"zip": "12345",
"phone": "+1234567890",
"pretitle": null,
"surtitle": null,
"birthday": null,
"notes": null,
"vokativ_s": "Johnny",
"optimized_delivery": null,
"tags": [
"tag1",
"tag2"
],
"last_open": "2025-07-01 13:21:23",
"last_click": "2025-06-25 14:01:33",
"last_pageview": null,
"raynet_id": null,
"last_delivery": null,
"since_last_open": null,
"since_last_click": null,
"last_transaction_id": null,
"last_transaction": null,
"automations": null,
"sends_since_open": null,
"sends_since_click": null,
"skips": null,
"attributions": null,
"active": 1
}
]
}
account - ID účtu u Ecomailu
pipeline - ID automatizace
action - ID akce
subscribers - pole s JSON objekty uživatelů, jichž se událost týká
Zpracování webhooku pak záleží na jazyku, který používáte. V případě PHP to může být například takto:
$json = json_decode(file_get_contents('php://input'));
Momentálně Ecomail neřeší, zda byl webhook úspěšně zpracován, nebo ne a nechává tuto zodpovědnost na straně zákazníka.