paked/messenger

Is it possible to reply or send buttons?

Closed this issue · 3 comments

Whoa! I've found it here: https://github.com/paked/messenger/blob/master/response.go
Can you share an example how to use that?

@puzanov A simple example, with a button template for account linking:

// Handle received messages
client.HandleMessage(func(m messenger.Message, r *messenger.Response) {
	switch strings.ToLower(m.Text) {
	case "login":
		buttons := &[]messenger.StructuredMessageButton{
			messenger.StructuredMessageButton{
				Type: "account_link",
				URL:  "https://yourSignInFormURL" ,
			},
		}
		err := r.ButtonTemplate("Connect your account", buttons, messenger.ResponseType)
		if err != nil {
			log.Println("failed to send login button:", err)
			return
		}
	}

Thanks