8.3.3 Configuring custom webhooks

Custom webhooks in Telebugs allow you to integrate with any external service that accepts HTTP POST requests. This flexibility enables you to send error notifications to various platforms, such as custom logging systems, incident management tools, or any other service that can process JSON payloads. By using custom webhooks, you can tailor the notification format and content to meet your specific requirements.

To configure a custom webhook, follow these steps:

  1. In Telebugs, navigate to Notification Configuration and select Webhooks from the sidebar.
  2. Click Create Configuration to add a new webhook.
  3. In the Add a new webhook form, select Custom as the template type from the dropdown.
  4. Enter the URL of your custom endpoint in the Webhook URL field. This URL must be publicly accessible and capable of handling POST requests.
  5. Optionally, provide a name for the webhook in the Name field to identify it later (e.g., "Custom Logging System").
  6. Manually define the JSON payload in the Template body field. Use placeholders like {{key}} to insert dynamic values from the error report. Refer to the Webhook template body placeholders section for a list of available keys.
  7. Save the configuration by clicking Save webhook.
  8. Test the webhook by clicking the Test button next to it in the Configured webhooks section to ensure it sends the payload correctly to your custom endpoint.

Example custom payload

Below is an example of a custom JSON payload that you can use as a starting point:

{
  "project_name": "{{project_name}}",
  "trigger": "{{trigger}}",
  "subject": "{{subject}}",
  "culprit": "{{culprit}}",
  "location": "{{location}}",
  "error_type": "{{error_type}}",
  "error_message": "{{error_message}}",
  "view_url": "{{view_url}}"
}

This payload includes key details about the error, such as the project name, trigger event, error type, and a link to the error report. You can customize this structure by adding or removing fields, modifying the keys, or formatting the data to suit your service’s requirements. For instance, you might add a timestamp or reformat the message for better readability.

Note: Ensure that your custom endpoint is configured to accept POST requests and can process the JSON payload correctly. After saving the webhook, use the Test button to verify that the notification is sent and received as expected. This step is crucial to confirm the integration works before relying on it for real error notifications.