Skip to content

Martini Generating Services when Consuming Webhooks

Webhooks are a system of automated notifications indicating that an event occurred on the server, sending a live HTTP request to a specified URL. In Martini, you can configure a service to act as a webhook listener to react to these events.

Steps to Configure a Webhook Listener

  1. Open the Webhook Configuration Interface

    • In the Martini interface, find the workflow where you would like to include the webhook listener.
    • Add a new webhook listener component to your workflow.
  2. Select HTTP Methods

    • In the webhook settings, select the HTTP methods that your webhook should accept. For most webhook configurations, you'll select POST because webhooks typically send data via HTTP POST requests.
  3. Set the URL Path

    • Specify the URL path that the webhook will listen to. For instance, setting it to /event/attendee means that Martini will listen for webhook POST requests at this path.
  4. Configure Body Parameters

    • If the webhook expects data to be passed in the body of the request, define the body parameters here. You can set the expected schema or data model that your Martini service will process.
  5. Implement Business Logic

    • Once the webhook listener receives data, implement the business logic that should be executed in response to the webhook event. This might involve parsing the data, performing some action in your system, or triggering other services and workflows.
  6. Deploy and Test

    • Deploy your webhook listener by making it accessible via a public URL. You may need to use a service like ngrok during development to expose your local development environment to the internet.
    • Register the public URL with the webhook provider so that it sends events to your Martini service.
    • Test the webhook to ensure that it correctly receives data and that your business logic executes as expected.

Security Considerations

  • Validate Incoming Requests: Ensure that the incoming requests are from a trusted source. If the provider includes a signature or token, validate this in your webhook listener.
  • HTTPS: Use HTTPS for the webhook URL to secure the data transmission.
  • Error Handling: Implement robust error handling to manage any issues that may occur when the webhook is triggered.