Documentation ¶
Index ¶
- Constants
- func NewVericationHandler(token string) web.Handler
- func NewWebhookHandler(hook Webhook) web.Handler
- type AccountLinking
- type AccountStatus
- type Coordinates
- type GenericTemplatePayload
- type GenericTemplatePayloadElement
- type ReceivedAttachment
- type ReceivedAttachmentPayload
- type ReceivedMessage
- type ReceivedMessageContent
- type ReceivedQuickReply
- type Recipient
- type SendAttachment
- type SendMessage
- type SendMessageContent
- type SendPayload
- type SendQuickReply
- type SendResponse
- type Sender
- type URLButton
- type Webhook
- type WebhookFunc
Constants ¶
const ()
Constants for URLButton.WebviewShareButton fields
const MaxWebhookPayloadSize = 1024 * 1024 * 512
MaxWebhookPayloadSize is a maximum size of payload (512KB) in a single webhook call
Variables ¶
This section is empty.
Functions ¶
func NewVericationHandler ¶
func NewWebhookHandler ¶
NewWebhookHandler return s new web.Handler to handle webhook request
Types ¶
type AccountLinking ¶
type AccountLinking struct { Status AccountStatus `json:"status"` AuthorizationCode string `json:"authorization_code"` }
type AccountStatus ¶
type AccountStatus string
AccountStatus is a enum type for account linking status.
const ( AccountStatusLinked AccountStatus = "linked" AccountStatusUnlinked AccountStatus = "unlinked" )
AccountStatus constants
type Coordinates ¶
type GenericTemplatePayload ¶
type GenericTemplatePayload struct { TemplateType string `json:"template_type"` Elements []*GenericTemplatePayloadElement `json:"elements,omitempty"` }
GenericTemplatePayload
type ReceivedAttachment ¶
type ReceivedAttachment struct { Type string `json:"type"` Payload *ReceivedAttachmentPayload `json:"payload"` }
type ReceivedAttachmentPayload ¶
type ReceivedAttachmentPayload struct { URL string `json:"url"` Coordinates *Coordinates `json:"coordinates"` }
type ReceivedMessage ¶
type ReceivedMessageContent ¶
type ReceivedMessageContent struct { MID string `json:"mid"` Seq int `json:"seq"` Text string `json:"text"` QuickReply *ReceivedQuickReply `json:"quick_reply"` Attachments []ReceivedAttachment `json:"attachments"` }
type ReceivedQuickReply ¶
type ReceivedQuickReply struct {
Payload string `json:"payload"`
}
type Recipient ¶
type Recipient struct { ID string `json:"id,omitempty"` PhoneNumber string `json:"phone_number,omitempty"` Name string `json:"name,omitempty"` }
Recipient is a structure to specify a recipent in Send API
type SendAttachment ¶
type SendAttachment struct { Type string `json:"type"` Payload interface{} `json:"payload"` }
SendAttachment is an attachment structure for Send API
type SendMessage ¶
type SendMessage struct { Recipient *Recipient `json:"recipient"` Message *SendMessageContent `json:"message"` }
SendMessage is a message structure for Send API
type SendMessageContent ¶
type SendMessageContent struct { Text string `json:"text,omitempty"` QuickReply []SendQuickReply `json:"quick_reply,omitempty"` Attachment *SendAttachment `json:"attachment,omitempty"` Metadata string `json:"metadata,omitempty"` }
SendMessageContent is a content structure in SendMessage
type SendPayload ¶
type SendPayload struct { URL string `json:url"` IsReusable string `json:"is_reusable"` AttachementID string `json:"attachment_id"` }
SendPayload is a payload structure for Send AP{
type SendQuickReply ¶
type SendQuickReply struct { ContentType string `json:"content_type"` Title string `json:"title"` Payload string `json:"payload"` ImageURL string `json:"image_url"` }
SendQuickReply is a quick reply structure for Send API
type SendResponse ¶
type SendResponse struct { RecipientID string `json:"recipient_id"` MessageID string `json:"message_dd"` }
SendResponse is a response structure for Send API
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender is a struct to send messages
func (*Sender) Send ¶
func (s *Sender) Send(ctx context.Context, msg *SendMessage) (*SendResponse, error)
Send sends a message
type URLButton ¶
type URLButton struct { Type string `json:"type"` Title string `json:"title,omitempty"` URL string `json:"url"` WebviewHeightRatio string `json:"webview_height_ratio,omitempty"` MessengerExtentions bool `json:"messenger_extentions,omitempty"` FallbackURL string `json:"fallback_url,omitempty"` }
URLButton is for url button structure described at https://developers.facebook.com/docs/messenger-platform/send-api-reference/url-button
type Webhook ¶
type Webhook interface {
Process(context.Context, *ReceivedMessage) error
}
Webhook is an interface to process messenger message in webhook
type WebhookFunc ¶
type WebhookFunc func(context.Context, *ReceivedMessage) error
WebhookFunc is a simple interface generator for a webhook function
func (WebhookFunc) Process ¶
func (f WebhookFunc) Process(ctx context.Context, messages *ReceivedMessage) error
Process implements Webhook#Process