text stringlengths 0 59.1k |
|---|
| ------------------- | ---------------------------------- | |
| **Airtable** | Create, update, and manage records | |
| **Slack** | Send messages and notifications | |
| **Discord** | Send messages to channels | |
| **Gmail** | Send and manage emails | |
| **Google Calendar** | Create and manage events | |
| **Google Drive** | Upload and manage files | |
| **Postgres** | Execute database queries | |
See the [Actions documentation](./actions/overview.md) to get started. |
<|endoftext|> |
# source: VoltAgent__voltagent/website/actions-triggers-docs/actions/slack.md type: docs |
# Slack Actions |
Slack is where teams triage incidents and coordinate handoffs. VoltOps ships managed Slack actions |
so you can post messages, send ephemerals, react to messages, and search history without hand-writing |
Slack REST calls. |
## Prerequisites |
1. Slack app installed with a bot token that has scopes such as `chat:write`, `chat:write.public`, |
`channels:read`, `groups:read`, `im:write`, `users:read`, and `reactions:write`. Invite the bot to |
the channels you plan to use. |
2. A Volt project (free or paid) with API keys (`pk_β¦`, `sk_β¦`). |
3. A Slack credential inside Volt: **Settings β Integrations β Add Credential β Slack**, paste the |
bot token, and save. Volt returns a `cred_xxx` identifier. |
4. (Recommended) Store defaults as environment variables: |
```bash |
SLACK_CREDENTIAL_ID=cred_xxx |
SLACK_DEFAULT_CHANNEL_ID=C0123456 |
SLACK_DEFAULT_THREAD_TS=1720472000.000200 |
``` |
## Available actions |
- `slack.postMessage` β send to a channel or DM, supports blocks, attachments, link unfurls, and |
threads. |
- `slack.postEphemeral` β send an ephemeral message to a user inside a channel. |
- `slack.updateMessage` β edit an existing message via `messageTs`. |
- `slack.deleteMessage` β delete a message given `channelId` and `messageTs`. |
- `slack.getMessagePermalink` β retrieve a permalink for any message. |
- `slack.searchMessages` β search Slack messages with sort, channel filters, and limits. |
- `slack.addReaction` / `slack.removeReaction` / `slack.getReactions` β manage emoji reactions on a |
message. |
The SDK currently ships helpers for `postMessage`, `deleteMessage`, and `searchMessages`; the other |
catalog entries are available from the Volt console today and will be exposed through the SDK as |
they graduate. |
## Running Slack actions from code |
```ts |
import { VoltOpsClient } from "@voltagent/core"; |
const voltops = new VoltOpsClient({ |
publicKey: process.env.VOLTAGENT_PUBLIC_KEY!, |
secretKey: process.env.VOLTAGENT_SECRET_KEY!, |
}); |
// Post to a channel (or thread) |
await voltops.actions.slack.postMessage({ |
credential: { credentialId: process.env.SLACK_CREDENTIAL_ID! }, |
channelId: process.env.SLACK_DEFAULT_CHANNEL_ID!, |
text: "Incident resolved β
", |
threadTs: process.env.SLACK_DEFAULT_THREAD_TS ?? undefined, |
blocks: [ |
{ |
type: "section", |
text: { type: "mrkdwn", text: "*Latency* back to normal." }, |
}, |
], |
linkNames: true, |
}); |
// DM a user by Slack handle and override the credential inline |
await voltops.actions.slack.postMessage({ |
credential: { accessToken: process.env.SLACK_BOT_TOKEN! }, |
targetType: "user", |
userName: "ada", |
text: "Shipping a patch in 10 minutes.", |
}); |
// Delete a message that the bot posted |
await voltops.actions.slack.deleteMessage({ |
credential: { credentialId: process.env.SLACK_CREDENTIAL_ID! }, |
channelId: process.env.SLACK_DEFAULT_CHANNEL_ID!, |
messageTs: "1720472000.000200", |
}); |
// Search the workspace |
await voltops.actions.slack.searchMessages({ |
credential: { credentialId: process.env.SLACK_CREDENTIAL_ID! }, |
query: '"outage" in:C0123456', |
sort: "timestamp", |
limit: 5, |
}); |
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.