> For the complete documentation index, see [llms.txt](https://labfun.gitbook.io/lab.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://labfun.gitbook.io/lab.fun/getting-started/integrations.md).

# Integrations

### Integrations

Lab.fun supports seamless integrations with popular platforms and services. Here are some examples:

#### Slack Integration

Integrate Lab.fun with Slack to enable interactive chatbots directly within your Slack workspace:

```
const { LabFun } = require('labdotfun-sdk');
const { SlackAdapter } = require('labdotfun-slack');

const bot = new LabFun({
  apiKey: 'your-openai-api-key',
});

const slackAdapter = new SlackAdapter({
  token: 'your-slack-bot-token',
});

bot.use(slackAdapter);

bot.on('message', (userMessage) => {
  const reply = bot.generateResponse(userMessage);
  slackAdapter.sendMessage(reply, userMessage.channel);
});

bot.start();
```

#### Discord Integration

Bring Lab.fun to Discord servers for community engagement:

```
const { LabFun } = require('labdotfun-sdk');
const { DiscordAdapter } = require('labdotfun-discord');

const bot = new LabFun({
  apiKey: 'your-openai-api-key',
});

const discordAdapter = new DiscordAdapter({
  token: 'your-discord-bot-token',
});

bot.use(discordAdapter);

discordAdapter.on('message', (userMessage) => {
  const reply = bot.generateResponse(userMessage.content);
  discordAdapter.sendMessage(reply, userMessage.channel.id);
});

bot.start();
```

#### Webhook Integration

Lab.fun supports webhooks for custom integrations with external systems:

```
const { LabFun } = require('labdotfun-sdk');
const express = require('express');

const app = express();
app.use(express.json());

const bot = new LabFun({
  apiKey: 'your-openai-api-key',
});

app.post('/webhook', (req, res) => {
  const userMessage = req.body.message;
  const reply = bot.generateResponse(userMessage);
  res.json({ reply });
});

app.listen(3000, () => {
  console.log('Webhook server running on port 3000');
});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://labfun.gitbook.io/lab.fun/getting-started/integrations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
