Documentation
¶
Index ¶
- func NormalizeType(typ string) string
- type DiscordPipe
- func (p *DiscordPipe) GetWebhookResponse(body []byte, header http.Header) (*WebhookResponse, error)
- func (p *DiscordPipe) ParseWebhookRequest(body []byte) (*IncomingMessage, error)
- func (p *DiscordPipe) SendMessage(chatId string, text string) error
- func (p *DiscordPipe) SetWebhook(webhookUrl string) error
- type ImmediateWebhookResponder
- type IncomingMessage
- type Pipe
- type TelegramPipe
- type WebhookResponse
- type WebhookVerifier
- type WhatsAppPipe
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeType ¶
Types ¶
type DiscordPipe ¶
type DiscordPipe struct {
// contains filtered or unexported fields
}
func NewDiscordPipe ¶
func (*DiscordPipe) GetWebhookResponse ¶
func (p *DiscordPipe) GetWebhookResponse(body []byte, header http.Header) (*WebhookResponse, error)
func (*DiscordPipe) ParseWebhookRequest ¶
func (p *DiscordPipe) ParseWebhookRequest(body []byte) (*IncomingMessage, error)
func (*DiscordPipe) SendMessage ¶
func (p *DiscordPipe) SendMessage(chatId string, text string) error
func (*DiscordPipe) SetWebhook ¶
func (p *DiscordPipe) SetWebhook(webhookUrl string) error
type ImmediateWebhookResponder ¶
type ImmediateWebhookResponder interface {
GetWebhookResponse(body []byte, header http.Header) (*WebhookResponse, error)
}
ImmediateWebhookResponder is implemented by pipes that must reply to the webhook HTTP request before processing the message (e.g. Discord interactions).
type IncomingMessage ¶
type Pipe ¶
type Pipe interface {
SendMessage(chatId string, text string) error
ParseWebhookRequest(body []byte) (*IncomingMessage, error)
SetWebhook(webhookUrl string) error
}
Pipe is the core interface every pipe platform must implement.
type TelegramPipe ¶
type TelegramPipe struct {
// contains filtered or unexported fields
}
func NewTelegramPipe ¶
func NewTelegramPipe(botToken string, httpClient *http.Client) (*TelegramPipe, error)
func (*TelegramPipe) ParseWebhookRequest ¶
func (p *TelegramPipe) ParseWebhookRequest(body []byte) (*IncomingMessage, error)
func (*TelegramPipe) SendMessage ¶
func (p *TelegramPipe) SendMessage(chatId string, text string) error
func (*TelegramPipe) SetWebhook ¶
func (p *TelegramPipe) SetWebhook(webhookUrl string) error
type WebhookResponse ¶
type WebhookVerifier ¶
type WebhookVerifier interface {
VerifyWebhook(params map[string]string) (*WebhookResponse, error)
}
WebhookVerifier is implemented by pipes that verify webhook ownership via a GET request challenge (e.g. WhatsApp Cloud API hub.challenge handshake).
type WhatsAppPipe ¶
type WhatsAppPipe struct {
// contains filtered or unexported fields
}
func NewWhatsAppPipe ¶
func (*WhatsAppPipe) ParseWebhookRequest ¶
func (p *WhatsAppPipe) ParseWebhookRequest(body []byte) (*IncomingMessage, error)
func (*WhatsAppPipe) SendMessage ¶
func (p *WhatsAppPipe) SendMessage(chatId string, text string) error
func (*WhatsAppPipe) SetWebhook ¶
func (p *WhatsAppPipe) SetWebhook(webhookUrl string) error
SetWebhook returns nil because WhatsApp webhooks are configured manually in the Meta Developer Console. The caller displays the webhook URL to the user.
func (*WhatsAppPipe) VerifyWebhook ¶
func (p *WhatsAppPipe) VerifyWebhook(params map[string]string) (*WebhookResponse, error)
VerifyWebhook handles the Meta webhook verification challenge (GET request). The verify token is the pipe name, which must match what is configured in the Meta Developer Console as the webhook verify token.