Skip to content

Commit f88096a

Browse files
authored
docs: Deploy with Vercel (#2767)
1 parent bfe4e60 commit f88096a

File tree

4 files changed

+98
-1
lines changed

4 files changed

+98
-1
lines changed

docs/english/_sidebar.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@
7575
{
7676
"type": "category",
7777
"label": "Deployments",
78-
"items": ["tools/bolt-js/deployments/aws-lambda", "tools/bolt-js/deployments/heroku"]
78+
"items": [
79+
"tools/bolt-js/deployments/aws-lambda",
80+
"tools/bolt-js/deployments/heroku",
81+
"tools/bolt-js/deployments/vercel/index"
82+
]
7983
},
8084
{
8185
"type": "category",
24.3 KB
Loading
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Deploying to Vercel
2+
3+
This guide walks you through preparing and deploying a Slack app using Bolt for JavaScript, [Workflow DevKit's](https://useworkflow.dev/) `DurableAgent`, [AI SDK](https://ai-sdk.dev/) tools, the [Nitro](https://nitro.build/) server framework, and [Vercel](https://vercel.com/home).
4+
5+
When you’re finished, you’ll have this ⚡️[Slack agent template](https://github.com/vercel-partner-solutions/slack-agent-template) to run, modify, and make your own.
6+
7+
---
8+
9+
## Prerequisites
10+
11+
First things first, take a few moments to set up the following:
12+
13+
* Make sure you have a development environment where you have permission to install apps. You can get a free sandbox with the [Slack Developer Program](https://api.slack.com/developer-program).
14+
* Ensure you have an account with a Git provider (GitHub, GitLab, or Bitbucket).
15+
16+
## Create a new Vercel project
17+
18+
Create a new Vercel project based on a Bolt for JavaScript template by clicking the button below.
19+
20+
<Button label="Deploy with Vercel" link="https://vercel.com/new/clone?demo-description=This+is+a+Slack+Agent+template+built+with+Bolt+for+JavaScript+%28TypeScript%29+and+the+Nitro+server+framework.&demo-image=%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2FSs9t7RkKlPtProrbDhZFM%2F0d11b9095ecf84c87a68fbdef6f12ad1%2FFrame__1_.png&demo-title=Slack+Agent+Template&demo-url=https%3A%2F%2Fgithub.com%2Fvercel-partner-solutions%2Fslack-agent-template&env=SLACK_SIGNING_SECRET%2CSLACK_BOT_TOKEN&envDescription=These+environment+variables+are+required+to+deploy+your+Slack+app+to+Vercel&envLink=https%3A%2F%2Fapi.slack.com%2Fapps&from=templates&project-name=Slack+Agent+Template&project-names=Comma+separated+list+of+project+names%2Cto+match+the+root-directories&repository-name=slack-agent-template&repository-url=https%3A%2F%2Fgithub.com%2Fvercel-partner-solutions%2Fslack-agent-template&root-directories=List+of+directory+paths+for+the+directories+to+clone+into+projects&skippable-integrations=1&teamSlug=vercel-partner-demo" />
21+
22+
You will then be prompted to select a Git provider. Select your preferred provider and log in.
23+
24+
![New project](new_project.png)
25+
26+
Select your provider as the Git Scope and rename the repo if you'd like. Click **Create**.
27+
28+
Keep this browser tab open; we'll be back to it soon. Next, we'll need to add a couple of variables for our app. To obtain these, direct your attention to the Slack app settings page.
29+
30+
## Create a Slack app
31+
32+
Create a new Slack app through [this link](https://api.slack.com/apps?new_app=1), then select **from a manifest**. Next, choose a workspace you have permission to install apps in. Click **Next**, then copy and paste the project manifest code here, replacing the placeholder text in the **JSON** tab.
33+
34+
```js reference
35+
https://github.com/vercel-partner-solutions/slack-agent-template/blob/main/manifest.json
36+
```
37+
38+
Click **Next** and then **Create**.
39+
40+
## Install app
41+
42+
Still in the app settings, navigate to the **Install App** section and click the button to install your app to the workspace. After installing the app, a bot token will be available. Copy this token and paste it in the Vercel setup where it says `SLACK_BOT_TOKEN`.
43+
44+
Back in the Slack app settings, navigate to the **Basic Information** section and find the **Signing Secret**. Copy this token and paste it in the Vercel setup where it says `SLACK_SIGNING_SECRET`, then click **Deploy**.
45+
46+
![Environment variables](env_variables.png)
47+
48+
The deployment process will kick off, and you'll receive progress updates. Be patient. Deployment is hard work! Once it's finished, you'll see a confirmation screen with a button to **Continue to Dashboard**. Click that button. Here you can see that your app has been deployed! Use this dashboard to keep tabs on build logs, deployment checks, and more.
49+
50+
## Set AI Gateway token
51+
52+
Follow these steps to create an AI Gateway API key from the Vercel dashboard.
53+
1. From the Vercel dashboard, click on the **AI Gateway** tab in the top nav bar.
54+
2. On the left sidebar, select **API Keys**.
55+
3. Click **Create Key**, give it a name, and copy the value (it won't be shown again).
56+
57+
Once you have the key, you need to add it to your project so your code can use it. There are two primary ways to do this: through the dashboard and for local development.
58+
59+
Through the dashboard:
60+
1. Go to your project in Vercel.
61+
2. Click the **Settings** tab in the top nav bar.
62+
3. Select **Environment Variables** from the left-hand menu.
63+
4. Select **Add Environment Variable** to add a variable with the `Key` set to `AI_GATEWAY_API_KEY` and the `Value` set to the key value you just copied.
64+
5. Click **Save**. Redeploy your app for these changes to take effect.
65+
66+
For local development, open your terminal and set the environment variable `AI_GATEWAY_API_KEY` to the value of the key you copied.
67+
68+
```sh
69+
export AI_GATEWAY_API_KEY=<your-key-here>
70+
```
71+
72+
## Update URLs
73+
74+
Once the deployment has completed, navigate back to the Slack [app settings](https://api.slack.com/apps) and open the **App Manifest** from the sidebar.
75+
76+
Update the manifest so that all of the `reference_url` and `url` fields use your domain. Here are some examples:
77+
* **Slash commands URL**: `https://slack-agent-template-example.vercel.app/api/slack/events`
78+
* **Event subscriptions**: `https://slack-agent-template-example.vercel.app/api/slack/events`
79+
* **Interactivity request URL**: `https://slack-agent-template-example.vercel.app/api/slack/events`
80+
81+
Click **Save** and verify the URL.
82+
83+
## Run the app
84+
85+
Open your Slack workspace and add your new app to a channel. Your app should respond whenever it is tagged in a message or sent a DM!
86+
87+
Your app is now set up to build and deploy whenever you commit to your repo.
88+
89+
## Next steps
90+
91+
✨ Explore Vercel documentation [here](https://vercel.com/docs/git).
92+
93+
✨ Learn all about [developing apps with AI features](/ai/developing-ai-apps).
43.3 KB
Loading

0 commit comments

Comments
 (0)