Loading...
Loading...
Work with Slack through the Slack Web API using Bun and the SLACK_BOT_TOKEN environment variable.
npx skill4agent add superwall/agent-skills slackSLACK_BOT_TOKENSLACK_BOT_TOKENfetchAuthorization: Bearer ${process.env.SLACK_BOT_TOKEN}Content-Type: application/json; charset=utf-8okerrorconst token = process.env.SLACK_BOT_TOKEN;
if (!token) {
throw new Error(
"SLACK_BOT_TOKEN is not set. Set up Slack at https://superwall.ai/integrations."
);
}
async function slack(method: string, body: Record<string, unknown> = {}) {
const response = await fetch(`https://slack.com/api/${method}`, {
method: "POST",
headers: {
authorization: `Bearer ${token}`,
"content-type": "application/json; charset=utf-8",
},
body: JSON.stringify(body),
});
const data = await response.json();
if (!response.ok || !data.ok) {
throw new Error(`${method} failed: ${data.error ?? response.statusText}`);
}
return data;
}response_metadata.next_cursornext_cursor{
"scopes": {
"bot": [
"app_mentions:read",
"channels:read",
"channels:history",
"chat:write",
"chat:write.public",
"files:write",
"files:read",
"team:read",
"users:read",
"groups:history"
]
}
}auth.testconversations.listconversations.historychat.postMessageusers.listusers.infoteam.infofiles.uploadV2files.info