fsmfacebook

package module
v0.0.0-...-0dcc7dc Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: MIT Imports: 9 Imported by: 0

README

Go Carrot

FSM Facebook

FSM CLI is a Facebook Messenger target for go-carrot/fsm.

Environment Variables

When using this target, you must set five environment variables:

PORT=""
FACEBOOK_VERIFY_TOKEN=""
FACEBOOK_ACCESS_TOKEN=""
DYNAMO_DB_TABLE=""
DYNAMO_DB_REGION=""

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FacebookSetupWebhook

func FacebookSetupWebhook(w http.ResponseWriter, r *http.Request)

FacebookSetupWebhook adds support for the Messenger Platform's webhook verification to your webhook. This is required to ensure your webhook is authentic and working.

This must be a GET request, and have the same URL as the POST request.

https://developers.facebook.com/docs/messenger-platform/getting-started/webhook-setup

func GetFacebookWebhook

func GetFacebookWebhook(stateMachine fsm.StateMachine, store fsm.Store) func(http.ResponseWriter, *http.Request)

GetFacebookWebhook is the webhook that facebook posts to when a message is received from a user.

This must be a POST request, and have the same URL as the GET request.

https://developers.facebook.com/docs/messenger-platform/getting-started/webhook-setup

func SendMessage

func SendMessage(m *MessageData)

Types

type Attachment

type Attachment struct {
	Type    string  `json:"type"`
	Payload Payload `json:"payload"`
}

type FacebookEmitter

type FacebookEmitter struct {
	UUID string
}

func (*FacebookEmitter) Emit

func (f *FacebookEmitter) Emit(input interface{}) error

type Message

type Message struct {
	MessageID string `json:"mid"`
	Sequence  int64  `json:"seq"`
	Text      string `json:"text"`
}

type MessageData

type MessageData struct {
	Recipient    MessageRecipient `json:"recipient"`
	SenderAction string           `json:"sender_action,omitempty"`
	Message      *SendMessageData `json:"message"`
}

type MessageEntry

type MessageEntry struct {
	ID              string           `json:"id"`
	Time            int64            `json:"time"`
	MessagingEvents []MessagingEvent `json:"messaging"`
}

type MessageReceivedCallback

type MessageReceivedCallback struct {
	Object string         `json:"object"`
	Entry  []MessageEntry `json:"entry"`
}

type MessageRecipient

type MessageRecipient struct {
	ID string `json:"id"`
}

type MessagingEvent

type MessagingEvent struct {
	Sender    Sender    `json:"sender"`
	Recipient Recipient `json:"recipient"`
	Timestamp int64     `json:"timestamp"`
	Message   Message   `json:"message"`
}

type Payload

type Payload struct {
	URL string `json:"url"`
}

type QuickReply

type QuickReply struct {
	ContentType string `json:"content_type"`
	Title       string `json:"title"`
	Payload     string `json:"payload"`
}

type Recipient

type Recipient struct {
	ID string `json:"id"`
}

type SendMessageData

type SendMessageData struct {
	Text         string       `json:"text,omitempty"`
	Attachment   *Attachment  `json:"attachment,omitempty"`
	QuickReplies []QuickReply `json:"quick_replies,omitempty"`
}

type Sender

type Sender struct {
	ID string `json:"id"`
}

Jump to

Keyboard shortcuts

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