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

# Using the Bitly Action Template

[Back to Actions Integrations](https://koreai.mintlify.site/ai-for-service/integrations/overview.md#actions)

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

**Prerequisites:** Configure [Bitly](https://koreai.mintlify.site/ai-for-service/integrations/actions/configuring-the-bitly-action) and [install templates](https://koreai.mintlify.site/ai-for-service/integrations/actions/configuring-the-bitly-action#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](https://koreai.mintlify.site/ai-for-service/integrations/actions/configuring-the-bitly-action#install-bitly-action-templates).

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

   ![Dialog task added](https://mintcdn.com/koreai/7TeKpNFD7QJEMcMu/ai-for-service/integrations/actions/images/bitly-action-img12-tem-img4.png?fit=max\&auto=format\&n=7TeKpNFD7QJEMcMu\&q=85\&s=f9c948605e153dbdf43c0d7e4e397791)

   * **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**:

     ![Request](https://mintcdn.com/koreai/7TeKpNFD7QJEMcMu/ai-for-service/integrations/actions/images/bitly-tem-img5-short-url.png?fit=max\&auto=format\&n=7TeKpNFD7QJEMcMu\&q=85\&s=6c0911aed8d4c0f541e8e49b8364063a)

     **Sample Request:**

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

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

     ![Add Response](https://mintcdn.com/koreai/7TeKpNFD7QJEMcMu/ai-for-service/integrations/actions/images/bitly-tem-img6-short-url.png?fit=max\&auto=format\&n=7TeKpNFD7QJEMcMu\&q=85\&s=b0fa9deee11e77f100f7da4ac2bb45a3)

     **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.

   ![Enter long url](https://mintcdn.com/koreai/7TeKpNFD7QJEMcMu/ai-for-service/integrations/actions/images/bitly-tem-img7-short-url.png?fit=max\&auto=format\&n=7TeKpNFD7QJEMcMu\&q=85\&s=acea9d79010e1b1d341b2b9a2f6e2d49)

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

   ![View Stats](https://mintcdn.com/koreai/7TeKpNFD7QJEMcMu/ai-for-service/integrations/actions/images/bitly-tem-img8-short-url.png?fit=max\&auto=format\&n=7TeKpNFD7QJEMcMu\&q=85\&s=400ab1383e5e559895f5c911c21b4eef)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.