Help topics

Send changes to a webhook

A webhook sends changes to your Morphic content to an address you choose, as a JSON request. Your endpoint can use the sequence number and signature to check each request.

Before you start

  • You need an administrator account.
  • You need a public endpoint that accepts POST requests with a JSON body. Morphic rejects an address that is not a public http or https address.

Steps

  1. Go to Settings > Webhooks.
  2. Select Add webhook.
  3. In Address, enter the URL of your endpoint. For example: https://example.com/hooks/morphic
  4. In Signing secret, enter a secret. Leave the field empty to send unsigned requests.
  5. Select Generate to create a random secret.
  6. In Models, select the models to send. If you select none, Morphic sends changes for all models.
  7. In Changes, select the kinds of change to send. If you select none, Morphic sends every change.
  8. Select Save webhooks.

Result

  • Morphic saves the webhook. The status shows Up to date, or N changes waiting when changes are still to be delivered.
  • For each change, Morphic sends an HTTP request with a JSON body that describes it.
  • Each request carries the header X-Morphic-Seq with the sequence number of the change. Changes arrive in sequence order.
  • If you set a secret, each request also carries X-Morphic-Signature: sha256= followed by the HMAC-SHA256 of the raw body, computed with the secret.
  • Delivery runs in the background every minute. Each request times out after 5 seconds.

If the address does not answer 2xx

Morphic stops at the first change that the address does not accept. It shows Delivery paused with the address and the answer. It retries that change every minute until the address answers with any 2xx status. Later changes wait until then, so none are skipped.

Next steps

  • Verify the signature in your endpoint. The Webhooks tab links to the verification examples through How to verify signatures.