How to setup webhooks from external partners with endpoints in Meiro
This document will teach you how to set up webhooks from external partners for event collection in Meiro Events. In this article, we will be using SmartEmailing’s webhook in the examples.
Requirements before starting
- Username and Password/API token from the account in partner’s app/website. These credentials are needed for setup and data collection.
- External partner’s API endpoint URL and documentation
Learn more: about SmartEmailing API v3 reference
3. Meiro Events database to be set up for data storage.
Setting up webhook
Open the command prompt and use curl to set up the webhook.
For each event, enter the following command. This will create a webhook for each event type.
>> curl -X POST <source_url> -u "<username>":"<password/api_token>" -d
|
Example:
>> curl -X POST https://app.smartemailing.cz/api/v3/web-hooks -u "company@meiro.io":"" -d '{"target_url": "https://me.meiro.io/smartemailing?event_name=new_contact",
"event": "new_contact"}'
In <json_data_for_events>
of the above example, we have set our endpoint in Meiro Events and included a param with the event name, the events will be automatically parsed by Meiro events.
Available events that we can use from SmartEmailing: new_contact, delivery_status, updated_contact, unsubscribed_contact, newsletter_sending_started, newsletter_sending_finished, sent_email, scoring_result_changed, meiro_delivered_email, meiro_sent_email, meiro_open, meiro_click
Check webhook set up
To check if the webhook has been set up, you can either check if events are streaming into the database or run an API call to GET the webhooks being set up by entering the following command.
>> curl -X GET <source_url> -u "<username>":
|
Example:
|
Here is an example output. It is important to check that the URL and event match the setup.
|