apps-slack-web-api
Slack Web API Client for GAS(Google Apps Script)
AI Summary
Slack Web API Client for GAS (apps-slack-web-api)
A client library that enables concise calls to the Slack Web API from Google Apps Script.
Target Users
Intermediate GAS developers who want to add Slack integration to internal tools or notification bots.
Problems Solved
Eliminates the repetitive work of crafting HTTP requests and handling errors when calling the Slack Web API directly from GAS.
Tags
Main Features
Send messages in a few lines with postChatMessage
Posting to Slack requires only a token, channel ID, and text; no manual UrlFetchApp code is needed.
Supports rich messages (attachments)
Allows sending richly formatted notifications by passing an attachments option with colors and fields.
Direct access to WebClient
createWebClient exposes a method set similar to Slack's official Web API, enabling fine-grained endpoint calls.
TypeScript type definitions
Copying the provided d.ts file gives autocomplete and type checking in TypeScript projects.
Usage Examples
Send a simple Slack message
function sendSimpleSlackMessage() {
const token = 'xoxb-your-token'; // Bot or user token
const channelId = '#general'; // Target channel
const text = 'Hello from Google Apps Script!';
// Use helper to post the message
SlackWebApi.postChatMessage(token, channelId, text);
}
The helper abstracts away UrlFetchApp calls; supplying token, channel, and text is enough to post a message.