We are excited to announce support for webhooks which allow you to capture real-time data/requests coming from Mautive to use in other applications.
Overview
Webhooks differ from our standard API in that they are event-driven, meaning they automatically run behind the scenes whenever a particular event happens in the system (such as a campaign sending, or a subscriber’s details being updated), whereas our standard API requires that you initiate the requests to receive data.
Webhooks allow a much more fluid exchange of data between applications because they reduce the need for applications to poll for new data on a routine basis, which can be a waste of system resources. With webhooks, your applications can listen for new requests to come across, and only perform actions when a request arrives.
Here is an overview of all available webhook types for Mautive:
- A new subscription occurs
- An unsubscription occurs
- A subscriber updates their details
- A campaign starts sending
- A campaign is opened
- A subscriber clicks a link from a campaign
- A subscriber forwards a campaign
- A subscriber shares a campaign to Facebook or Twitter
- A new bounce occurs after sending a campaign
When any of the above events happen, you can post the corresponding data to any URL. You can set up multiple URL’s (per event) and even specify how the event was initialized (by a subscriber, by an admin user, by the API, or by a system process).
Please see our Webhooks information page for details on each event/type and what data fields are included.
Real world use-cases
Here are some real-world examples of what you can do with Mautive webhooks:
- Keep subscriber records in sync with an external database or application.
- Capture campaign reactions (opens, link clicks, forwards, shares) to push real-time stats to another system or application.
- Maintain an external unsubscribe or bounce list.
- Know when campaigns start sending so you can track usage.
Managing webhooks
You can add, edit, and delete webhooks by going to the “Integration” tab, then clicking the “Webhooks” link on the right side:
You can also manage webhooks using our API (example).
Capturing webhooks in your code
Below is an example of data being pushed to a URL after a subscriber is added, and how you can read the data using PHP:
<?php // this is a webhook page to capture new subscriptions if ($_SERVER["REQUEST_METHOD"] == "POST") { $webhook_data = $_POST; // basic validation check if (!isset($webhook_data["subscriber"]["id"])) exit(); $subscriber_id = $webhook_data["subscriber"]["id"]; $subscriber_email = $webhook_data["subscriber"]["email"]; // ... etc /* $webhook_data looks like: Array ( [type] => subscribe [date_time] => 2013-01-02 09:28:42 [initiated_from] => admin [initiated_by] => admin [list] => 12 [subscriber] => Array ( [id] => 12 [email] => [email protected] [first_name] => Test [last_name] => Test [ip] => 127.0.0.1 [fields] => Array ( [7] => test value [16] => 2013-01-03 [15] => value 1 ) ) ) */ } ?>
Other important information
Here is some other important information regarding Mautive webhooks:
- Webhooks are List-based, meaning they will only fire when an event occurs for the list associated with the webhook.
- We hit your webhook URL(s) within a minute of the event occurring.
- Only data that is available during the request will be included. For example, unsubscriptions may not include the reason right away because that happens after the unsubscription does.
Let us know of any questions, and how you plan to use Mautive webhooks!