Documentation
¶
Index ¶
- Constants
- Variables
- type APIError
- type Attachment
- type AttachmentPayload
- type Button
- type ButtonType
- type CallButton
- type Client
- func (c *Client) DeleteIceBreakers(ctx context.Context) (*DeleteIceBreakersResponse, error)
- func (c *Client) GetIceBreakers(ctx context.Context) (*GetIceBreakersResponse, error)
- func (c *Client) GetUserProfile(ctx context.Context, instagramUserID string) (*GetUserProfileResponse, error)
- func (c *Client) SendMessage(ctx context.Context, recipient string, message Message) (*SendMessageResponse, error)
- func (c *Client) SetIceBreakers(ctx context.Context, iceBreakers []*IceBreaker) (*SetIceBreakersResponse, error)
- type ClientOption
- type DeleteIceBreakersResponse
- type Entry
- type ErrorResponse
- type GenericTemplateElement
- type GenericTemplateElementOption
- type GenericTemplateMessage
- type GetIceBreakersResponse
- type GetUserProfileResponse
- type IceBreaker
- type IceBreakers
- type ImageMessage
- type InstaBot
- type LogInButton
- type LogOutButton
- type MediaMessageEvent
- type MediaShareMessage
- type Message
- type MessageDeleteEvent
- type MessageReactionEvent
- type MessageReplyEvent
- type MessageSeenEvent
- type MessageShareEvent
- type MessageType
- type Messaging
- func (m *Messaging) GetMediaMessageEvent() *MediaMessageEvent
- func (m *Messaging) GetMessageDeleteEvent() *MessageDeleteEvent
- func (m *Messaging) GetMessageReactionEvent() *MessageReactionEvent
- func (m *Messaging) GetMessageReplyEvent() *MessageReplyEvent
- func (m *Messaging) GetMessageSeenEvent() *MessageSeenEvent
- func (m *Messaging) GetMessageShareEvent() *MessageShareEvent
- func (m *Messaging) GetPostBackEvent() *PostBackEvent
- func (m *Messaging) GetQuickReplyEvent() *QuickReplyEvent
- func (m *Messaging) GetStoryMentionEvent() *StoryMentionEvent
- func (m *Messaging) GetStoryReplyEvent() *StoryReplyEvent
- func (m *Messaging) GetTextMessageEvent() *TextMessageEvent
- type PostBackButton
- type PostBackEvent
- type Postback
- type ProductTemplateElement
- type ProductTemplateMessage
- type QuickReply
- type QuickReplyEvent
- type QuickReplyType
- type Reaction
- type Read
- type Recipient
- type Referral
- type ReferralProduct
- type ReplyTo
- type ReplyToStory
- type SendMessageResponse
- type Sender
- type SetIceBreakersResponse
- type StickerMessage
- type StickerType
- type StoryMentionEvent
- type StoryReplyEvent
- type Template
- type TemplateDefaultAction
- type TemplateType
- type TextMessage
- type TextMessageEvent
- type TextMessageOption
- type URLButton
- type WebhookEvent
- type WebhookEventType
- type WebhookMessage
- type WebhookQuickReply
Constants ¶
const ( Platform string = "instagram" APIVersion string = "v11.0" )
instabot const values.
Variables ¶
var ( APIEndpointBase = "https://graph.facebook.com" APIEndpointSendMessage = fmt.Sprintf("/%s/me/messages", APIVersion) APIEndpointMessengerProfile = fmt.Sprintf("/%s/me/messenger_profile", APIVersion) GetAPIEndpointUserProfile = func(instagramUserID string) string { return fmt.Sprintf("/%s/%s", APIVersion, instagramUserID) } )
instagram messaging api endpoints.
var ( // ErrMissingPageAccessToken happens when instantiating instabot // with empty page access token. ErrMissingPageAccessToken = errors.New("missing page access token") )
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Message string `json:"message"`
Type string `json:"type"`
Code int32 `json:"code"`
SubCode int32 `json:"error_subcode"`
FbTraceID string `json:"fbtrace_id"`
}
APIError defines error received from the api.
type Attachment ¶
type Attachment struct {
Type string `json:"type"`
Payload AttachmentPayload `json:"payload"`
}
Attachment defines attachment for different type like audio, video, media share, etc.
type AttachmentPayload ¶
type AttachmentPayload struct {
URL string `json:"url"`
}
AttachmentPayload defines different attachment payload.
type ButtonType ¶
type ButtonType string
ButtonType defines button type.
const ( ButtonTypeURL ButtonType = ButtonType("web_url") ButtonTypePostBack ButtonType = ButtonType("postback") ButtonTypeCall ButtonType = ButtonType("phone_number") ButtonTypeLogin ButtonType = ButtonType("account_link") ButtonTypeLogOut ButtonType = ButtonType("account_unlink") ButtonTypeGamePlay ButtonType = ButtonType("game_play") )
all button type. https://developers.facebook.com/docs/messenger-platform/send-messages/buttons
type CallButton ¶
type CallButton struct {
Title string
PhoneNumber string
// contains filtered or unexported fields
}
CallButton defines call button. https://developers.facebook.com/docs/messenger-platform/send-messages/buttons#call
func NewCallButton ¶
func NewCallButton(title string, PhoneNumber string) *CallButton
NewCallButton returns a new call button.
func (*CallButton) MarshalJSON ¶
func (b *CallButton) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the button.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client defines instabot.
func New ¶
func New(pageAccessToken string, options ...ClientOption) (*Client, error)
New returns a new bot client instance.
func (*Client) DeleteIceBreakers ¶
func (c *Client) DeleteIceBreakers(ctx context.Context) (*DeleteIceBreakersResponse, error)
DeleteIceBreakers deletes ice breakers. https://developers.facebook.com/docs/messenger-platform/instagram/features/ice-breakers#deleting-icebreakers
func (*Client) GetIceBreakers ¶
func (c *Client) GetIceBreakers(ctx context.Context) (*GetIceBreakersResponse, error)
GetIceBreakers fetches ice breakers. https://developers.facebook.com/docs/messenger-platform/instagram/features/ice-breakers#getting-ice-breakers
func (*Client) GetUserProfile ¶
func (c *Client) GetUserProfile(ctx context.Context, instagramUserID string) (*GetUserProfileResponse, error)
GetUserProfile fetches user profile by instagram user id. https://developers.facebook.com/docs/messenger-platform/instagram/features/user-profile#user-profile-api
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, recipient string, message Message) (*SendMessageResponse, error)
SendMessage sends message by calling instagram api. https://developers.facebook.com/docs/messenger-platform/instagram/features/send-message#send-api
func (*Client) SetIceBreakers ¶
func (c *Client) SetIceBreakers(ctx context.Context, iceBreakers []*IceBreaker) (*SetIceBreakersResponse, error)
SetIceBreakers sets a instagram account ice breakers. https://developers.facebook.com/docs/messenger-platform/instagram/features/ice-breakers#setting-ice-breakers
type ClientOption ¶
ClientOption defines optional argument for new client construction.
func WithEndpointBase ¶
func WithEndpointBase(endpointBase string) ClientOption
WithEndpointBase sets client base endpoint.
func WithHTTPClient ¶
func WithHTTPClient(c *http.Client) ClientOption
WithHTTPClient sets client http client.
type DeleteIceBreakersResponse ¶
type DeleteIceBreakersResponse struct {
Result string `json:"result"`
}
DeleteIceBreakersResponse defines delete ice breaker api success response.
type Entry ¶
type Entry struct {
ID string `json:"id"`
Time int64 `json:"time"`
Messaging []*Messaging `json:"messaging"`
}
Entry defines entry.
type ErrorResponse ¶
type ErrorResponse struct {
StatusCode int `json:"status_code,omitempty"`
APIError APIError `json:"error"`
}
ErrorResponse defines error response received from instagram api.
type GenericTemplateElement ¶
type GenericTemplateElement struct {
Title string
Subtitle string
ImageURL string
DefaultAction *TemplateDefaultAction
Buttons []Button
}
GenericTemplateElement defines generic template element. https://developers.facebook.com/docs/messenger-platform/instagram/features/generic-template#elements
func NewGenericTemplateElement ¶
func NewGenericTemplateElement(title string, opts ...GenericTemplateElementOption) *GenericTemplateElement
NewGenericTemplateElement returns new GenericTemplateElement.
func (*GenericTemplateElement) MarshalJSON ¶
func (e *GenericTemplateElement) MarshalJSON() ([]byte, error)
MarshalJSON marshal generic template element to JSON.
type GenericTemplateElementOption ¶
type GenericTemplateElementOption func(*GenericTemplateElement)
GenericTemplateElementOption defines new GenericTemplateElement instantiation optional argument.
func WithTemplateButtons ¶
func WithTemplateButtons(buttons []Button) GenericTemplateElementOption
WithTemplateButtons sets buttons of a GenericTemplateElement, a maximum of 3 buttons per element is supported.
func WithTemplateDefaultAction ¶
func WithTemplateDefaultAction(URL string) GenericTemplateElementOption
WithTemplateDefaultAction sets default action of a GenericTemplateElement.
func WithTemplateImageURL ¶
func WithTemplateImageURL(imageURL string) GenericTemplateElementOption
WithTemplateImageURL sets image url of a GenericTemplateElement.
func WithTemplateSubtitle ¶
func WithTemplateSubtitle(subtitle string) GenericTemplateElementOption
WithTemplateSubtitle sets subtitle of a GenericTemplateElement.
type GenericTemplateMessage ¶
type GenericTemplateMessage struct {
Elements []*GenericTemplateElement
// contains filtered or unexported fields
}
GenericTemplateMessage defines generic template message. A generic template message could have maximum of 10 elements.
func NewGenericTemplateMessage ¶
func NewGenericTemplateMessage(elements []*GenericTemplateElement) *GenericTemplateMessage
NewGenericTemplateMessage returns generic template element. A generic template message could have maximum of 10 elements.
func (*GenericTemplateMessage) MarshalJSON ¶
func (m *GenericTemplateMessage) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the message.
func (*GenericTemplateMessage) TemplateType ¶
func (m *GenericTemplateMessage) TemplateType() TemplateType
TemplateType returns template type.
func (*GenericTemplateMessage) Type ¶
func (m *GenericTemplateMessage) Type() MessageType
Type returns message type.
type GetIceBreakersResponse ¶
type GetIceBreakersResponse struct {
Data []IceBreakers `json:"data"`
}
GetIceBreakersResponse defines get ice breaker api success response.
type GetUserProfileResponse ¶
type GetUserProfileResponse struct {
ID string `json:"id"`
Name string `json:"name"`
ProfilePic string `json:"profile_pic"`
}
GetUserProfileResponse defines instagram get user profile response.
type IceBreaker ¶
IceBreaker defines Ice Breaker. frequently asked question. https://developers.facebook.com/docs/messenger-platform/instagram/features/ice-breakers
func NewIceBreaker ¶
func NewIceBreaker(question string, payload string) *IceBreaker
NewIceBreaker returns a ice breaker.
func (*IceBreaker) MarshalJSON ¶
func (i *IceBreaker) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the ice breaker.
type IceBreakers ¶
type IceBreakers struct {
IceBreakers []IceBreaker `json:"ice_breakers"`
}
IceBreakers holds list of ice breakers.
type ImageMessage ¶
type ImageMessage struct {
ImageURL string
// contains filtered or unexported fields
}
ImageMessage defines image message.
func NewImageMessage ¶
func NewImageMessage(imageURL string) *ImageMessage
NewImageMessage returns a new image message.
func (*ImageMessage) MarshalJSON ¶
func (m *ImageMessage) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the message.
type InstaBot ¶
type InstaBot interface {
SendMessage(ctx context.Context, recipient string, message Message) (*SendMessageResponse, error)
SetIceBreakers(ctx context.Context, iceBreakers []*IceBreaker) (*SetIceBreakersResponse, error)
GetIceBreakers(ctx context.Context) (*GetIceBreakersResponse, error)
DeleteIceBreakers(ctx context.Context) (*DeleteIceBreakersResponse, error)
GetUserProfile(ctx context.Context, instagramUserID string) (*GetUserProfileResponse, error)
}
InstaBot defines InstaBot client interface.
type LogInButton ¶
type LogInButton struct {
URL string
// contains filtered or unexported fields
}
LogInButton defines log in button. https://developers.facebook.com/docs/messenger-platform/send-messages/buttons#login
func NewLogInButton ¶
func NewLogInButton(URL string) *LogInButton
NewLogInButton returns a new log in button.
func (*LogInButton) MarshalJSON ¶
func (b *LogInButton) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the button.
type LogOutButton ¶
type LogOutButton struct {
// contains filtered or unexported fields
}
LogOutButton defines log out button. https://developers.facebook.com/docs/messenger-platform/send-messages/buttons#logout
func NewLogOutButton ¶
func NewLogOutButton() *LogOutButton
NewLogOutButton returns a new log out button.
func (*LogOutButton) MarshalJSON ¶
func (b *LogOutButton) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the button.
type MediaMessageEvent ¶
type MediaMessageEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
MID string
Type WebhookEventType
Media *AttachmentPayload
}
MediaMessageEvent defines flatten media message event.
type MediaShareMessage ¶
type MediaShareMessage struct {
// contains filtered or unexported fields
}
MediaShareMessage defines media share message.
func NewMediaShareMessage ¶
func NewMediaShareMessage(mediaID string) *MediaShareMessage
NewMediaShareMessage returns new media share message.
func (*MediaShareMessage) MarshalJSON ¶
func (m *MediaShareMessage) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the message.
func (*MediaShareMessage) Type ¶
func (m *MediaShareMessage) Type() MessageType
Type returns message type.
type MessageDeleteEvent ¶
type MessageDeleteEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
DeletedMID string
}
MessageDeleteEvent defines message delete events.
type MessageReactionEvent ¶
type MessageReactionEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
Reaction *Reaction
}
MessageReactionEvent defines flatten message react event.
type MessageReplyEvent ¶
type MessageReplyEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
MID string
Text string
ReplyToMID string
}
MessageReplyEvent defines flatten message reply event.
type MessageSeenEvent ¶
type MessageSeenEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
SeenMID string
}
MessageSeenEvent defines message seen event.
type MessageShareEvent ¶
type MessageShareEvent struct {
}
MessageShareEvent defines message share events.
type MessageType ¶
type MessageType string
MessageType defines instagram message type.
const ( MessageTypeText MessageType = MessageType("text") MessageTypeImage MessageType = MessageType("image") MessageTypeSticker MessageType = MessageType("sticker") MessageTypeReacton MessageType = MessageType("reaction") MessageTypeTemplate MessageType = MessageType("template") )
all message type. https://developers.facebook.com/docs/messenger-platform/instagram/features/send-message#supported-messages
type Messaging ¶
type Messaging struct {
Type WebhookEventType
Sender *Sender `json:"sender"`
Recipient *Recipient `json:"recipient"`
Timestamp int64 `json:"timestamp"`
Message *WebhookMessage `json:"message"`
Read *Read `json:"read"`
Reaction *Reaction `json:"reaction"`
Referral *Referral `json:"referral"`
PostBack *Postback `json:"postback"`
}
Messaging defines events.
func (*Messaging) GetMediaMessageEvent ¶
func (m *Messaging) GetMediaMessageEvent() *MediaMessageEvent
GetMediaMessageEvent returns media (image, audio, video, file) message event. Call this only when the event type is one of WebhookEventTypeImageMessage, WebhookEventTypeAudioeMessage, WebhookEventTypeVideoMessage or WebhookEventTypeFileMessage.
func (*Messaging) GetMessageDeleteEvent ¶
func (m *Messaging) GetMessageDeleteEvent() *MessageDeleteEvent
GetMessageDeleteEvent returns message delete event. Call this only when the event type is WebhookEventTypeDeleted.
func (*Messaging) GetMessageReactionEvent ¶
func (m *Messaging) GetMessageReactionEvent() *MessageReactionEvent
GetMessageReactionEvent returns message reaction event. Call this only when the event type is WebhookEventTypeReaction.
func (*Messaging) GetMessageReplyEvent ¶
func (m *Messaging) GetMessageReplyEvent() *MessageReplyEvent
GetMessageReplyEvent returns message reply event. Call this only when the event type is WebhookEventTypeMessageReply.
func (*Messaging) GetMessageSeenEvent ¶
func (m *Messaging) GetMessageSeenEvent() *MessageSeenEvent
GetMessageSeenEvent returns message seen event. Call this only when the event type is WebhookEventTypeMessageSeen.
func (*Messaging) GetMessageShareEvent ¶
func (m *Messaging) GetMessageShareEvent() *MessageShareEvent
GetMessageShareEvent returns message share event. Call this only when the event type is WebhookEventTypeShare.
func (*Messaging) GetPostBackEvent ¶
func (m *Messaging) GetPostBackEvent() *PostBackEvent
GetPostBackEvent returns postback event. Call this only when the event type is WebhookEventTypePostBack.
func (*Messaging) GetQuickReplyEvent ¶
func (m *Messaging) GetQuickReplyEvent() *QuickReplyEvent
GetQuickReplyEvent returns quick reply event. Call this only when the event type is WebhookEventTypeQuickReply.
func (*Messaging) GetStoryMentionEvent ¶
func (m *Messaging) GetStoryMentionEvent() *StoryMentionEvent
GetStoryMentionEvent returns story mention event. Call this only when the event type is WebhookEventTypeStoryMention.
func (*Messaging) GetStoryReplyEvent ¶
func (m *Messaging) GetStoryReplyEvent() *StoryReplyEvent
GetStoryReplyEvent returns story reply event. Call this only when the event type is WebhookEventTypeStoryReply.
func (*Messaging) GetTextMessageEvent ¶
func (m *Messaging) GetTextMessageEvent() *TextMessageEvent
GetTextMessageEvent returns text message event. Call this only when the event type is WebhookEventTypeTextMessage.
type PostBackButton ¶
type PostBackButton struct {
Title string
Payload string
// contains filtered or unexported fields
}
PostBackButton defines post back button. https://developers.facebook.com/docs/messenger-platform/send-messages/buttons#postback
func NewPostBackButton ¶
func NewPostBackButton(title string, payload string) *PostBackButton
NewPostBackButton returns a new post back button.
func (*PostBackButton) MarshalJSON ¶
func (b *PostBackButton) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the button.
type PostBackEvent ¶
type PostBackEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
Data *Postback
}
PostBackEvent defines flatten data for postback event.
type Postback ¶
type Postback struct {
MID string `json:"mid"`
Title string `json:"title"`
Payload string `json:"payload"`
}
Postback defines postback.
type ProductTemplateElement ¶
type ProductTemplateElement struct {
ProductID string
}
ProductTemplateElement defines product template element. https://developers.facebook.com/docs/messenger-platform/send-messages/template/product
func NewProductTemplateElement ¶
func NewProductTemplateElement(productID string) *ProductTemplateElement
NewProductTemplateElement returns a new product template element.
func (*ProductTemplateElement) MarshalJSON ¶
func (e *ProductTemplateElement) MarshalJSON() ([]byte, error)
MarshalJSON marshal product template element to JSON.
type ProductTemplateMessage ¶
type ProductTemplateMessage struct {
Elements []*ProductTemplateElement
// contains filtered or unexported fields
}
ProductTemplateMessage defines product template message. A product template message could have maximum of 10 elements.
func NewProductTemplateMessage ¶
func NewProductTemplateMessage(elements []*ProductTemplateElement) *ProductTemplateMessage
NewProductTemplateMessage returns product template element. A product template message could have maximum of 10 elements.
func (*ProductTemplateMessage) MarshalJSON ¶
func (m *ProductTemplateMessage) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the message.
func (*ProductTemplateMessage) TemplateType ¶
func (m *ProductTemplateMessage) TemplateType() TemplateType
TemplateType returns template type.
func (*ProductTemplateMessage) Type ¶
func (m *ProductTemplateMessage) Type() MessageType
Type returns message type.
type QuickReply ¶
QuickReply defines quick reply. quick reply is only supported for text message on instagram platform. https://developers.facebook.com/docs/messenger-platform/instagram/features/quick-replies
func NewTextQuickReply ¶
func NewTextQuickReply(title string, payload string) *QuickReply
NewTextQuickReply returns Text type quick reply.
func (*QuickReply) MarshalJSON ¶
func (q *QuickReply) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the quick reply item.
type QuickReplyEvent ¶
type QuickReplyEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
MID string
Text string
Data *WebhookQuickReply
}
QuickReplyEvent defines flatten quick reply event data.
type QuickReplyType ¶
type QuickReplyType string
QuickReplyType defines quick reply content type.
const (
QuickReplyTypeText QuickReplyType = QuickReplyType("text")
)
all quick reply content type. Only text type quick reply is supported for instagram.
type Reaction ¶
type Reaction struct {
MID string `json:"mid"`
Action string `json:"action"`
Reaction string `json:"reaction"`
Emoji string `json:"emoji"`
}
Reaction defines reaction.
type Recipient ¶
type Recipient struct {
ID string `json:"id"`
}
Recipient defines instagram user with instagram_user_id. Recipient of a message or action.
type Referral ¶
type Referral struct {
Product ReferralProduct `json:"product"`
}
Referral holds product referral. TODO: integrate later
type ReferralProduct ¶
type ReferralProduct struct {
ID string `json:"id"`
}
ReferralProduct defines fb/instagram shop product.
type ReplyTo ¶
type ReplyTo struct {
MID string `json:"mid"`
Story *ReplyToStory `json:"story"`
}
ReplyTo defines either reply to message or story.
type ReplyToStory ¶
ReplyToStory defines story details.
type SendMessageResponse ¶
type SendMessageResponse struct {
RecipientID string `json:"recipient_id"`
MessageID string `json:"message_id"`
}
SendMessageResponse send message api success response.
type Sender ¶
type Sender struct {
ID string `json:"id"`
}
Sender defines instagram user with instagram_user_id. Sender of a message or action.
type SetIceBreakersResponse ¶
type SetIceBreakersResponse struct {
Result string `json:"result"`
}
SetIceBreakersResponse defines set ice breaker api success response.
type StickerMessage ¶
type StickerMessage struct {
Sticker StickerType
// contains filtered or unexported fields
}
StickerMessage defines sticker message.
func NewStickerMessage ¶
func NewStickerMessage(sticker StickerType) *StickerMessage
NewStickerMessage returns sticker message.
func (*StickerMessage) MarshalJSON ¶
func (m *StickerMessage) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the message.
func (*StickerMessage) Type ¶
func (m *StickerMessage) Type() MessageType
Type returns message type.
type StickerType ¶
type StickerType string
StickerType defines sticker type.
const (
StickerTypeHeart StickerType = StickerType("like_heart")
)
all sticker type.
type StoryMentionEvent ¶
type StoryMentionEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
MID string
Story *ReplyToStory
}
StoryMentionEvent defines flatten story mention event.
type StoryReplyEvent ¶
type StoryReplyEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
MID string
Text string
Story *ReplyToStory
}
StoryReplyEvent defines flatten story reply event.
type TemplateDefaultAction ¶
type TemplateDefaultAction struct {
URL string
// contains filtered or unexported fields
}
TemplateDefaultAction template default action.
func NewTemplateDefaultAction ¶
func NewTemplateDefaultAction(URL string) *TemplateDefaultAction
NewTemplateDefaultAction returns new TemplateDefaultAction.
func (*TemplateDefaultAction) MarshalJSON ¶
func (d *TemplateDefaultAction) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the button.
type TemplateType ¶
type TemplateType string
TemplateType defines available template type.
const ( TemplateTypeProduct TemplateType = TemplateType("product") TemplateTypeGeneric TemplateType = TemplateType("generic") )
all template type. generic, product template are available on instagram.
type TextMessage ¶
type TextMessage struct {
Text string
// contains filtered or unexported fields
}
TextMessage defines text message.
func NewTextMessage ¶
func NewTextMessage(text string, options ...TextMessageOption) *TextMessage
NewTextMessage returns a new text message.
func (*TextMessage) AttachQuickReplies ¶
func (m *TextMessage) AttachQuickReplies(quickReplies []*QuickReply)
AttachQuickReplies attach quick reply items to text message
func (*TextMessage) MarshalJSON ¶
func (m *TextMessage) MarshalJSON() ([]byte, error)
MarshalJSON returns json of the message.
type TextMessageEvent ¶
type TextMessageEvent struct {
Sender *Sender
Recipient *Recipient
Timestamp time.Time
MID string
Text string
}
TextMessageEvent defines flatten text message event.
type TextMessageOption ¶
type TextMessageOption func(*TextMessage)
TextMessageOption defines optional argument for new text message construction.
func WithQuickReplies ¶
func WithQuickReplies(quickReplyItems []*QuickReply) TextMessageOption
WithQuickReplies adds quick reply items to text message. Quick reply is only supported with text message.
type URLButton ¶
URLButton defines URL button. https://developers.facebook.com/docs/messenger-platform/send-messages/buttons#url
func NewURLButton ¶
NewURLButton returns a new url button.
func (*URLButton) MarshalJSON ¶
MarshalJSON returns json of the button.
type WebhookEvent ¶
WebhookEvent defines instagram webhook event payload.
func (*WebhookEvent) UnmarshalJSON ¶
func (e *WebhookEvent) UnmarshalJSON(buffer []byte) error
UnmarshalJSON unmarshal json webhook events.
type WebhookEventType ¶
type WebhookEventType string
WebhookEventType defines webhook event type.
const ( WebhookEventTypeTextMessage WebhookEventType = WebhookEventType("text") WebhookEventTypeImageMessage WebhookEventType = WebhookEventType("image") WebhookEventTypeAudioMessage WebhookEventType = WebhookEventType("audio") WebhookEventTypeVideoMessage WebhookEventType = WebhookEventType("video") WebhookEventTypeFileMessage WebhookEventType = WebhookEventType("file") WebhookEventTypeMessageReply WebhookEventType = WebhookEventType("message_reply") WebhookEventTypeStoryMention WebhookEventType = WebhookEventType("story_mention") WebhookEventTypeStoryReply WebhookEventType = WebhookEventType("story_reply") WebhookEventTypeQuickReply WebhookEventType = WebhookEventType("quick_reply") WebhookEventTypeReaction WebhookEventType = WebhookEventType("reaction") WebhookEventTypeMessageSeen WebhookEventType = WebhookEventType("message_seen") WebhookEventTypePostBack WebhookEventType = WebhookEventType("postback") WebhookEventTypeEcho WebhookEventType = WebhookEventType("echo") WebhookEventTypeDeleted WebhookEventType = WebhookEventType("deleted") WebhookEventTypeUnsupported WebhookEventType = WebhookEventType("unsupported") )
all webhook event types.
type WebhookMessage ¶
type WebhookMessage struct {
MID string `json:"mid"`
Text string `json:"text"`
QuickReply *WebhookQuickReply `json:"quick_reply"`
Attachments []*Attachment `json:"attachments"`
ReplyTo *ReplyTo `json:"reply_to"`
IsEcho bool `json:"is_echo"`
IsUnsupported bool `json:"is_unsupported"`
IsDeleted bool `json:"is_deleted"`
}
WebhookMessage defines different message event type details.
type WebhookQuickReply ¶
type WebhookQuickReply struct {
Payload string `json:"payload"`
}
WebhookQuickReply defines webhook quickreply.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
icebreakers
command
|
|
|
send_message
command
|
|
|
user_profile
command
|
|
|
webhook
command
|