Skip to main content

Managing webhooks

Dilli allows you to fully manage the lifecycle of your webhooks, including enabling, disabling, inspecting, and testing their behavior. This helps in debugging, monitoring integrations, and controlling when webhooks are active.

Pausing a webhook

You can pause a webhook to temporarily stop it from processing incoming requests. πŸ” Use Cases
  • Avoid triggering actions during maintenance.
  • Prevent external integrations from affecting live systems during testing.
  • Disable integrations without deleting configuration.
🚧 Behavior When Paused
  • Incoming requests to a paused webhook return an HTTP 503 Service Unavailable status.
  • No actions are executed.
  • Requests are not queued or retried automatically.
βœ… How to Pause Use the Dilli Admin Panel or API to change the webhook status to paused.

Webhooks inbox

The Inbox is a debugging and logging feature that captures all incoming requests to your webhooks. 🧾 What It Logs
  • Request method, URL, and headers
  • Full request body
  • Timestamps
  • Execution status (success, error, validation failure)
  • Response returned by the webhook
πŸ“ˆ Benefits
  • Debug malformed requests or failing actions
  • Replay past webhook requests for troubleshooting
  • Monitor integration health and behavior over time
πŸ”„ Replay Support You can replay any request captured in the inbox to test changes to your webhook logic or to retry previously failed integrations. πŸ“₯ Viewing the Inbox
  • Available via the Dilli Admin Panel under each webhook
  • API access is also available for programmatic inspection
⚠️ Data Retention By default, inbox logs are stored for 30 days. You can configure custom retention policies depending on your plan or compliance requirements.

Webhooks Automation

Dilli’s webhooks module allows you to create automated flows with input validation, multiple actions (such as HTTP calls), conditional redirection, and custom response. It is highly configurable and designed for integration with external APIs such as shipping careers services, payments, automations, and more.

General Webhook Structure

vars:
  some_variable: ""
validation:
  fields:
    field: "rules"
actions:
  - name: "Action Name"
    type: "action_type"
    ...
redirect:
  to: "Redirect URL"
response:
  status: HTTP Status Code
  headers:
    Key: "Value"
  body:
    data: "response"

Validation

Defines the expected input fields in the request (request) and applies validation rules before executing the actions. Example:
validation:
  fields:
    name: "required|string|max:255"
    email: "required|email"
    age: "nullable|integer|min:18"

Variables

Stores temporary variables during execution. These can be referenced later using {{ vars.variable_name }}.
vars:
  access_token: ""
  destination_city_code: ""

Actions

A list of actions that are executed sequentially. Currently supports http_request for making external API calls.

Common Fields in an http_request Action:

  • name: Descriptive name of the action.
  • type: Type of action. Supported: http_request.
  • method: HTTP method (GET, POST, etc.).
  • url: External API endpoint.
  • headers: HTTP headers.
  • data: Request body or query params.
  • set: Maps values from the response to variables.
Example of Chained Actions:
actions:
  - name: "Get Auth Token"
    type: "http_request"
    method: "POST"
    url: "https://api.example.com/token"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    data:
      auth_type: "DEV"
      grant_type: "password"
      username: "dummy_user"
      password: "dummy_pass"
    set:
      access_token: output.access_token

  - name: "Fetch Destination City Code"
    type: "http_request"
    method: "GET"
    url: "https://api.example.com/cities"
    headers:
      Authorization: "Bearer {{ vars.access_token }}"
    data:
      zipCode: "{{ request.destination.postal_code }}"
    set:
      destination_city_code: output.city_id

  - name: "Generate Shipping Quote"
    type: "http_request"
    method: "POST"
    url: "https://api.example.com/shipping"
    headers:
      Authorization: "Bearer {{ vars.access_token }}"
      Content-Type: "application/json"
    data:
      OriginZipCode: "{{ request.origin.postal_code }}"
      OriginCityId: 1234
      DestinationZipCode: "{{ request.destination.postal_code }}"
      DestinationCityId: "{{ vars.destination_city_code }}"
      TotalWeight: 10.0
      InvoiceValue: 999.99
      ReceiverCpfcnpj: "00000000000000"
      ContactName: "Contact Name"
      ContactPhoneNumber: "123456789"
      Packs:
        - AmountPackages: 1
    set:
      carrier_name: "Example Carrier"
      carrier_code: "EXPRESS"
      price: output.total_price
      currency: "BRL"
      type: "ship"
      min_delivery_date: "2025-01-01T00:00:00-0300"
      max_delivery_date: "2025-01-05T00:00:00-0300"
      phone_required: true
      reference: "dummy_ref"

Redirection

If defined, the flow will redirect the request to a specific URL after all actions are executed.
redirect:
  to: "https://example.com/success"

Response

Defines the structure of the webhook’s response, including HTTP status, headers, and body.
response:
  status: 200
  headers:
    Content-Type: "application/json"
    X-Powered-By: "Dilli Studio"
  body:
    rates:
      - name: "{{ vars.carrier_name }}"
        code: "{{ vars.carrier_code }}"
        price: "{{ vars.price }}"
        currency: "{{ vars.currency }}"
        type: "{{ vars.type }}"
        min_delivery_date: "{{ vars.min_delivery_date }}"
        max_delivery_date: "{{ vars.max_delivery_date }}"
        phone_required: true
        reference: "{{ vars.reference }}"