Webhook Logs

Learn how to use the Unified API's Wehbook logs feature to debug workflow issues

Overview

In this tutorial, we'll take a look at how webhook logs work in Unified API.

How it Works

Each time you receive a webhook event, Alloy Unified API saves a copy of that event to the webhook log. You can query this log to easily debug issues.

To query for logs, call the GET /webhooks/logs endpoint as seen below. You can also filter based on topic by passing topic in the query string parameters.

Sample Request

curl --location 'https://embedded.runalloy.com/2023-12/one/webhooks/logs' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Accept: application/json'

This endpoint returns a response as seen below:

Sample Response

{
    "logs": [
        {
            "subscriptionId": "65968bf832ffc6a0c716b888",
            "topic": "connection/deleted",
            "address": "https://123-456-789.ngrok-free.app/api/log",
            "attempts": [
                {
                    "requestHeaders": {
                        "Content-Type": "application/json",
                        "X-Alloy-Topic": "connection/deleted",
                        "X-Alloy-Signature": "wdklqmdqwf3yojfu4g3weud9iedm23oiiqquioiwopekm3dui23h"
                    },
                    "responseStatusCode": 200,
                    "attemptAt": "2024-01-04T10:49:30.230Z"
                }
            ],
            "logId": "65a0a473e07b4efe06b60f66"
        },
        {
            "subscriptionId": "65968c1832ffc6a0c716b88e",
            "topic": "connection/deleted",
            "address": "https://123-456-789.ngrok-free.app/api/log",
            "attempts": [
                {
                    "requestHeaders": {
                        "Content-Type": "application/json",
                        "X-Alloy-Topic": "connection/deleted",
                        "X-Alloy-Signature": "19j32uih7dgd7648h984893fh783qwheihweojr23j23dihadud"
                    },
                    "responseStatusCode": 200,
                    "attemptAt": "2024-01-04T10:49:31.441Z"
                }
            ],
            "logId": "65a0a46fadf0201aaa955576"
        },
        {
            "subscriptionId": "65a0a47d0a541aebb17e0973",
            "topic": "connection/created",
            "address": "https://324-345-8273.ngrok-free.app/api/log",
            "attempts": [
                {
                    "requestHeaders": {
                        "Content-Type": "application/json",
                        "X-Alloy-Topic": "connection/created",
                        "X-Alloy-Signature": "dmoi2j23uh3hghiosjmiuhw7219w9ikop21i1wyt73yi4jueo"
                    },
                    "responseStatusCode": 200,
                    "attemptAt": "2024-01-04T10:50:01.401Z"
                }
            ],
            "logId": "65a0a46910014adfacb397c7"
        }
    ]
}

Wrapping Up

In this tutorial, we took a look at how to call Alloy Unified API's webhook logs endpoint to retrieve webhook log data.