diff --git a/receiving.go b/receiving.go index 090c941..f4c0aca 100644 --- a/receiving.go +++ b/receiving.go @@ -55,6 +55,16 @@ type Attachment struct { Payload Payload `json:"payload"` } +// QuickReply is a file which used in a message. +type QuickReply struct { + // ContentType is the type of reply + ContentType string `json:"content_type"` + // Title is the reply title + Title string `json:"title"` + // Payload is the reply information + Payload string `json:"payload"` +} + // Payload is the information on where an attachment is. type Payload struct { // URL is where the attachment resides on the internet. diff --git a/response.go b/response.go index 6ca29ac..c6e388b 100644 --- a/response.go +++ b/response.go @@ -24,10 +24,16 @@ type Response struct { // Text sends a textual message. func (r *Response) Text(message string) error { + return r.TextWithReplies(message, nil) +} + +// TextWithReplies sends a textual message with some replies +func (r *Response) TextWithReplies(message string, replies []QuickReply) error { m := SendMessage{ Recipient: r.to, Message: MessageData{ - Text: message, + Text: message, + QuickReplies: replies, }, } @@ -178,9 +184,10 @@ type SendMessage struct { Message MessageData `json:"message"` } -// MessageData is a text message to be sent. +// MessageData is a text message with optional replies to be sent. type MessageData struct { - Text string `json:"text,omitempty"` + Text string `json:"text,omitempty"` + QuickReplies []QuickReply `json:"quick_replies,omitempty"` } // SendStructuredMessage is a structured message template.