メインコンテンツにスキップ

gas-slack-incoming-webhook

A Slack Incoming Webhook client for Google Apps Script.

AI Summary

Slack Incoming Webhook for GAS

A library that allows Google Apps Script to send messages to Slack Incoming Webhooks easily.

Target Users

Beginner-to-intermediate GAS developers building internal tools that need automated Slack notifications.

Problems Solved

Manually crafting HTTP requests and JSON payloads each time you post to a Slack webhook from GAS is cumbersome.

Tags

Main Features

1
One-liner message sending

Post text with `new Slack.IncomingWebhook(url).send()` and forget about manual UrlFetchApp calls.

2
Supports Slack message options

Accepts fields like `channel`, `icon_emoji`, etc., matching Slack Incoming Webhook API parameters.

3
Easy import via Library ID

Add by Library ID in the GAS editor—no external modules or build steps required.

Usage Examples

Send a simple Slack message

Copy the snippet into your GAS project, replace url with your Incoming Webhook URL and run.

function sendSimpleSlackMessage() {
  // Your Slack Incoming Webhook URL
  const url = 'https://hooks.slack.com/services/XXXX/XXXX/XXXXXXXXXXXXXXXX';
  // Create the webhook client provided by the library
  const webhook = new Slack.IncomingWebhook(url);
  // Post the message
  webhook.send('Hello from Google Apps Script!');
}

Running this function posts "Hello from Google Apps Script!" to the configured Slack channel. All HTTP details are handled inside the library.