googlechat

package
v0.56.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package googlechat is the gateway's Google Chat adapter. A Chat app is configured in the Google Cloud console with an HTTP endpoint URL; inbound events arrive as POSTs carrying a Google-signed bearer JWT (issuer chat@system.gserviceaccount.com) whose audience is the app's project number, and outbound replies go to the Chat REST API (spaces.messages.create) authenticated as a service account. Credentials: GOOGLE_CHAT_SA_KEY holds the path to the service-account JSON key and googlechat.audience (the project number) lives in gateway.yaml; the caller reads the key file and hands the bytes to New — this package never reads the environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	// contains filtered or unexported fields
}

Channel is a Google Chat app connection: webhook in, REST out.

func New

func New(saKeyJSON []byte, audience, mediaDir string) *Channel

New builds a Google Chat channel from the service-account key JSON, the expected JWT audience (the app's project number), and the gateway media spool directory ("" disables attachment downloads).

func (*Channel) Handler

func (c *Channel) Handler(sink channels.Sink) http.Handler

Handler returns the webhook HTTP handler. Chat expects a synchronous JSON response; we always reply asynchronously through the REST API, so a handled event returns 200 with body {} (an empty object means "no synchronous message"). A Deliver failure returns 503 so Google redelivers.

func (*Channel) Name

func (c *Channel) Name() string

Name returns the adapter identifier.

func (*Channel) Send

func (c *Channel) Send(ctx context.Context, conversation string, msg channels.Outbound) error

Send posts a text reply to a conversation (a spaces/<id> name) through the Chat REST API, split with the shared chunker.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL