Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding out existing Webhooks IDs on Trello

I've added webhooks using Trello's API (Node JS package). How do I get the current webhooks or how do I get an existing webhook ID?

Could'nt find a way through the API: https://developers.trello.com/advanced-reference/webhook

Here it says that:

There are three ways to delete webhooks.

  1. Using the DELETE route on webhooks DELETE https://api.trello.com/1/webhooks/[WEBHOOK_ID]?key=[APPLICATION_KEY]&token=[USER_TOKEN]
  2. If the webhook request from Trello, when POSTing to the callbackURL, receives an HTTP 410 Gone response, the webhook will be deleted.
  3. If the token that the webhook is bound to is revoked or expires, then the webhook will be deleted

First method required the ID, second method requires me to take down the server everytime I want to erase a webhook and third is not better. Any idea how to get the IDs?

like image 519
Guy Avatar asked Dec 19 '22 16:12

Guy


2 Answers

Here is the API request to get all of the webhooks that have been created by the application:

GET https://api.trello.com/1/members/me/tokens?webhooks=true&key=[APPLICATION_KEY]&token=[USER_TOKEN]

Relevant Section of the Trello API Documentation /1/members/[id]/tokens listed below:

GET /1/members/[idMember or username]/tokenslink Required permissions: read, own, account

Arguments

  • filter (optional)
    • Default: all
    • Valid Values: One of: all, none
  • webhooks (optional)
    • Default: false
    • Valid Values: One of: true, false

Also, note that me is used as the idMember or Username

Note: If you specify me as the username, this call will respond as if you had supplied the username associated with the supplied token

See Trello API documentation /1/members/me

Here is a sample JSON response I get:

{
"id": "568d40cc3aa021f1b3602ea0",
"identifier": "Server Token",
"idMember": "562d50bc3aa020f1b3602ec0",
"dateCreated": "2016-05-30T22:01:15.721Z",
"dateExpires": null,
"permissions": [
  {
    "idModel": "562d50bc3aa071f1b3602ec6",
    "modelType": "Member",
    "read": true,
    "write": true
  },
  {
    "idModel": "*",
    "modelType": "Board",
    "read": true,
    "write": true
  },
  {
    "idModel": "*",
    "modelType": "Organization",
    "read": true,
    "write": true
  }
],
"webhooks": [
  {
    "id": "5675a0a8159fbeef4b796da3",
    "description": "Feature Requests Board",
    "idModel": "55a1176a0b620663da985753",
    "callbackURL": "http://example.com/trello/webhook-callback?type=features",
    "active": true
  },
  {
    "id": "5673a0ac6ab60af7ec3a706b",
    "description": "Bugs Board",
    "idModel": "541ebcf34c03910922ff0fc3",
    "callbackURL": "http://example.com/trello/webhook-callback?type=bugs",
    "active": true
  }
}
like image 58
Benjamin Root Avatar answered Dec 27 '22 17:12

Benjamin Root


You can see a list of webhooks by using the token resource.

See here: https://developers.trello.com/advanced-reference/token#get-1-tokens-token-webhooks

GET /1/tokens/[token]/webhooks

[token] equals [USER_TOKEN] if you created the webhook with the same token.

like image 29
Casey Benko Avatar answered Dec 27 '22 19:12

Casey Benko