0.1.2 • Published 2 years ago

@cfpreview/pages-plugins-google-chat v0.1.2

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Pages Plugins

TODO WIP! Google Chat

This plugin creates a Google Chat bot which can respond to messages. It also includes an API for interacting with Google Chat (e.g. for creating messages) without the invocation having to be a response to an incoming message. This API is useful for situations where you want no user input e.g. alerts.

Installation

npm install --save @cfpreview/pages-plugins-google-chat

Usage

// ./functions/google-chat.ts

import googleChatPlugin from "@cfpreview/pages-plugins-google-chat";

export const onRequest: PagesFunction = googleChatPlugin(async (message) => {
  if (message.text.includes("ping")) {
    return { text: "pong" };
  }

  return { text: "Sorry, I could not understand your message." };
});

The plugin takes a function, which in turn takes an incoming message and returns a Promise of a response message (or void if there should not be any response).

The plugin only exposes a single route, which is the URL you should set in the Google Cloud Console when creating the bot.

TODO: Screenshot of settings

API

TODO

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago