Add an Event

Use our API to add an event to a webhook.

This guide shows you how to add an event to a webhook, causing the webhook to alert your URL when the event has occurred. Refer to the Webhook Events table in Webhooks Conventions for a list of available events. See Add an Event in API Reference for field definitions.


Prerequisites

  1. See Create a Sandbox Account to sign up and log in to the Maast Manager portal.
  2. Follow the steps in Get Your API Credentials to save a sandbox ID and API key.
  3. See Authentication to format the credentials and generate your API token. (Alternatively, use the credentials as-is to test this endpoint with our 'Try It!' feature.)
  4. Set up a webhook endpoint (notification_url) on your server to listen to POST requests. See Webhooks: Configure Your Server for more information.
  5. Use the Add a Webhook guide to create a webhook and save the webhook_id.

Implement

Write a POST request. For the request endpoint, include the following:

  • webhook_id - Find this value in the Add Webhook request response.
  • event - Find this in the "Event" column of the Webhook Events table in Webhook Conventions.

In the endpoint, insert the webhook_id value after /webhook/ and the event value after /event/. The resulting endpoint reads /platform/webhook/{webhook_id}/event/{event}.

See the sample code below, where 123 is the webhook_id value and transactions_status_updated is the event value. Your configured request will resemble this sample code:

curl --request POST \
     --url https://api-test.maast.com/platform/webhook/123/event/transaction_status_updated \
     --header 'accept: application/json' \
     --header 'authorization: Basic OjllZGVjMjFhMzFjMHh5ejc4OWUzMGEzNDE2YWJjMTIz' \
     --header 'content-type: application/json'

Integrate

Send your request. You will receive a response like this from the Maast server:

{
  "code": 0,
  "data": {
    "message": "Event transaction_status_updated added"
  },
  "message": "Success"
}

Check the code field in the request response: 0 confirms that you have successfully added an event to the specified webhook. If the value is something other than 0, check Platform API Response Codes in Reference.

See Add an Event in API Reference for response field definitions.


Test and Go Live

See our Test and Go Live guide to test your API integration and to start transacting with an active production account.

🚧

Validate in Production

When moving to production, you must redo the validation process for your webhooks configuration.