Quickstart
This guide walks you through creating a simple bot that responds to messages.
Create a bot
-
Install the CLI
Terminal window curl -fsSL https://openslaq.com/install.sh | sh -
Authenticate
Terminal window openslaq loginThis opens your browser to authorize the CLI with your workspace.
-
Create the bot
Terminal window openslaq bot create my-first-botThis registers a new bot in your workspace and outputs a bot token.
-
Write the bot code
Create a new project and install the SDK:
Terminal window mkdir my-first-bot && cd my-first-botnpm init -ynpm install openslaqCreate
index.ts:import { OpenSlaq } from "openslaq";const client = new OpenSlaq({token: process.env.OPENSLAQ_BOT_TOKEN!,});// Listen for messages mentioning the botclient.on("message", async (message) => {if (message.mentionsBot) {await client.chat.postMessage({channelId: message.channelId,content: `Hello <@${message.userId}>! I'm alive!`,});}});client.connect(); -
Run it
Terminal window OPENSLAQ_BOT_TOKEN=your-token-here npx tsx index.ts
Next steps
- Add slash commands to your bot
- Set up webhooks for event-driven integrations
- Explore the SDK reference for all available methods