Add Response documentation
This commit is contained in:
parent
99c1be7fa1
commit
b206661b37
@ -7,14 +7,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// SendMessageURL is API endpoint for sending messages.
|
||||||
SendMessageURL = "https://graph.facebook.com/v2.6/me/messages"
|
SendMessageURL = "https://graph.facebook.com/v2.6/me/messages"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Response is used for responding to events with messages.
|
||||||
type Response struct {
|
type Response struct {
|
||||||
token string
|
token string
|
||||||
to Recipient
|
to Recipient
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Text sends a textual message.
|
||||||
func (r *Response) Text(message string) error {
|
func (r *Response) Text(message string) error {
|
||||||
m := SendMessage{
|
m := SendMessage{
|
||||||
Recipient: r.to,
|
Recipient: r.to,
|
||||||
@ -44,11 +47,13 @@ func (r *Response) Text(message string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SendMessage is the information sent in an API request to Facebook.
|
||||||
type SendMessage struct {
|
type SendMessage struct {
|
||||||
Recipient Recipient `json:"recipient"`
|
Recipient Recipient `json:"recipient"`
|
||||||
Message MessageData `json:"message"`
|
Message MessageData `json:"message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MessageData is a text message to be sent.
|
||||||
type MessageData struct {
|
type MessageData struct {
|
||||||
Text string `json:"text,omitempty"`
|
Text string `json:"text,omitempty"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user