de en


Schnittstellen: WebHooks

 

Webhooks provide a universal and simple way to trigger an event on another server when an event occurs on one server.

For example, the MAILINGWORK event "Newsletter signup successful" passes the signup data to a URL on your server. This is done in the form of JSON in the body of the POST request. Internally, WebHooks are also used by our Zapier interface.

Manage WebHooks in MAILINGWORK 

WebHooks can be created, viewed, and deleted using the MAILINGWORK web service (API). Reactivation of failed WebHooks is optionally possible via API or via click within the triggered system notification.

There are four API functions for managing webhooks. The quickest way to learn the behavior of API functions is to use the menu 'Tools ⇒ Interfaces ⇒ Web Service Demo'. Fill in the desired parameters and copy the generated sample code into your script.

Function 'CreateWebHook'

The 'CreateWebHook' function connects a MAILINGWORK event to your desired server URL. For this you pass three parameters:

  • app: any name of the webhook for internal use, which you can filter later via 'GetWebHooks'.
  • event: name of the MAILINGWORK event, which you can filter later via 'GetWebHooks', currently the following events are supported:

▸ optin_finalized: login successful
▸ optout_finalized: Logout successful
▸ profilemanager_finalized: change of subscriber data sent via profile manager

  • url: Your server URL that accepts the JSON data

Function 'GetWebHooks'

The 'GetWebHooks' function displays the properties of all created webhooks. Optionally, you can filter on the 'app' and 'event' properties.

Function 'ActivateWebHook'

The 'ActivateWebHook' function activates a WebHook that was automatically deactivated by the system. This is the case after the URL of the WebHook was repeatedly unreachable. Please make sure that the URL is reachable again before activating it.

Provide the optional 'replayEvents=1' parameter if the events accumulated in the first 5 days after deactivation should be sent subsequently. The current activation status of a webhook is returned by 'GetWebHooks' in the 'active' result parameter.

Function 'DeleteWebHookById'

The function 'DeleteWebHookById' deletes a WebHook that is no longer needed or that you want to create again afterwards with changed parameters.

Mishandling if URL is not reachable

If the call of a WebHook fails repeatedly because the stored URL is not accessible, this WebHook is automatically deactivated by the system. At the same time, a system notification is triggered, which you can use to reactivate the WebHook by clicking on it. Please make sure that the URL is reachable again before activating it.

In the first 5 days after deactivation, the system stores incoming events in a buffer. When activating, you can decide whether these events should be caught up.

Tags: