Skip to main content
MX provides webhooks that send HTTPS POST callback requests to the URL of your choice. This enables you to subscribe to certain events, receive notifications when those events occur, and have information related to events delivered to you. If you are subscribed to multiple events, a different URL can be configured for each event.

Available Webhooks

MX offers a variety of webhooks, listed in the table below. Some of these are readily available to you based on your integration type, and some are available only upon request. To view the webhooks that are readily available to you, log into your Client Dashboard and navigate to Developers in the left pane, then select Webhooks. If you want to use a webhook that doesn’t appear in your dashboard, you can request it.

Requesting Webhooks

If you want to use a webhook that doesn’t appear in your Client Dashboard, submit a request to MX Support with the following information:
  • The name of the webhook you wish to use.
  • The use case(s) for how and why you’re using the specific webhook.
  • Your client ID and the environment type (integration or production) in which the webhook will be installed.
  • The target URL.
  • If you choose to enhance your security, include the requested information for your respective security type as outlined in Security. (For example, the username and password for HTTP basic authorization.)
After your request is fulfilled, the webhook appears in your dashboard.

Managing Requested Webhooks

Webhooks that you request will appear in your Client Dashboard once approved, but you won’t be able to actively manage them from the dashboard. To perform a management action of editing, testing, or deleting these webhooks, submit a request to MX Support with the following information:
  • The name of the webhook you want to manage.
  • The management action (edit, test, or delete).
  • For edit requests, include details about the edit you’re making. (For example, an updated callback URL.)
Note that deleting a webhook is a permanent action that can’t be undone.

Features

MX webhooks have the following features:
  • They’re delivered via RESTful HTTPS requests to your listening service.
  • They’re triggered when a qualifying event occurs in the MX system.
  • They can make requests to any specified URL. (Configuration for this is done offline and out of band.)
  • Each POST request includes a JSON-formatted payload.
  • The frequency of request retries diminishes over time.

Best Practices

  • Don’t rely on webhooks as triggers in your UX: Use a postMessage or API request to determine the state of the MX system instead of relying on the receipt of a webhook. If a webhook is being used as a trigger in your UX flow, we recommend putting in a failsafe timer and reading the status from our API as a backup mechanism if a webhook doesn’t arrive in a timely manner. This ensures the end user isn’t left waiting while the UI is waiting for a message that’s sitting in a queue trying to be delivered.
  • Respond to webhook requests immediately: It’s crucial to respond promptly to webhook requests, whether with a success or error code, to prevent resource tie-ups for both your system and MX.
  • Send a 204 No Content response upon successful receipt of a webhook: This avoids unnecessary resource consumption, crucial for preventing delays in payload processing on both systems.
  • Only issue error codes when the webhook wasn’t successfully received: MX payloads may contain null values or include unexpected new fields. If your systems encounter difficulty parsing such situations, issuing an error code won’t resolve the problem as MX will resend the same unexpected payload, resulting in the same error. If your system returns a 429 Too Many Requests error, MX will automatically re-queue the webhook for later delivery. If you have rate limiting implemented, we recommend returning this error instead of a 500-level error.
  • Design your webhook payload processing to be resilient to changes: While existing fields won’t be removed, new fields may be added, and the order of fields isn’t guaranteed.
  • Put every webhook you receive into an internal queue for processing: This helps you process requests as quickly as your system allows and lets you have your own error retry queue for internal errors. Any webhooks that your system can’t process should be placed in a separate list for examination, where you can log and resolve any errors.
  • Ensure proper handling of duplicate webhooks: If you receive a duplicate webhook for a single event, log every event you process and don’t process any event that has already been logged. This practice helps prevent future occurrences of duplicate events.
  • Compare revision fields: Object-based webhooks, such as the Members webhook, contain a revision field. The revision number is incremented each time the object is updated on the MX platform. If you’re using object-based webhooks, you can compare the revision field of the payload you just received with that of the object you have previously stored in your database to determine if the payload just received is the most recent one.

Changes to Expected Payloads

MX will not remove fields from a webhook payload without notification. However, new fields may be added to a webhook payload at any time. Many fields can also return a null value. You should account for this when handling the webhook payload.

Date and Time Formats

Date and time fields are supported in either Unix epoch time or ISO 8601 format.
  • Fields ending in _at are in Unix epoch time. For example, 1504224000.
  • Fields ending in _on are in ISO 8601 format. For example, 2017-09-01.

Error Handling

MX checks the status code you send in your response and takes appropriate action based on that. MX will retry a webhook for all status codes outside of the successful 200 range listed above. This could be a connection timeout, write timeout, read timeout, DNS error, etc. Because of this, it’s important that you respond to each webhook request as soon as possible, whether with a success code or an error code. Delays tie up resources for both you and MX. Retries always contain a payload identical to the initial request. This means it’s very important that you only send error codes in situations where retrying the webhook will be beneficial, and not in cases where sending the same payload will result in the same error. In cases where the same error will occur, you should return a success status code to MX and put the request into their own internal retry queue, or log the error internally for investigation. In other words, error codes should only be returned when the webhook was not successfully received. For example, MX payloads may contain null values, and may include new fields you don’t expect. If your systems can’t parse these situations, sending an error code will not help because MX will respond by sending the exact same unexpected payload, resulting in the same error. The most common error codes are within the 500 range (something went wrong on the receiving end) that prevent you from receiving the webhook. A 400-level error should only be returned in cases where a payload is truly invalid, such as if it contains invalid JSON, but not in situations where you can’t process the payload for some internal reason. Successful Status Codes
  • 200 OK
  • 201 CREATED
  • 202 ACCEPTED
  • 203 NON_AUTHORITATIVE_INFORMATION
  • 204 NO_CONTENT
  • 205 RESET_CONTENT
  • 206 PARTIAL_CONTENT

Duplicate Webhooks

If you receive a duplicate webhook for a single event, log every event you process and don’t process any event that has already been logged to avoid this in the future. For true duplicate events that you don’t want to process on your end because they’ve already been logged, you must still send a success code to us. Otherwise, we’ll continue to retry sending the duplicate event. If this does not solve duplicate events, you may be handling errors incorrectly.

Fields Ending in _set_by

Fields ending in _set_by indicate the source of the data for the associated field. Possible values are as follows.

Retries

MX webhooks will automatically retry a request in the case of a failed delivery such as a connection timeout, write timeout, read timeout, DNS error, etc. Retry attempts will contain the same payload as the original request. Retry attempts follow a pattern of incrementally decreasing in frequency with each attempt. You can expect to see a number of retries within the first hour of the initial attempt, and then gradually these retry attempts will become less and less frequent. Our last retry will occur in 12 to 15 hours. If the webhook cannot be successfully delivered after this time, it will not be delivered. The timing of retry attempts has an element of randomness to avoid having a flood of retry requests be sent to your system all at once.

Security

All webhook requests are encrypted by default. However, MX recommends using an additional layer of security as well. One or more of the following are typical.

HTTP Basic Authorization

To use HTTP basic authorization, choose this security setting in your Client Dashboard and enter the username and password. If you’re requesting a webhook and want to use this security type for it, include the username and password in your webhook request.

Mutual Certificate Authentication

Mutual authentication is supported. You’re responsible for providing the certificate and key. To use mutual certificate authentication, choose this security setting in your Client Dashboard and enter the certificate and its private key in PEM format. If you’re requesting a webhook and want to use this security type for it, MX will create a Certificate Signing Request (CSR) that you can use to purchase a certificate from your provider. The CSR will contain the private key and certificate information. Include the following information in your webhook request so MX can generate the CSR and send it to you:
  • Common name
  • Organization
  • Department
  • City
  • State/Province
  • Country
  • Key size (MX uses the recommended size of RSA-2048)
Once you receive the CSR, use it to purchase a certificate. The certificate must be in PEM format and meet the following criteria:
  • It will not expire within 6 months.
  • It has been properly installed in your or your data partner’s system and validated by the respective party as behaving correctly.
  • If required, it has the correct associated intermediate or trunk and root certificates that are current and will not expire within 6 months.
Send the certificate securely to MX along with the name of the Trusted Certificate Authority. This ensures you can authenticate requests originating from MX. When using mutual authentication, you need to periodically update the certificate before it expires. To ensure continued access to your webhook, provide replacement certificates to MX via MX Support at least 30 days prior to the certificate’s expiration.

OAuth 2 Access Token Authentication (Client Credentials)

To use OAuth2 access token authentication, choose this security setting in your Client Dashboard and enter the connection information. If you’re requesting a webhook and want to use this security type for it, include the connection information in your webhook request. Provide MX with an ID and secret to be used for basic authorization. MX will use these to make a request to your token endpoint URL to generate a new access token using the client_credentials grant type. This token will be used to make requests to your webhook URL until the token expires, at which time MX will request a new token. MX can configure our token requests to send the grant type in either the body or the query string. Grant Type In Query String
Grant Type In Body

Webhook Timing

We attempt to deliver webhooks in near real time, but can’t guarantee they’ll always arrive in a timely manner or in the order in which the events occurred. The delivery of a particular event might be delayed due to server-related issues, connection issues, and so on. It’s possible to receive an earlier payload of a webhook after receiving a more recent payload for the same webhook if the delivery of the earlier webhook was delayed. This is especially true when a delivery issue causes it to go into our retry queue. You should account for the possibility of receiving webhooks out of order.