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

# Create a Slack Summarizer Bot with VESSL Service

> Use VESSL Service to create a Slack Summarizer Bot with Open-Source Llama 3

This example is a step-by-step walkthrough of how to create a bot that summarizes Slack threads using the open-source Llama 3 model, all on VESSL Service.

<Card title="See the final code" icon="github" href="https://github.com/vessl-ai/examples/tree/main/services/llm-summarizer-slackbot">
  See the completed YAML files and final code for this example.
</Card>

## Setting Up The App

Open [api.slack.com](https://api.slack.com/), and navigate to the `Your Apps` tab on the top right corner. Create a new app from scratch called **"Summarizer"** in your designated workspace.

Under the `OAuth & Permissions` tab, scroll down to `Scopes` and configure the necessary scopes (such as **app\_mentions:read**, **channels:history**, **channels:join**, **chat:write**, **im:history**, **remote\_files:read**, **users:read**) and click `Install to Workspace`.

<img className="rounded-md" src="https://mintcdn.com/vesslai/o4gNoh1CnnKmD81a/images/examples/uses/summarizer/scopes.png?fit=max&auto=format&n=o4gNoh1CnnKmD81a&q=85&s=947aa291160001e0adc7dc55f2e7e339" width="1202" height="1480" data-path="images/examples/uses/summarizer/scopes.png" />

Take the `Bot User OAuth Token` under `OAuth & Permissions` and the `Signing Secret` under `Basic Information > App Credentials` and save them somehwere secure, like the designated VESSL interface `Settings > Secrets`.

<img className="rounded-md" src="https://mintcdn.com/vesslai/o4gNoh1CnnKmD81a/images/examples/uses/summarizer/secrets.png?fit=max&auto=format&n=o4gNoh1CnnKmD81a&q=85&s=3985e67e1192847d0dd53a3d2c28ca0e" width="3012" height="1640" data-path="images/examples/uses/summarizer/secrets.png" />

## Deploying Llama 3 Using VESSL Service

We will now deploy a Llama 3 server with VESSL Service.

1. Clone [this GitHub repository](https://github.com/vessl-ai/examples). We will be using the `llm-summarizer-slackbot` example.

```bash theme={null}
   git clone https://github.com/vessl-ai/examples.git
```

2. Make sure VESSL is installed and configured.

```bash theme={null}
   pip install vessl
   vessl configure
```

3. Deploy the server using the provided `serve-llama.yaml` configuration and VESSL CLI using the following command.

```bash theme={null}
   cd examples/llm-summarizer-slackbot
   vessl serve create -f serve-llama.yaml --set-current-active
```

Once the service is running, the service will appear in VESSL `Service` tab, and you an now access the model through the provided endpoint.

<img className="rounded-md" src="https://mintcdn.com/vesslai/o4gNoh1CnnKmD81a/images/examples/uses/summarizer/endpoint.png?fit=max&auto=format&n=o4gNoh1CnnKmD81a&q=85&s=ee7b68c4ba1b63b564b1805ebd69e707" width="2401" height="241" data-path="images/examples/uses/summarizer/endpoint.png" />

## Serving the App

To serve the app itself, create a `New Service` in `Service`. Then, navigate to the `Revisions` tab within the service and press `New Revision`.

1. Initialize the revision with the `run-app.yaml` from the cloned repository. You will see the exact file on the right. You can now directly edit the YAML file with the editor or edit with the UI.

<img className="rounded-md" src="https://mintcdn.com/vesslai/o4gNoh1CnnKmD81a/images/examples/uses/summarizer/initialize-revision.png?fit=max&auto=format&n=o4gNoh1CnnKmD81a&q=85&s=fdba83ef5ea89ff74afbabd46a30aa70" width="2971" height="898" data-path="images/examples/uses/summarizer/initialize-revision.png" />

2. Make sure that your secrets are properly configured (`access-token`, `slackbot-token`, and `slack-signing-secret`).

3. Paste in the endpoint produced by the Llama server in `LLAMA3_BASE_URL` and press `Create`.

<img className="rounded-md" src="https://mintcdn.com/vesslai/o4gNoh1CnnKmD81a/images/examples/uses/summarizer/new-revision.png?fit=max&auto=format&n=o4gNoh1CnnKmD81a&q=85&s=eecbcaec860d9cfa1da4673d30d29d35" width="2991" height="1632" data-path="images/examples/uses/summarizer/new-revision.png" />

4. Once the revision is running, the app server will produce an endpoint that you can enter into the `Slack Request URL` under `Event Subscriptions`.

<img className="rounded-md" src="https://mintcdn.com/vesslai/o4gNoh1CnnKmD81a/images/examples/uses/summarizer/summarizer-endpoint.png?fit=max&auto=format&n=o4gNoh1CnnKmD81a&q=85&s=cbb5843f43bbf440ba4b32578b38c3bd" width="2449" height="247" data-path="images/examples/uses/summarizer/summarizer-endpoint.png" />

<img className="rounded-md" src="https://mintcdn.com/vesslai/o4gNoh1CnnKmD81a/images/examples/uses/summarizer/request-url.png?fit=max&auto=format&n=o4gNoh1CnnKmD81a&q=85&s=89c0b207dc6ad8c760b16f8f6213fa84" width="1298" height="684" data-path="images/examples/uses/summarizer/request-url.png" />

**Remember to add '/slack/events' at the end of the endpoint when entering the Request URL for the app to properly respond to Slack events**

5. Subscribe to bot events (such as **app\_mention**, **message.channels**, **message.im**) in `Event Subscriptions` and save the changes.

<img className="rounded-md" src="https://mintcdn.com/vesslai/o4gNoh1CnnKmD81a/images/examples/uses/summarizer/bot-events.png?fit=max&auto=format&n=o4gNoh1CnnKmD81a&q=85&s=f0a599e2141b560737f9ba748305d2ac" width="1196" height="744" data-path="images/examples/uses/summarizer/bot-events.png" />

The app is now good to go. Mention the bot in a thread and ask it a question or use the `summarize` command for a summary, `--limit` to specify the number of messages (default: 10), `--help` for instructions, and `--version` to check the app version.

<img className="rounded-md" src="https://mintcdn.com/vesslai/o4gNoh1CnnKmD81a/images/examples/uses/summarizer/sample.jpg?fit=max&auto=format&n=o4gNoh1CnnKmD81a&q=85&s=d425182230d655b5bef010fc95e04dbd" width="1179" height="1176" data-path="images/examples/uses/summarizer/sample.jpg" />
