Webhooks

A webhook is simply a call which a system makes to another system when something happens. Newsletter, with the Webhooks addon, can be configure to call an external system (usually an API) when:

  • someone subscribes
  • some cancel the subscription
  • a newsletter is sent (on completion)

More trigger could be added in the future, feel free to ask!

Configuring a webhook is pretty simple: you need to know the web address to call (for example https://externalapi.org/something) and select which event should be monitored.

Every time that event happens, Newsletter makes a call to the system passing over a set of JSON encoded data (the subscriber details or the newsletter details).

Testing

After a webhook has been defined, it is listed with a test button. The test just builds a dummy set of data and do the call. If something goes wrong an alter should be shown and inside logs the reason should have been recorded (see below).

JSON examples

Subscriber data

{
"id": 123,
"email": "test@example.org",
"name": "John",
"surname": "Deere",
"status": "C",
"list_1": 1,
"list_2": 0
}

Newsletter data

{
"id": 123,
"subject": "What a nice day",
"message": "[full html message]",
"sent": 3450,
"click_count": 50,
"open_count": 189
}

How many webhooks can be defined?

As many as you need by pay attention: every call takes time and could slow down the subscription or cancellation process, specially if the receiving system is slow.

Are calls made asynchronously?

No, actually they’re made instantly when the event is triggered.

When something goes wrong

The addon stores all internal actions in a log that can be found on the Newsletter Logs panel. There you can find a (tech) explanation in the case something failed. Be sure to se an adequate log level on Newsletter main settings (if just testing is recommended to set the level to debug to get as much information as possible).

Have you ever considered going premium?

With a premium plan, you'll get whole collection of 30+ professional addons, along with a full year of updates and priority support. No automatic renewals, frequent releases and a solid 30 days refund policy.