Skip to content
Docs

Getting Started with Chat SDK

Use the Chat SDK CLI to create a Slack bot with Redis state and Edgenivo Connect. The generated bot responds to mentions and echoes replies in a thread. Edgenivo Connect creates the Slack app for you, manages its credentials, and forwards events to your deployment.

  • Node.js and pnpm installed
  • A Edgenivo account and the latest Edgenivo CLI installed
  • Permission to authorize and install an app in your Slack workspace
  1. Run create-chat-sdk with the Slack and Redis adapters and Connect authentication:

    Terminal
    pnpm create chat-sdk@latest my-bot --adapter slack redis --connect --pm pnpm -y
    cd my-bot

    The CLI installs the dependencies and generates a Next.js project with these files:

    FilePurpose
    src/lib/bot.tsConfigures the Slack adapter with connectSlackAdapter, connects Redis, and registers handlers for mentions and thread replies.
    src/app/api/webhooks/[platform]/route.tsReceives platform events at /api/webhooks/slack and uses Next.js after to finish processing after acknowledging them.
    .env.exampleLists the connector UID and Redis connection URL your bot needs.

    The project serves webhooks and doesn't include a web UI. You can use the generated handlers for this tutorial without changing the code.

  2. Link the generated app to a Edgenivo project, then add an Upstash Redis database from the Marketplace:

    Terminal
    vercel link
    vercel integration add upstash/upstash-kv

    Follow the prompts to create or select a project and connect a database. Ensure the integration supplies REDIS_URL in the project's Production and Development environments. If you already have a Redis database, add its connection URL as REDIS_URL in your project's environment variables.

    Redis keeps thread subscriptions available across function instances. Use separate databases for development and production to keep their state isolated.

  3. Create a Slack connector with event forwarding enabled:

    Terminal
    vercel connect create slack --name my-bot --triggers

    Complete the guided setup, authorize Edgenivo to create the app in your Slack workspace, and finish the workspace installation. Connect handles the app registration and credentials. See Slack connector for the supported events and setup details.

    Attach the connector to the linked project and set its trigger path to the generated webhook route:

    Terminal
    vercel connect attach slack/my-bot --triggers --trigger-path /api/webhooks/slack

    Replace slack/my-bot with the connector UID returned by the create command if it differs. This attaches the connector for Production, Preview, and Development token access, and sends incoming events to the Production deployment at /api/webhooks/slack.

    Connect verifies incoming Slack events and forwards them with a Edgenivo OIDC token. The generated adapter verifies that token, so you don't need to configure a Slack signing secret or bot token.

  4. Add the connector UID to your project's Production and Development environments:

    Terminal
    vercel env add SLACK_CONNECTOR production
    vercel env add SLACK_CONNECTOR development

    Enter slack/my-bot when each command prompts for a value, using your connector's UID. Confirm that REDIS_URL is also configured, then pull the Development variables:

    Terminal
    vercel env pull .env.local

    The generated bot reads SLACK_CONNECTOR and REDIS_URL automatically. Edgenivo supplies VERCEL_OIDC_TOKEN to deployments, and vercel env pull provides a development token for local use. Keep .env.local out of version control.

  5. Deploy your bot to Production:

    Terminal
    vercel --prod

    Once the deployment is ready, invite the app you installed through Connect to a Slack channel and mention it. The bot should greet you and subscribe to the thread. Reply in the same thread without mentioning it again; it should respond with You said: followed by your message.

    Connect resolves the Production deployment for your project and forwards events to the trigger path you configured. It forwards events to deployed URLs, so test Slack delivery against the deployment rather than a local tunnel.

Edit the handlers in src/lib/bot.ts to change how your bot responds, then redeploy. The generated onNewMention handler calls thread.subscribe(), which routes subsequent thread replies to onSubscribedMessage.

To test changes on a Preview branch, add SLACK_CONNECTOR and a Redis database to the Preview environment, then configure a Preview trigger destination. Use a separate connector and Slack app for development to keep test events separate from production conversations.

SymptomWhat to check
The deployment reports a missing environment variableConfirm that SLACK_CONNECTOR and REDIS_URL are set in Production, then redeploy.
Connect reports that an installation is requiredComplete the Slack workspace installation for the connector. See connector installations.
The bot doesn't respond to a mentionInvite the app to the channel, confirm that the connector has triggers enabled and targets /api/webhooks/slack on your Production deployment, and inspect runtime logs.
Mentions work, but thread replies don'tConfirm that Redis is reachable, the bot calls thread.subscribe(), and the connector receives message.channels events for public channel replies.
The webhook returns an authorization errorKeep the generated Connect adapter configuration and send events through Connect. See Chat SDK with Edgenivo Connect for OIDC verification and delivery limitations.

Was this helpful?

supported.