Reading:
Webhooks

Webhooks

Matt Fellows
Updated

One of the most powerful features of Pactflow is the ability to integrate into your teams' workflow, and orchestrate build, test and deployment pipelines when things change. Webhooks are one of the key ingredients when creating these workflows.

What are webhooks?

A Webhook (also called a web callback or HTTP push API) is a way for an application to provide other applications with real-time information, or perform some action. A webhook delivers data to other applications in response to a particular event.

In Pactflow, the primary use case for webhooks is triggering a provider build to verify a new or modified pact file. Previously, however, you could only create webhooks via our API, and many customers found this a challenge due to the complexity in configuring and testing them.

Webhooks Management

Today, we are releasing the ability to configure these webhooks through our Settings screen in the Pactflow UI, to simplify the management and make them more accessible to our users.

Creating a Webhook

You can find the Webhook screen by navigating to the Settings screen (the little cog icon) in the top right-hard corner, and choosing "Webhooks" from the menu.

To create an example webhook that hits the Postman echo service (a nifty service for HTTP request demonstration purposes), choose "Add Webhook" and configure it with the following settings:

  • Description: Give your webhook a memorable description
  • Choose a consumer and provider, or select "ALL" to trigger the event for any consumer/provider
  • Events: "Contract published with changed content or tags"
  • URL: https://postman-echo.com/post
  • Headers: Content-Type: application/json
  • Body:
{
  "message": "Triggered by changed pact for ${pactbroker.consumerName} version ${pactbroker.consumerVersionNumber} and ${pactbroker.providerName}",
  "pactUrl": "${pactbroker.pactUrl}"
}

Example webhook configuration

The request body accepts a number of variables, which are useful if you need to make your call dynamic, for example, to include the URL of the pact that has changed.

Testing

Once your webhook is ready, simply click the "Test" button to trigger an example request and review its output. Here you can see our webhook request succeeded and the HTTP request/response:

It's as easy that!

Available Now

Webhooks are available now and you can start using them today. Here are some examples taken from the webhook template library that may help you get started:

  • Trigger a provider build on your CI (such as Travis or Bamboo)
  • Publish your commit status to GitHub (to get those lovely green ticks on your Pull Requests)
  • Publish to Slack to notify teams of a modified contract

Read the documentation to learn more.

Got feedback for us? We'd love to hear from you. Simply drop us a line at hello@pactflow.io or follow us on Twitter

Integrate Deeper with our Developer API 🧿
22 November 2023

Integrate Deeper with our Developer API 🧿

Announcing the launch of PactFlow’s Developer API.

3 min read

Unveiling of the SwaggerHub + PactFlow Integration
17 January 2023

Unveiling of the SwaggerHub + PactFlow Integration

API designers and developers can harness the power the contract testing at scale to deploy with confidence, knowing updates to their API specification will not result in a breaking change.

2 min read

arrow-up icon