Your webhook

In order to receive the notifications, you need to implement a web service that can receive an array of JSON documents in the following format:

  • id  (integer): ID of the issue

  • title (string): title of the issue

  • text (string): body of the issue. markdown format.

  • app (object): contains several fields, you might need name (string), the name of the application; and key (string), the app key

  • status (int): status of the issue. It will always be 0 (new), because the issue was just created

  • session (object): information about the server, most probably you don't need those

  • session_id (integer): ID of the session where this issue happened

Subscribing to notifications with the Dashboard

You can add a webhook to your application in the app Settings tab:

Subscribing to notifications with the API
In order to start receiving notifications, send a POST request to https://dashboard.bugfender.com/api/hook/subscribe/.
The request needs OAuth 2 authentication.
In the request you should include a JSON object with the following fields:

  • target_url  (string): the URL of the service you created to receive notifications

  • event  (enum): one of: new_crash, new_issue_separate, new_user_feedback

  • app_id (integer): the application ID. You can get this ID by looking at the last number in the URL when you visit the application in Bugfender

For example:

curl -X POST \
  https://dashboard.bugfender.com/api/hook/subscribe \
  -H 'authorization: Bearer ******' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
    "target_url": "https://myservice.example.com/hook",
    "event": "new_crash",
    "app_id": 1234
}'

Expect a 201 Created  HTTP response, with the following JSON document format:

  • id  (integer): the identifier of your webhook. Save this number in order to be able to unsubscribe

  • event (enum): the event you subscribed to

  • target_url (string): the URL you indicated for the webhook

  • app_id (string): the app ID you specified

For example:

{
    "id": 21,
    "event": "new_crash",
    "target_url": "https://myservice.example.com/hook",
    "app_id": 1234
}

The following errors can also occur:

  • 400 Bad Request: the request wasn't understood

  • 401 Unauthorized: no username/password supplied

  • 403 Forbidden: the username/password specified are not valid or permission denied (double-check the app_id )

Unsubscribing from notifications
In order to unsubscribe, you need to send a DELETE request to https://dashboard.bugfender.com/api/hook/{hook_id}/. Replace {hook_id} with the identifier you got in the subscription process.
The request needs OAuth 2 authentication, just like the subscription one.
For example:

curl -X DELETE \
  https://dashboard.bugfender.com/api/hook/21/ \
  -H 'authorization: Bearer *****' \
  -H 'content-type: application/json'

If all went well, expect a 200 OK response.

The following errors can also occur:

  • 401 Unauthorized: no username/password supplied

  • 403 Forbidden: the username/password specified are not valid or permission denied

  • 404 Not Found: the hook is not there (maybe you already deleted it?)

Did this answer your question?