BitlyDeveloper
Navigation

Create a Webhook

Use webhooks to be notified when a link is clicked.

Bitly's webhook endpoints can be configured in the web application or programmatically using webhook endpoints.

Configuring webhooks from the web app provides a user interface for configuring webhook endpoints.

Authentication

Bitly supports API Key & HTTP Basic Auth for posting the webhook. You'll need to post the query parameter as part of the callback URL.

Example API Key:

https://yourapp.domain/webhook?key=abc123

Example basic auth:

https://user:password@customer.domain/webhook

Response format

Bitly sends webhook responses, formatted in JSON, over HTTP as HTTPS POST requests. We'll send the payload to the URL that you enter into your account settings in Bitly.

The payload

A Bitly webhook payload will include the following information with each click event:

  • Event ID which unique identifies a single click
  • Data and time of click
  • Long URL
  • Parameters passed through from long URL (if available with your subscription)
  • bitlinkID (short link and associated data)
  • Country where the link was clicked
  • Referrer
  • Device type
  • Account and Group ID related to this link
  • Webhook ID that an event is related to

Here's an example:

{
    "event_id": "42f14eec-d1dc-11ea-8bbb-080027c1cea9",
    "datetime":"2019-12-20T07:54:54+0000",
    "url":"https://long.url.net/wiki/spaces/longer/data/665092146/",
    "bitlink":"write4plebs.com/pendorama",
    "passed_params":"",
    "country":"US",
    "referrer": "direct",0
    "device_type": "Desktop",
    "webhook_guid": "W0123456789",
    "organization_guid": "O1234567890",
    "group_guid": "B0123456789",
    "references": {
        "bitlink": "https://api-ssl.bitly.com/v4/bitlinks/write4plebs.com/pendorama",
        "group": "https://api-ssl.bitly.com/v4/groups/B0123456789",
        "organization": "https://api-ssl.bitly.com/v4/organizations/O1234567890",
        "webhook": "https://api-ssl.bitly.com/v4/webhooks/W0123456789"
    }
}

Webhook errors

Bitly will make multiple attempts to send a payload if the first attempt fails. After failing multiple times, the webhook will be automatically deactivated and an email will be sent to all your account administrators notifying you that there's a problem.