# ClickUp

## Create a Task in ClickUp via Webhook Template

Follow the below steps to configure the “ClickUp - Create Task” action via webhooks.

We will be utilizing ClickUp's Rest APIs to Create Task

## Create a Key to authenticate ClickUp Rest API

ClickUp's APIs can be authenticated in different ways, check them out [here](https://clickup.com/api/developer-portal/authentication/). We will be using Personal Access Token (PAT) to authenticate their API

1. Login to your ClickUp account -> Go to **Your Profile** at the left bottom-> **Apps** -> Under **API Token** -> **Generate**
2. Copy the **Token** to Create Cards

<div><figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-d3ec60149ac636431efc8cf97080f588274fbc4f%2FScreenshot%202023-06-07%20at%2010.30.13.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-3dc7b6a41a51a2717d90d8712ef3d80346dee4b2%2FScreenshot%202023-06-07%20at%2010.30.32.png?alt=media" alt=""><figcaption></figcaption></figure></div>

## Get List ID to access the API

You need Team ID and Space ID to get the List ID

Here we have used [<mark style="color:blue;">Postman</mark>](https://www.postman.com/) to get those IDs

1. Open a new tab in **Postman**
2. Paste the below curl in the **URL** space -> Send
3. Copy the **Space ID** that you get as a response

```
curl -i -X GET \
  'https://api.clickup.com/api/v2/team/{team_id}/space?archived=false' \
  -H 'Authorization: YOUR_API_KEY_HERE'
```

{% hint style="info" %}
**Note:**

Replace {team\_id} with your team id (workspace id) in the URL. You can get the team ID on the browser URL. When you log in to your ClickUp account that number you see on your browser URL is the team ID

Under **Headers** -> **Authorization**: paste the **API Key** that you copied from the previous step
{% endhint %}

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

4. Open a new tab in **Postman**
5. Paste the below curl in the **URL** space -> Send
6. Copy the **List ID** that you get as a response

```
curl -i -X GET \
  'https://api.clickup.com/api/v2/space/{space_id}/folder?archived=false' \
  -H 'Authorization: YOUR_API_KEY_HERE'
```

{% hint style="info" %}
**Note:**

Replace {space\_id} with your space id copied from the previous step.

Under **Headers** -> **Authorization**: paste the **API Key** that you copied from the previous step
{% endhint %}

## Using Webhooks to create ClickUp Tasks 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 **ClickUp - Create Task**.
   2. **Webhook Description** (optional): Enter an optional description. For example - This webhook is for task creation in ClickUP 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 and replace the {list\_id} with your list id copied from the previous step
   5. **Additional Headers**: Add `Key: Authorization` and paste the API Key copied from the previous step

   [https://api.clickup.com/api/v2/list/{list\_id}/task](https://api.clickup.com/api/v2/list/%7Blist_id%7D/task)

{% hint style="info" %}
**Note:**

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-454f5984d0100e579468a006d1f31729a9cf5e93%2FScreenshot%202023-06-07%20at%2010.49.51.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" %}
**Note:**

Select this option only if you want to create ClickUp tasks manually on-demand. If you want a ticket, 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 ClickUp task 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 ClickUp tasks 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 **ClickUp - Create Task**. 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-7e325265f7f109e2a4421dc4da280972f56233d3%2FScreenshot%202023-06-07%20at%2010.54.58.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:**

We have added the necessary fields in the template. You can modify them according to your use case

You can also [use this link](https://clickup.com/api/clickupreference/operation/CreateTask/) to check the fields accepted by ClickUp API.
{% endhint %}

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

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