Custom Webhook for Trello

This section helps you create a custom webhook channel and integrate with Trello. When a configured alert triggers in the channel, a new Trello card is created with information about the escalation.

Prerequisites

  • Review Custom Webhook.

  • Log in to your Trello account with admin rights and do the following:

    1. Obtain your trello apiKey and token.

      For more information, see the REST API Authorization guide.

    2. Create a Trello board on your account and ensure that you create at least one list on it.

    3. Perform the following request in order to obtain the ID of one of the lists existing on the board:

      curl --request GET --url 'https://api.trello.com/1/boards/<boardId>/lists?key=<key>&token=<token>
      

      Where boardId is the ID present on the URL in the browser when accessing the board’s main page, and key and token are the authentication requirements obtained in step 2.

      An example response is given below:

      [{"id":"63c68794fb31c10334ab443b","name":"Escalations","closed":false,"idBoard":"63c68794fb31c10334ab4434","pos":16384,"subscribed":false,"softLimit":null},...]

      Where you can see that the board contains a list named Escalations.

    4. Copy and save the ID for the webhook configuration.

Configuration

With all prerequisites met you can now configure a webhook that uses Trello’s REST API to create a card on a list.

  • URL: Type the following:

    https://api.trello.com/1/cards?idList=<idList>&key=<apiKey>&token=<token>

    This is the REST route for creating a card.

  • Name: Enter Trello Escalation Card.

  • Method: Make sure that you select the POST method.

  • Editor: Type the following content on the editor and define the structure of the card you want to create:

    {
       "name": "Escalation: {{@alert_name}} on {{@event_labels.kube_cluster_name}}",
       "desc": "{{@event_body}}",
       "pos": "top"
    }
    

This snippet creates a card whose name suggests that an escalation for the given alert name just triggered. It also informs you in which cluster the incident occurred by directly accessing the kube_cluster_name variable from within event_labels. Note that in order to reference this variable, the original alert that was fired needs to be grouped or filtered by this variable.

For the description field, provide the standard Sysdig event body, which is similar to the default message produced by an email notification channel.

"pos": "top" indicates that you want this new card to be created on top.

Test the Channel

Experiment with different testing configurations to see how the resulting card appears to the recipient. Save the channel and configure an alert that triggers on it.