HTTP trigger
Slack and chat bots, the easy way
Chat bots are mostly small functions reacting to events — perfect for hostfunc. Point a Slack slash command or event subscription at your function's URL, store the bot token as an encrypted secret, and you're live.
The problem
Bots need a public endpoint, token storage, and quick responses to verification challenges. Hosting that — plus keeping the token out of your code — usually means a server you'd rather not run.
How hostfunc solves it
- Give Slack your function's stable run URL for slash commands or the Events API.
- Store the bot token with secret.getRequired() — encrypted at rest, never in your source.
- Reuse a shared org connector so every bot function in your workspace can post messages.
- Compose with AI functions to summarize threads or draft replies before posting.
slack-command.ts
import { secret } from "@hostfunc/sdk";
// Slash command endpoint — set as the Request URL in your Slack app.
export async function main(payload: { command: string; text: string }) {
const token = await secret.getRequired("SLACK_BOT_TOKEN");
// ...call chat.postMessage with token...
return {
response_type: "in_channel",
text: `Ran ${payload.command} with: ${payload.text}`,
};
}