Step 2. Create a New Target

Learn how to configure targets for event streaming.

Now you need to set up a webhook target to start receiving events. A target will serve as a destination in a rule that provides you with the data you desire. This can be done by using the Target endpoint.

Request Payload

curl --location 'https://svc.blockdaemon.com/streaming/v2/targets' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '    {
        "description": "Documentation webhook target",
        "max_buffer_count": 100,
        "name": "docs webhook target example",
        "settings": {
            "destination": "http://example.com/webhook",
            "method": "POST",
            "secret": "your secret here"
        },
        "type": "webhook"  
    }'

The request body includes the following parameters:

FieldsRequired/OptionalDetails
descriptionOptionalA description of your target.
max_buffer_countOptionalMaximum number of items allowed in the webhook target's buffer.
nameRequiredThe name of your target. Each resource should have a unique name.
settingsRequiredThe configuration of a webhook target.
destinationRequiredThe destination URL where we can reach this webhook.
methodRequiredThe HTTP method for the webhook (in this case, POST).
secretRequiredA private webhook secret with a minimum string length of 10 characters. This is used as the challenge token for webhook verification process..
typeRequiredThe type of target which currently limited to webhook.

Response Payload

Below is the successful response.

{
    "created_at": "2024-03-06T09:48:06.673414Z",
    "current_buffer_count": 0,
    "description": "Documentation webhook target",
    "id": "8918a2f1-28d6-4e2f-837b-fb49ec09daaf",
    "max_buffer_count": 100,
    "name": "docs webhook target example",
    "settings": {
        "destination": "http://example.com/webhook",
        "method": "POST",
        "secret": "************here"
    },
    "status": "active",
    "type": "webhook",
    "updated_at": "2024-03-06T09:48:06.673414Z"
}

It includes the following details:

FieldsDetails
idUnique identifier for your webhook target, necessary for creating rules. You will need this ID to create a rule.
created_at & updated_atA timestamp for when the target was created and last updated.
max_buffer_countMaximum number of events that will buffer for your target. If your target is slow or temporarily offline, event streaming will buffer messages up to this limit.
destinationURL to send webhook payloads for processing or notification.
statusStatus of your webhook. It must be "connected" before receiving events. Refer to the Webhook Target Reference.

👍

Note:

You can use one webhook target for multiple rules by using its id.

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.