1
0
mirror of synced 2024-11-25 14:26:09 +03:00

add list template

This commit is contained in:
Ahmed Aboelyazeed 2019-04-14 12:28:09 +02:00
parent efd9d44236
commit 14ff2aecb8

View File

@ -285,6 +285,32 @@ func (r *Response) GenericTemplate(elements *[]StructuredMessageElement, messagi
return r.DispatchMessage(&m) return r.DispatchMessage(&m)
} }
// ListTemplate sends a list of elements
func (r *Response) ListTemplate(elements *[]StructuredMessageElement, messagingType MessagingType, tags ...string) error {
var tag string
if len(tags) > 0 {
tag = tags[0]
}
m := SendStructuredMessage{
MessagingType: messagingType,
Recipient: r.to,
Message: StructuredMessageData{
Attachment: StructuredMessageAttachment{
Type: "template",
Payload: StructuredMessagePayload{
TopElementStyle: "compact",
TemplateType: "list",
Buttons: nil,
Elements: elements,
},
},
},
Tag: tag,
}
return r.DispatchMessage(&m)
}
// SenderAction sends a info about sender action // SenderAction sends a info about sender action
func (r *Response) SenderAction(action string) error { func (r *Response) SenderAction(action string) error {
m := SendSenderAction{ m := SendSenderAction{