> ## Documentation Index
> Fetch the complete documentation index at: https://koreai-agent-management-platform-dev.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Using the Bitly Action Template

<Badge icon="arrow-left" color="gray">[Back to Actions Integrations](/ai-for-service/integrations/overview#actions)</Badge>

Use prebuilt Bitly action templates to auto-create dialog tasks.

**Prerequisites:** Configure [Bitly](configuring-the-bitly-action.md) and [install templates](configuring-the-bitly-action.md#install-bitly-action-templates) before proceeding.

Navigate to **Automation AI > Use Cases > Dialogs**, then click the auto-created dialog to open the canvas.

***

## Supported Actions

| Action       | Description           | Method |
| ------------ | --------------------- | ------ |
| Short an URL | Shortens any long URL | POST   |

***

## Shorten a URL

1. Install the template from [Bitly Templates](configuring-the-bitly-action.md#install-bitly-action-templates).

2. The *Short URL* dialog task is added with:

   <img src="https://mintlify.s3.us-west-1.amazonaws.com/koreai-agent-management-platform-dev/ai-for-service/integrations/actions/images/bitly-action-img12-tem-img4.png" alt="Dialog task added" />

   * **shortUrl** - User intent to shorten a URL.

   * **longURL** - Entity node to enter a long URL.

   * **shortUrlService** - Bot action service to shorten the URL. Click **Edit Request**:

     <img src="https://mintlify.s3.us-west-1.amazonaws.com/koreai-agent-management-platform-dev/ai-for-service/integrations/actions/images/bitly-tem-img5-short-url.png" alt="Request" />

     **Sample Request:**

     ```json  theme={null}
     {
       "long_url": "https://en.wikipedia.org/wiki/Constantine_V"
     }
     ```

     Click **+Add Response** to add sample responses:

     <img src="https://mintlify.s3.us-west-1.amazonaws.com/koreai-agent-management-platform-dev/ai-for-service/integrations/actions/images/bitly-tem-img6-short-url.png" alt="Add Response" />

     **Sample Response:**

     ```json  theme={null}
     {
       "created_at": "2023-08-25T08:38:00+0000",
       "id": "bit.ly/3E8Nec6",
       "link": "https://bit.ly/3E8Nec6",
       "custom_bitlinks": [],
       "long_url": "https://en.wikipedia.org/wiki/Constantine_V",
       "archived": false,
       "tags": [],
       "deeplinks": [],
       "references": {
         "group": "https://api-ssl.bitly.com/v4/groups/Bn448WZsE7j"
       }
     }
     ```

   * **generalQueryMessage** - Message node to display the shortened URL.

3. Click **Train** to complete training.

4. Click **Talk to Bot** to test.

5. Enter a long URL when prompted.

   <img src="https://mintlify.s3.us-west-1.amazonaws.com/koreai-agent-management-platform-dev/ai-for-service/integrations/actions/images/bitly-tem-img7-short-url.png" alt="Enter long url" />

6. The URL is shortened. Click **View Stats** to see URL statistics in Bitly.

   <img src="https://mintlify.s3.us-west-1.amazonaws.com/koreai-agent-management-platform-dev/ai-for-service/integrations/actions/images/bitly-tem-img8-short-url.png" alt="View Stats" />


Built with [Mintlify](https://mintlify.com).