Setting Up Web Alerts (Webhooks)
Use this guide’s step-by-step instructions for setting up web alerts the Portal.
What is a web alert?
A web alert (also known as a “webhook”) is a notification sent from the API to your server that triggers when a set event occurs in your portfolio.
Example:
A new Merchant is onboarded to your portfolio.
The boarding status will by default be set to Not Ready, and a web alert can be created to notify your server when the boarding status changes to (Successfully) Boarded and the Merchant is approved to begin processing payments.
If you’re already familiar with our web alerts setup, click here to skip to the Alert Resources table.
How to create a web alert in the API
Web alerts are created by making the following request to our API: POST /alerts
Individual request bodies must be sent via this request to initially setup each web alerts alert. These POST /alerts
requests are separated into three parts:
alerts - The overall alert containing the alertTriggers and alertActions information.
{ "division":"<the alert's associated division ID>", "alertTriggers":[{"<below>"}], "alertActions":[{"<below>"}], }
alertTriggers - The specific event that initiates the Alert’s configured action.
"alertTriggers":[{ "event":"<alert resource>", "resource":"<alert resource #>" }],
alertActions - The notification method, delivery format, and destination for the alert.
"alertActions":[{ "type":"<delivery method>", "options":"<code language format of alert>", "value":"<https://webdestination.com>" }],
Remember to validate your Alert Resource and Events
Be sure to verify all web alert configurations against the Alert Resources and Event Triggers table below to validate that the setup can accurately. The server will accept most configuration requests without error, but won’t produce the expected result if the resource doesn’t match it’s corresponding events.
See each section below to learn how to setup each individual component.
Part 1: alerts
alerts determines which users the web alerts will apply to. Thus, if you are creating a web alerts to notify your server of a boarding status change for any new Merchant you boarded to Payrix, including your Division ID would apply the web alerts to all the users within your portfolio. You can limit which users a web alerts applies to by entering their individual Login ID or by using an Org ID to apply the web alerts only to users included within a Group.
POST /alerts - "New Alert" Request
POST /alerts - "New Alert" Parameters
Part 2: alertTriggers
alertTriggers determines which resource and event will trigger a web alerts. In the case of a web alerts that notifies your server when a new Merchant's boarding status updates to (Successfully) Boarded the API resource is merchant
(resource 9) and the event is merchant.boarded
. You can see a more comprehensive guide to the resources and events code references in the expandable content below.
POST /alerts - "New alertTriggers” Request
POST /alerts - "New alertTriggers” Parameters
You can also create multiple alertTriggers within the same web alerts.
For example, if you want your server to be notified when a new Merchant's boarding status updates to (Successfully) Boarded and when a new Merchant's boarding status updates to Denied, you can add a second alertTrigger from the merchants resource (resource 9) with merchant.denied as the trigger event.
See the example using the same parameters as above in the expandable content below:
POST /alerts - "Multiple New alertTriggers" Request Body
Alert Resources and Event Triggers
Part 3: alertActions
alertActions represents a particular instance of an Alert that is sent out through one particular channel, for example, SMS, mobile application notification, or email. Each alertAction is associated with an Alert resource.
POST /alerts - "New alertAction" Request
POST /alerts - "New alertAction" Request Parameters
Final Result
Following all the steps above, the next time a merchant is boarded successfully under your merchant, you’ll have a web alerts setup to push to your webhook.site profile. Your full GET /alerts
request body should look like this when fully configured and setup complete: