webhook

package module
v0.0.0-...-543d71b Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 19 Imported by: 0

README

How to use

API有効化

gcloud services enable secretmanager.googleapis.com --project YOUR_PROJECT

サービスアカウントに権限追加

gcloud projects add-iam-policy-binding YOUR_PROJECT --member serviceAccount:YOUR_PROJECT@appspot.gserviceaccount.com --role roles/secretmanager.secretAccessor

デプロイ

gcloud functions deploy notify
--trigger-http
--allow-unauthenticated
--runtime go120
--env-vars-file env.yaml
--region asia-northeast1
--project YOUR_PROJECT

Documentation

Index

Constants

View Source
const MessageURLPattern = "https://www.worksapis.com/v1.0/bots/%s/channels/%s/messages"
View Source
const TokenURL = "https://auth.worksmobile.com/oauth2/v2.0/token"

Variables

This section is empty.

Functions

func GetSecret

func GetSecret(projectID, secretName string) ([]byte, error)

Types

type Firestore

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

func NewFirestore

func NewFirestore(fsClient *firestore.Client) *Firestore

func (*Firestore) LoadAccessToken

func (f *Firestore) LoadAccessToken(ctx context.Context, collectionID string) (string, error)

func (*Firestore) SaveAccessToken

func (f *Firestore) SaveAccessToken(ctx context.Context, collectionID string, token string) error

type LineWorksAccessToken

type LineWorksAccessToken struct {
	AccessToken string    `json:"access_token"`
	CreatedAt   time.Time `json:"created_at"`
}

type LineWorksBot

type LineWorksBot struct {
	BotID          string
	ClientID       string
	ClientSecret   string
	ServiceAccount string
	PrivateKey     []byte
}

func NewLineWorksBot

func NewLineWorksBot(botID, clientID, clientSecret, serviceAccount string, privateKey []byte) *LineWorksBot

func (*LineWorksBot) GenerateAccessToken

func (bot *LineWorksBot) GenerateAccessToken() (string, error)

func (*LineWorksBot) SendTextMessage

func (bot *LineWorksBot) SendTextMessage(token, channelID, text string) error

type TextContent

type TextContent struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

type TextMessage

type TextMessage struct {
	Content TextContent `json:"content"`
}

type TokenResponse

type TokenResponse struct {
	ErrorMessage string `json:"message"`
	ErrorCode    string `json:"code"`
	ErrorDetail  string `json:"detail"`
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    string `json:"expires_in"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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