Categorygithub.com/datomar-labs-inc/messenger
modulepackage
1.1.5
Repository: https://github.com/datomar-labs-inc/messenger.git
Documentation: pkg.go.dev

# README

Messenger GoDoc Build Status

This is a Go library for making bots to be used on Facebook messenger. It is built on the Messenger Platform. One of the main goals of the project is to implement it in an idiomatic and easy to use fashion.

You can find examples for this library here.

We tag our releases Semver style.

Tips

  • Follow the quickstart guide for getting everything set up!
  • You need a Facebook development app, and a Facebook page in order to build things.
  • Use ngrok to tunnel your locally running bot so that Facebook can reach the webhook.

Breaking Changes

In January 2019 we began tagging releases so that the package could be used properly with Go modules. Prior to that we simply maintained the following list to help users migrate between versions, it's staying here for legacy reasons. From now on, however, you should find breaking changes in the notes of a new release.

paked/messenger is a pretty stable library, however, changes will be made which might break backwards compatibility. For the convenience of its users, these are documented here.

  • 06/2/18: Added messaging_type field for message send API request as it is required by FB
  • 23/1/17: Updating timezone type to float64 in profile struct
  • 12/9/16: Removing unused parameter text string from function (r *Response) GenericTemplate.
  • 20/5/16: Leaving the WebhookURL field blank in Options will yield a URL of "/" instead of a panic.
  • 4/5/16: The URL to use for the webhook is changable in the Options struct.

Inspiration

Messenger takes design cues from:

Projects

This is a list of projects use messenger. If you would like to add your own, submit a Pull Request adding it below.

  • meme-maker by @paked: A bot which, given a photo and a caption, will create a macro meme.
  • drone-facebook by @appleboy: Drone.io plugin which sends Facebook notifications

# Packages

No description provided by the author

# Functions

New creates a new Messenger.
newVerifyHandler returns a function which can be used to handle webhook verification.
No description provided by the author

# Constants

AccountLinkingAction means that the event concerns changes in account linking status.
AudioAttachment is audio attachment type.
TopElementStyle is compact.
DeliveryAction means that the event was advising of a successful delivery to a previous recipient.
FileAttachment is file attachment type.
ImageAspectRatio is horizontal (1.91:1).
ImageAttachment is image attachment type.
InboxPageID is managed by facebook for secondary pass to inbox features: https://developers.facebook.com/docs/messenger-platform/handover-protocol/pass-thread-control.
TopElementStyle is large.
MessageTagType is message_tag messaging type.
MessengerProfileURL is the API endpoint where you set properties that define various aspects of the following Messenger Platform features.
NonPromotionalSubscriptionType is NON_PROMOTIONAL_SUBSCRIPTION messaging type.
OptInAction represents opting in through the Send to Messenger button.
PostBackAction represents post call back.
ProfileURL is the API endpoint used for retrieving profiles.
ReadAction means that the event was a previous recipient reading their respective messages.
ReferralAction represents ?ref parameter in m.me URLs.
ResponseType is response messaging type.
SendMessageURL is API endpoint for sending messages.
SendSettingsURL is API endpoint for saving settings.
ImageAspectRatio is square.
TextAction means that the event was a text message (May contain attachments).
ThreadControlURL is the API endpoint for passing thread control.
UnknownAction means that the event was not able to be classified.
UpdateType is update messaging type.
VideoAttachment is video attachment type.
WebviewCompact opens the page in a web view that takes half the screen and covers only part of the conversation.
WebviewFull opens the page in a web view that completely covers the conversation, and has a "back" button instead of a "close" one.
WebviewTall opens the page in a web view that covers about 75% of the conversation.

# Structs

No description provided by the author
Attachment is a file which used in a message.
CallToActionsItem contains Get Started button or item of Persist Menu.
CallToActionsSetting is the settings for Get Started and Persist Menu.
Coordinates is a pair of latitude and longitude.
DefaultAction is a response containing default action properties.
Delivery represents a the event fired when Facebook delivers a message to the recipient.
Entry
Entry is a batch of events which were sent in this webhook trigger.
GreetingInfo contains greeting message.
GreetingSetting is the setting for greeting message.
HomeURL is the settings for EnableChatExtension https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api/home-url.
Message represents a Facebook messenger message.
MessageData is a message consisting of text or an attachment, with an additional selection of optional quick replies.
MessageInfo is an event that is fired by the webhook.
Messenger is the client which manages communication with the Messenger Platform API.
No description provided by the author
Options are the settings used when creating a Messenger client.
Payload is the information on where an attachment is.
PostBack represents postback callback.
Profile is the public information of a Facebook user.
QueryError is representing an error sent back by Facebook.
QueryResponse is the response sent back by Facebook when setting up things like greetings or call-to-actions.
QuickReply is a file which used in a message.
Read represents a the event fired when a message is read by the recipient.
Receive is the format in which webhook events are sent.
Recipient is who the message was sent to.
Referral represents referral info.
ReferralMessage represents referral endpoint.
Response is used for responding to events with messages.
Sender is who the message was sent from.
SendMessage is the information sent in an API request to Facebook.
SendSenderAction is the information about sender action.
SendStructuredMessage is a structured message template.
StructuredMessageAttachment is the attachment of a structured message.
StructuredMessageButton is a response containing buttons.
StructuredMessageData is an attachment sent with a structured message.
StructuredMessageElement is a response containing structural elements.
StructuredMessagePayload is the actual payload of an attachment.

# Type aliases

AccountLinkingHandler is a handler used to react to an account being linked or unlinked.
Action is used to determine what kind of message a webhook event is.
AttachmentType is attachment type.
DeliveryHandler is a handler used for responding to a delivery receipt.
No description provided by the author
MessageHandler is a handler used for responding to a message containing text.
No description provided by the author
OptInHandler is a handler used to handle opt-ins.
PostBackHandler is a handler used postback callbacks.
ReadHandler is a handler used for responding to a read receipt.
ReferralHandler is a handler used postback callbacks.
No description provided by the author