Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constants for sender actions #1

Merged
merged 1 commit into from
Jul 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type AttachmentType string
type MessagingType string
type TopElementStyle string
type ImageAspectRatio string
type SenderAction string

const (
// SendMessageURL is API endpoint for sending messages.
Expand Down Expand Up @@ -57,6 +58,10 @@ const (
HorizontalImageAspectRatio ImageAspectRatio = "horizontal"
// ImageAspectRatio is square.
SquareImageAspectRatio ImageAspectRatio = "square"

SenderActionMarkSeen SenderAction = "mark_seen"
SenderActionTypingOn SenderAction = "typing_on"
SenderActionTypingOff SenderAction = "typing_off"
)

// QueryResponse is the response sent back by Facebook when setting up things
Expand Down Expand Up @@ -326,7 +331,7 @@ func (r *Response) ListTemplate(elements *[]StructuredMessageElement, messagingT
}

// SenderAction sends a info about sender action
func (r *Response) SenderAction(action string) error {
func (r *Response) SenderAction(action SenderAction) error {
m := SendSenderAction{
Recipient: r.to,
SenderAction: action,
Expand Down Expand Up @@ -478,6 +483,6 @@ type StructuredMessageButton struct {

// SendSenderAction is the information about sender action
type SendSenderAction struct {
Recipient Recipient `json:"recipient"`
SenderAction string `json:"sender_action"`
Recipient Recipient `json:"recipient"`
SenderAction SenderAction `json:"sender_action"`
}