Skip to content
A Slack Incoming Webhook client for Google Apps Script.
TypeScript JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc/images
src
.editorconfig
.eslintignore
.eslintrc.js
.gitignore
LICENSE
README.md
package.json
yarn.lock

README.md

Slack Incoming Webhook for GAS

clasp

A Slack Incoming Webhook client for Google Apps Script.

This Libray is published as Library-ID M7LHE2p_dXNrScGShjs9Rl3IZ3Rtf7LGR.

Instalation

  1. Create or Open your GAS project.
  2. Select menu [Resource] - [Library], then Library daialog is opened.
  3. Input M7LHE2p_dXNrScGShjs9Rl3IZ3Rtf7LGR, and click Add button. Input library-id
  4. Change Identifier of this library to Slack change Identifier
  5. Click Save button.

Usage

You can use this library in your google apps script, like the following code.

Simple text

function sendMessage() {
  var url = 'https://hooks.slack.com/services/your/incoming/webhooks/url'
  var webhook = new Slack.IncomingWebhook(url);
  webhook.send('Hello World!')
}

Message with Options

function sendMessageWithOpts() {
  const message: IncomingWebhookSendArguments = {
    channel: 'general',
    icon_emoji: ':ok:',
    username: 'Webhook for GAS',
    text: 'send Message With Opts',
  };
  const webhook = new Slack.IncomingWebhook(url);
  webhook.send(message);
}

You can use other message options of Slack Incoming Webhook API. See Incoming Webhooks | Slack

Development

Requirements

  • Node.js
  • Yarn

How to setup your project

  1. Clone this ripository.
  2. Install dependencies by yarn install
  3. Create your GAS project, push code, and open web editor.
    $ yarn clasp:create 
    $ yarn clasp:push
    $ yarn clasp:open

Related Documents

LICEMSE

MIT

You can’t perform that action at this time.