chat 4.31.0 → 4.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -124,18 +124,18 @@ This creates a `POST /api/webhooks/slack` endpoint. The `waitUntil` option ensur
124
124
 
125
125
  1. Start the dev server:
126
126
 
127
- `pnpm dev`
128
-
129
- 2. Expose it with a tunnel:
130
-
131
- `npx ngrok http 3000`
132
-
133
- 3. Copy the tunnel URL (for example, [`https://abc123.ngrok-free.dev`](https://abc123.ngrok-free.dev)) and update both **Event Subscriptions** and **Interactivity** Request URLs in your [Slack app settings](https://api.slack.com/apps) to [`https://abc123.ngrok-free.dev/api/webhooks/slack`](https://abc123.ngrok-free.dev/api/webhooks/slack).
134
-
135
- 4. Invite the bot to a channel: `/invite @Files Bot`.
136
-
137
- 5. @mention the bot and ask it to list files: "Show me what's in the bucket." The agent calls `listFiles` and streams the response back into the thread. To test a write operation end-to-end before building an approval flow, temporarily pass `requireApproval: false` to `createFileTools` in `lib/bot.ts` and ask the bot to "Upload a file called test.txt with the contents 'hello world'."
138
-
127
+
128
+ `pnpm dev`
129
+
130
+ 2\. Expose it with a tunnel:
131
+
132
+ `npx ngrok http 3000`
133
+
134
+ 3\. Copy the tunnel URL (for example, `https://abc123.ngrok-free.dev`) and update both **Event Subscriptions** and **Interactivity** Request URLs in your [Slack app settings](https://api.slack.com/apps) to `https://abc123.ngrok-free.dev/api/webhooks/slack`.
135
+
136
+ 4\. Invite the bot to a channel: `/invite @Files Bot`.
137
+
138
+ 5\. @mention the bot and ask it to list files: "Show me what's in the bucket." The agent calls `listFiles` and streams the response back into the thread. To test a write operation end-to-end before building an approval flow, temporarily pass `requireApproval: false` to `createFileTools` in `lib/bot.ts` and ask the bot to "Upload a file called test.txt with the contents 'hello world'."
139
139
 
140
140
  ### 9\. Deploy to Vercel
141
141
 
@@ -151,7 +151,7 @@ Then deploy to production:
151
151
 
152
152
  `vercel --prod`
153
153
 
154
- Update the **Event Subscriptions** and **Interactivity** Request URLs in your Slack app settings to your production URL, for example [`https://my-files-bot.vercel.app/api/webhooks/slack`](https://my-files-bot.vercel.app/api/webhooks/slack).
154
+ Update the **Event Subscriptions** and **Interactivity** Request URLs in your Slack app settings to your production URL, for example `https://your-app.vercel.app/api/webhooks/slack`.
155
155
 
156
156
  ## Configuring approval and read-only mode
157
157
 
@@ -0,0 +1,210 @@
1
+ # Give your agents secure access to third-party APIs
2
+
3
+ **Author:** Ben Sabic
4
+
5
+ ---
6
+
7
+ Agents and background services often need to call provider APIs such as Slack, GitHub, or Snowflake on behalf of your users. Doing so usually means storing long-lived provider secrets in your database or environment variables. [Vercel Connect](https://vercel.com/docs/connect) keeps those secrets out of your runtime by issuing user-authorized tokens on demand, scoped to the projects and environments that need them. You register a connector once, link it to a project, then request a token at runtime when your code calls the provider.
8
+
9
+ This guide walks you through Vercel Connect from start to finish. You'll create a Slack connector, link it to a project, and choose which environments can use it. From there, you'll request scoped runtime tokens from your code with the Vercel Connect SDK or the Vercel CLI, forward Slack webhooks to your projects, and apply best practices for scopes, environments, and token handling.
10
+
11
+ > **Vercel Connect is in beta and available on all plans.** Features and behavior, including available connectors and trigger forwarding, may change before general availability. Usage is subject to the [Beta Agreement](https://vercel.com/docs/release-phases/public-beta-agreement) and [Vercel Connect terms](https://vercel.com/docs/connect/legal).
12
+
13
+ ## Prerequisites
14
+
15
+ Before you begin, make sure you have:
16
+
17
+ * Access to a Vercel team and project with Vercel Connect enabled
18
+
19
+ * Permission to create connectors and link them to projects
20
+
21
+ * A Slack workspace where you can install apps
22
+
23
+ * Vercel CLI installed (`npm i -g vercel`)
24
+
25
+
26
+ ## How Vercel Connect works
27
+
28
+ Vercel Connect is built around a connector, a registered connection to a third-party provider that your whole team can reuse. You link a connector to the projects that need it, and your code requests a token from that connector at runtime instead of reading a stored secret. Vercel records each authorization and token request, so you keep an audit trail of how external access is used.
29
+
30
+ Connect uses four main concepts:
31
+
32
+ | Concept | Description |
33
+ | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
34
+ | Connector | Registered connection to a third-party provider that your team can reuse. |
35
+ | Installation | Provider-side installation for a specific tenant, such as a Slack workspace or GitHub organization. |
36
+ | Token request | Runtime token request, which can include options such as `installationId`, `scopes`, `resources`, and `authorizationDetails`. |
37
+ | Connector-project link | The binding between a connector and a project, including the environments where it's enabled. |
38
+
39
+ ### Token subject types
40
+
41
+ Each token request specifies the subject it represents. One connector can issue tokens for any of three subjects:
42
+
43
+ | Subject | Acts as | When to use |
44
+ | ------------ | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
45
+ | `app` | The application itself, using the connector's installation | Bot accounts or tenant-wide admin actions. App tokens skip the user-consent flow. |
46
+ | `user` | A specific signed-in user | Acting on behalf of a user. The user authorizes the connector once before you can mint tokens for them. |
47
+ | `jwt-bearer` | A federated identity you assert | Exchanging an external identity for a provider token. |
48
+
49
+ In the SDK, `subject` is required. The CLI requests a `user` token by default; pass `--subject app` for an app token.
50
+
51
+ ### Connector types
52
+
53
+ Vercel Connect has built-in support for Slack, GitHub, Snowflake, Salesforce, API key, and Custom OAuth connectors. Connectors fall into two operating models, based on who registers the credentials with the provider:
54
+
55
+ | Connector | Model | Setup |
56
+ | ------------ | ---------------- | ------------------------------------------------------------------------------------------- |
57
+ | Slack | Vercel Managed | Authorize Vercel's Slack app, installed per workspace. |
58
+ | GitHub | Vercel Managed | Install Vercel's GitHub app, per organization or user. |
59
+ | Snowflake | Vercel Managed | Connect through the Snowflake Partner Connect integration. |
60
+ | Salesforce | Vercel Managed | Authorize Vercel's managed OAuth client against your Salesforce org. |
61
+ | Custom OAuth | Customer Managed | Bring your own client ID and secret for any service URL, using OAuth 2.0 or OIDC with PKCE. |
62
+ | API key | Customer Managed | Supply a long-lived API key at create time. |
63
+
64
+ With a Vercel Managed Connector, Vercel registers the OAuth client and you authorize it against your account or workspace, so you don't manage client secrets. With a Customer Managed Connector, you register the OAuth client, generate the API key yourself, and supply the credentials when you create the connector. For providers that support it, Vercel Assisted Setup can perform some or all of the OAuth-client registration on your behalf.
65
+
66
+ From the Vercel CLI, you can create a connector using a service name, such as `slack` or `github`, or a service URL, such as `mcp.linear.app`.
67
+
68
+ ### How authentication works
69
+
70
+ When your code requests a token, the SDK authenticates with Vercel Connect using the OIDC token that Vercel automatically injects into your deployment. Connect verifies that token against the connector's project links to confirm the project and environment are allowed to request tokens. For local development, run `vercel link` and then `vercel env pull` to download a short-lived development token into `.env.local`. For external CI/CD or non-Vercel environments, pass a [Vercel access token](https://vercel.com/docs/rest-api#creating-an-access-token) to the SDK through the `vercelToken` option.
71
+
72
+ ## Create a connector
73
+
74
+ You can create a connector from the dashboard or the Vercel CLI.
75
+
76
+ In the dashboard, open the [Connect page](https://vercel.com/d?to=%2F%5Bteam%5D%2F~%2Fconnect) in your team, click **Create Connector**, and select **Slack** as the type. Name the connector (for example, `acme-slack`) and enable trigger forwarding if you plan to receive Slack webhooks.
77
+
78
+ To do the same in the terminal, run:
79
+
80
+ `vercel connect create slack --name acme-slack`
81
+
82
+ Add `--triggers` if you want this connector to forward incoming Slack webhooks:
83
+
84
+ `vercel connect create slack --name acme-slack --triggers`
85
+
86
+ You can also create GitHub, OAuth, or service-URL connectors:
87
+
88
+ `vercel connect create github --name acme-github vercel connect create oauth --name acme-oauth vercel connect create mcp.linear.app --name linear-connector`
89
+
90
+ ## Link the connector to a project
91
+
92
+ Attach the connector to the Vercel project where your app or agent runs. Choose at least one environment, such as production, and add preview or development if your workflow runs there too.
93
+
94
+ If you created the connector from the CLI inside a directory that's already linked to a Vercel project, that project is attached for you, so you can skip this step. To attach a different project, or to add environments later, pass `--project`:
95
+
96
+ `vercel connect attach slack/acme-slack --project my-project --environment production`
97
+
98
+ Connectors are identified by their UID (for example, `slack/acme-slack`) or by their ID (for example, `scl_abc123`). To also register the project as a destination for forwarded webhooks, add `--triggers`:
99
+
100
+ `vercel connect attach slack/acme-slack --triggers`
101
+
102
+ For stronger isolation, consider a separate connector for each environment.
103
+
104
+ ## Request a runtime token
105
+
106
+ Scope each token request to the workload before you request it:
107
+
108
+ * Set provider scopes only for the action you need.
109
+
110
+ * Add `installationId` when you need to target a specific installation.
111
+
112
+ * With the SDK, you can also pass provider-specific `resources` or `authorizationDetails`.
113
+
114
+
115
+ You usually don't need to set `installationId`. In most cases, the connector resolves a default installation from its tenant, which covers a private app installed in a single workspace. Set it explicitly only when the connector spans more than one installation and you need to target a specific Slack workspace or GitHub organization.
116
+
117
+ Request the token from your server-side code with the SDK:
118
+
119
+ `import { getToken } from '@vercel/connect'; const token = await getToken('slack/acme-slack', { subject: { type: 'app' }, scopes: ['channels:read'], });`
120
+
121
+ `getToken` returns the token string, ready to use in an `Authorization` header. If you need the token's expiry, the connected workspace name, or other provider metadata, call `getTokenResponse` instead. The SDK keeps an in-process cache and refreshes tokens automatically as they approach expiry, so you can call `getToken` on each request without minting a new token every time.
122
+
123
+ For a `user`\-subject token, the first request for a user who hasn't authorized the connector throws `UserAuthorizationRequiredError`. Catch it, send the user to the connector's consent URL with `startAuthorization`, then retry once they authorize.
124
+
125
+ To request the same app token from the Vercel CLI:
126
+
127
+ `vercel connect token slack/acme-slack --subject app --installation-id inst_... --scopes channels:read`
128
+
129
+ In the CLI, `--installation-id` applies with `--subject app`. For machine-readable output that includes fields such as `expiresAt` and `installationId`, add `--format=json`.
130
+
131
+ Your code now receives a runtime token scoped to the requested action, which it can use to call the provider API. Request tokens at runtime, and don't persist them in long-lived environment variables or a database.
132
+
133
+ ## Forward Slack webhooks to your projects
134
+
135
+ Vercel Connect can forward incoming webhooks to your projects through trigger forwarding. A connector can forward verified webhooks to up to three destination projects.
136
+
137
+ Enable trigger forwarding when you create a connector with `--triggers`, then register each destination project when you attach it:
138
+
139
+ `vercel connect attach slack/acme-slack --triggers --trigger-branch staging --trigger-path /slack`
140
+
141
+ `--trigger-branch` sets the Git branch for the destination and defaults to production. `--trigger-path` sets the path that receives forwarded webhooks and defaults to `/{service}`. Detaching a project removes its token access but doesn't remove it from the connector's trigger destinations, so manage trigger destinations separately.
142
+
143
+ ## Best practices
144
+
145
+ * Use a separate connector per environment. Giving production, preview, and development their own connectors ensures each has its own authorization grant, scopes, and audit trail, so a token compromised in one environment can't be replayed against another.
146
+
147
+ * Request the minimum required scopes. Set provider scopes only for the actions the workload performs, rather than requesting broad access.
148
+
149
+ * Keep tokens out of storage. Request tokens at runtime and avoid persisting them in long-lived environment variables or a database.
150
+
151
+ * Target a specific installation when needed. Pass `installationId` in the SDK, or `--installation-id` with `--subject app` on the CLI, to act against a particular Slack workspace or GitHub organization.
152
+
153
+
154
+ ## Pricing
155
+
156
+ Vercel Connect is billed per token request.
157
+
158
+ | Plan | Token request pricing |
159
+ | ---------- | ----------------------------------------------------- |
160
+ | Hobby | 5,000 token requests per month, included at no charge |
161
+ | Pro | $3 per 10,000 token requests |
162
+ | Enterprise | $3 per 10,000 token requests |
163
+
164
+ See [Pricing and Limits](https://vercel.com/docs/connect/pricing) for the full table and the platform limits that apply during beta.
165
+
166
+ ## Vercel CLI commands
167
+
168
+ The `vercel connect` command manages connectors from the terminal. Connectors are identified by their UID (`slack/my-bot`) or ID (`scl_abc123`).
169
+
170
+ | Command | Description |
171
+ | ----------------------- | ----------------------------------------------------- |
172
+ | `vercel connect create` | Create a connector for a service. |
173
+ | `vercel connect list` | List connectors for your team or project (also `ls`). |
174
+ | `vercel connect token` | Request a runtime token from a connector. |
175
+ | `vercel connect attach` | Attach a project to a connector. |
176
+ | `vercel connect detach` | Detach a project from a connector. |
177
+ | `vercel connect update` | Update connector branding such as icon and colors. |
178
+ | `vercel connect remove` | Delete a connector (also `rm`). |
179
+ | `vercel connect open` | Open a connector in the Vercel dashboard. |
180
+
181
+ By default, `vercel connect list` shows only connectors linked to the current project. Add `--all-projects` to list all connectors in the team. Removing a connector with attached projects fails unless you pass `--disconnect-all` to detach them first. Run `vercel connect --help` to review the current CLI surface.
182
+
183
+ ## Known limitations
184
+
185
+ * Trigger forwarding supports Slack only.
186
+
187
+ * Connector branding fields can't be fully cleared after you set them.
188
+
189
+ * Token revocation and token lifetime depend on provider support.
190
+
191
+
192
+ ## When to use Vercel Connect or Integrations
193
+
194
+ Use Vercel Connect when you need delegated runtime credentials and user authorization for agent workflows, such as running an agent that needs project-scoped access to a Slack workspace, linking a single connector to multiple projects and environments, or requesting user-authorized provider tokens at runtime instead of storing long-lived secrets.
195
+
196
+ Use Vercel Integrations when you want marketplace-managed installs and provider-managed products in the Vercel Marketplace.
197
+
198
+ ## Related resources and next steps
199
+
200
+ * Follow [Vercel Connect quickstart](https://vercel.com/docs/connect/quickstart) for the first-setup walkthrough.
201
+
202
+ * Read the [Vercel Connect overview](https://vercel.com/docs/connect) for concepts, limitations, and product boundaries.
203
+
204
+ * See the [Vercel Connect CLI reference](https://vercel.com/docs/cli/connect) for every subcommand and option.
205
+
206
+ * Explore [Vercel Integrations](https://vercel.com/docs/integrations) if you need marketplace integration installs.
207
+
208
+ ---
209
+
210
+ [View full KB sitemap](/kb/sitemap.md)
@@ -19,6 +19,11 @@
19
19
  "title": "Community Agent",
20
20
  "description": "Open source AI-powered Slack community management bot with a built-in Next.js admin panel. Uses Chat SDK, AI SDK, and Vercel Workflow.",
21
21
  "href": "https://vercel.com/templates/next.js/chat-sdk-community-agent"
22
+ },
23
+ {
24
+ "title": "Caltext",
25
+ "description": "iMessage calorie tracking assistant powered by AI.",
26
+ "href": "https://vercel.com/templates/hono/caltext"
22
27
  }
23
28
  ]
24
29
  }