Your webhook

In order to receive the notifications, you need to implement a web service that can receive an array of JSON documents with 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. 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
In order to start receiving notifications, send a POST request to https://app.bugfender.com/api/hook/subscribe/.
The request needs Basic authentication with your username and password.
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  (string): the constant new_issue 
  • 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: Basic ******' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
    "target_url": "https://myservice.example.com/hook",
    "event": "new_issue",
    "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 (string): the event you subscribed to
  • target_url (string): the URL you indicated for webhook
  • app_id (string): the app ID you specified

For example:

{
    "id": 21,
    "event": "new_issue",
    "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://app.bugfender.com/api/hook/{hook_id}/. Replace {hook_id} with the identifier you got in the subscription process.
The request needs Basic authentication, just like the subscription one.
For example:

curl -X DELETE \
  https://dashboard.bugfender.com/api/hook/21/ \
  -H 'authorization: Basic *****' \
  -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?