# Trello

## Create a Card in Trello via Webhook Template

Follow the below steps to configure the “Trello - Create Card” action via webhooks.

You will be utilizing Trello's Rest APIs to create cards.

## Create API Key and Token to Authenticate Trello Rest API

For generating an API key and Token, you first need to have created a Trello Power-Up.

1. Login to <https://trello.com/power-ups/admin> -> **New**
2. Fill all the required fields -> **Create**

<div><figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-8800352be7bceeb7e65e3bef5c1482687f44e3d0%2FScreenshot%202023-06-06%20at%2018.36.48.png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-bde3e0b4f20cf33438b8eb5b71bb86bcd161343c%2FScreenshot%202023-06-06%20at%2018.38.45.png?alt=media" alt=""><figcaption></figcaption></figure></div>

3. Navigate to **API Key** -> **Generate a new API Key -> Copy the API Key**
4. On the same page where you found your API key, click the hyperlinked **Token** at the right of the API key. You will see the following page and **Copy the Token**

<div><figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-8239aa25a86508f5562c5a5a6bdcb8fe2400bf9e%2FScreenshot%202023-06-06%20at%2018.50.55.png?alt=media" alt="" width="512"><figcaption></figcaption></figure> <figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-82e93741810fd17e92d9401a942c56081617efaf%2FScreenshot%202023-06-06%20at%2018.51.07.png?alt=media" alt="" width="489"><figcaption></figcaption></figure></div>

## Get List ID to create Trello Cards

You need to have the ID of the list in which you are going to create cards

Here we have used [<mark style="color:blue;">Postman</mark>](https://www.postman.com/) to generate the List ID

1. Log in to **Trello** and copy your Workspace ID from the browser URL

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-6bfd93e98046fc968f07052d7f91e6a12680729c%2FScreenshot%202023-06-06%20at%2018.56.18.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

2. Paste the below **cURL** in Postman

```
curl --request GET \
  --url 'https://api.trello.com/1/boards/{id}/lists?key=APIKey&token=APIToken' \
  --header 'Accept: application/json'
```

3. Paste the API Key and Token in the Params section and replace {id} with your workspace id in the URL and click on Send to get the Lists
4. Copy the **List ID** in which you would like to create cards

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-bd9e92f6bc20f303bf7a04d99d95bd9e84ca10a3%2FScreenshot%202023-06-06%20at%2019.01.47.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

## Using Webhooks to create Trello cards for Squadcast Incidents

1. Navigate to **Settings** -> **Webhooks**.
2. Click **Add Webhook**. On the next screen, you will be guided through three steps. Navigate between these steps by clicking on any of the steps on the top bar.
3. **Add Webhook Details**:

   1. **Webhook Name**: Enter the webhook name as **Trello - Create Card**.
   2. **Webhook Description** (optional): Enter an optional description. For example - This webhook is for ticket creation in Freshservice for Squadcast Incidents.
   3. **Failure Notification Email** (optional): Enter an email where you want to receive failure notifications. This is particularly helpful when you (or an administrator) want to be notified of webhook-related failures.
   4. **URL**: Copy and paste the below API.

   <https://api.trello.com/1/cards>

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>**:**

Under Additional headers, Content-Type: application/JSON is added by default.
{% endhint %}

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-352c29f8209aa20b0c34b04393aaee7a46479ba7%2FScreenshot%202023-06-06%20at%2019.07.30.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Click **Next: Choose Webhook Type**, and navigate to the next step.

4. **Choose Webhook Type**: Choose Webhook type (Manual or Automatic) and add configurations.
   1. **Manual Webhook**: Manually trigger Webhooks under incidents, on demand. Under Manual Webhook, select the teams that are authorized to access the Webhook. You can select All Teams or enter specific Teams, from the drop-down.

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>**:**

Select this option only if you want to create Trello cards manually on-demand. If you want a card, created automatically when certain conditions are met, please choose Automatic webhooks.
{% endhint %}

2. **Automatic Webhook**: Automatically trigger Webhooks when the configured conditions match. To set up Automatic Webhook Configurations:
   1. **Versions**: Select **v2**
   2. **Triggers**: Select the following Trigger events (conditions) for which the Webhook will be triggered:
      1. Incident Triggered (This will create a Trello card whenever a new incident gets triggered in Squadcast)
   3. **Filters**: You can apply filters on top of events, based on Teams, Services, Alert Sources, and Tags, by having an individual expression or a combination of expressions/expression groups.

Applying filters will trigger the webhook and create Trello cards only for events that match the filter.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-ab8c1674f1f5ed459fbe4a3038b76343d435b450%2FScreenshot%202023-04-28%20at%2018.14.39.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Click **Next: Configure Payload**, and navigate to the next step.

5. **Configure Payload**:\
   \
   Select the pre-configured template for **Trello - Create Card**. You can also test the Webhook by clicking the **Test Webhook** on the bottom right.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-50f40bf97662adaee50798cae0907bfd47d93d61%2FScreenshot%202023-06-06%20at%2019.59.45.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>**:**

Enter the List ID, API Key, and Token copied in the above steps in their respective fields.

We have added the necessary fields in the template. You can also [use this link](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post) to check the fields accepted by Trello Create Card API.
{% endhint %}

Click **Save** and your **Webhook** is created.

*Have any questions?* [*Ask the community*](https://community.squadcast.com/view/home)*.*
