Skip to content

Model quick replies as structs instead of strings #838

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

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions backends/rapidpro/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (ts *BackendTestSuite) TestMsgUnmarshal() {
ts.Equal([]string{"https://foo.bar/image.jpg"}, msg.Attachments())
ts.Equal("5ApPVsFDcFt:RZdK9ne7LgfvBYdtCYg7tv99hC9P2", msg.URNAuth_)
ts.Equal("", msg.ExternalID())
ts.Equal([]string{"Yes", "No"}, msg.QuickReplies())
ts.Equal([]courier.QuickReply{{Text: "Yes"}, {Text: "No"}}, msg.QuickReplies())
ts.Equal("event", msg.Topic())
ts.Equal("external-id", msg.ResponseToExternalID())
ts.True(msg.HighPriority())
Expand Down Expand Up @@ -1605,7 +1605,6 @@ SELECT
direction,
text,
attachments,
quick_replies,
msg_count,
error_count,
failed_reason,
Expand Down
40 changes: 20 additions & 20 deletions backends/rapidpro/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@

// Msg is our base struct to represent msgs both in our JSON and db representations
type Msg struct {
OrgID_ OrgID `json:"org_id" db:"org_id"`
ID_ courier.MsgID `json:"id" db:"id"`
UUID_ courier.MsgUUID `json:"uuid" db:"uuid"`
Direction_ MsgDirection ` db:"direction"`
Status_ courier.MsgStatus ` db:"status"`
Visibility_ MsgVisibility ` db:"visibility"`
HighPriority_ bool `json:"high_priority" db:"high_priority"`
Text_ string `json:"text" db:"text"`
Attachments_ pq.StringArray `json:"attachments" db:"attachments"`
QuickReplies_ pq.StringArray `json:"quick_replies" db:"quick_replies"`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't write or load messages with quick replies from the db

Locale_ null.String `json:"locale" db:"locale"`
Templating_ *courier.Templating `json:"templating" db:"templating"`
ExternalID_ null.String ` db:"external_id"`
Metadata_ json.RawMessage `json:"metadata" db:"metadata"`
OrgID_ OrgID `json:"org_id" db:"org_id"`
ID_ courier.MsgID `json:"id" db:"id"`
UUID_ courier.MsgUUID `json:"uuid" db:"uuid"`
Direction_ MsgDirection ` db:"direction"`
Status_ courier.MsgStatus ` db:"status"`
Visibility_ MsgVisibility ` db:"visibility"`
HighPriority_ bool `json:"high_priority" db:"high_priority"`
Text_ string `json:"text" db:"text"`
Attachments_ pq.StringArray `json:"attachments" db:"attachments"`
QuickReplies_ []courier.QuickReply `json:"quick_replies"`
Locale_ null.String `json:"locale" db:"locale"`
Templating_ *courier.Templating `json:"templating" db:"templating"`
ExternalID_ null.String ` db:"external_id"`
Metadata_ json.RawMessage `json:"metadata" db:"metadata"`

ChannelID_ courier.ChannelID ` db:"channel_id"`
ContactID_ ContactID `json:"contact_id" db:"contact_id"`
Expand Down Expand Up @@ -135,12 +135,12 @@
func (m *Msg) Channel() courier.Channel { return m.channel }

// outgoing specific
func (m *Msg) QuickReplies() []string { return m.QuickReplies_ }
func (m *Msg) Locale() i18n.Locale { return i18n.Locale(string(m.Locale_)) }
func (m *Msg) Templating() *courier.Templating { return m.Templating_ }
func (m *Msg) URNAuth() string { return m.URNAuth_ }
func (m *Msg) Origin() courier.MsgOrigin { return m.Origin_ }
func (m *Msg) ContactLastSeenOn() *time.Time { return m.ContactLastSeenOn_ }
func (m *Msg) QuickReplies() []courier.QuickReply { return m.QuickReplies_ }
func (m *Msg) Locale() i18n.Locale { return i18n.Locale(string(m.Locale_)) }
func (m *Msg) Templating() *courier.Templating { return m.Templating_ }
func (m *Msg) URNAuth() string { return m.URNAuth_ }
func (m *Msg) Origin() courier.MsgOrigin { return m.Origin_ }
func (m *Msg) ContactLastSeenOn() *time.Time { return m.ContactLastSeenOn_ }

Check warning on line 143 in backends/rapidpro/msg.go

View check run for this annotation

Codecov / codecov/patch

backends/rapidpro/msg.go#L139-L143

Added lines #L139 - L143 were not covered by tests
func (m *Msg) Topic() string {
if m.Metadata_ == nil {
return ""
Expand Down
8 changes: 4 additions & 4 deletions handlers/dialog360/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
Type: "reply",
}
btns[i].Reply.ID = fmt.Sprint(i)
btns[i].Reply.Title = qr
btns[i].Reply.Title = qr.Text
}
interactive.Action = &struct {
Button string "json:\"button,omitempty\""
Expand All @@ -376,7 +376,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
for i, qr := range qrs {
section.Rows[i] = whatsapp.SectionRow{
ID: fmt.Sprint(i),
Title: qr,
Title: qr.Text,
}
}

Expand Down Expand Up @@ -510,7 +510,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
Type: "reply",
}
btns[i].Reply.ID = fmt.Sprint(i)
btns[i].Reply.Title = qr
btns[i].Reply.Title = qr.Text
}
interactive.Action = &struct {
Button string "json:\"button,omitempty\""
Expand All @@ -530,7 +530,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
for i, qr := range qrs {
section.Rows[i] = whatsapp.SectionRow{
ID: fmt.Sprint(i),
Title: qr,
Title: qr.Text,
}
}

Expand Down
18 changes: 9 additions & 9 deletions handlers/dialog360/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
Label: "Interactive Button Message Send",
MsgText: "Interactive Button Msg",
MsgURN: "whatsapp:250788123123",
MsgQuickReplies: []string{"BUTTON1"},
MsgQuickReplies: []courier.QuickReply{{Text: "BUTTON1"}},
MockResponses: map[string][]*httpx.MockResponse{
"https://waba-v2.360dialog.io/messages": {
httpx.NewMockResponse(201, nil, []byte(`{ "messages": [{"id": "157b5e14568e8"}] }`)),
Expand All @@ -502,7 +502,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
Label: "Interactive List Message Send",
MsgText: "Interactive List Msg",
MsgURN: "whatsapp:250788123123",
MsgQuickReplies: []string{"ROW1", "ROW2", "ROW3", "ROW4"},
MsgQuickReplies: []courier.QuickReply{{Text: "ROW1"}, {Text: "ROW2"}, {Text: "ROW3"}, {Text: "ROW4"}},
MockResponses: map[string][]*httpx.MockResponse{
"https://waba-v2.360dialog.io/messages": {
httpx.NewMockResponse(201, nil, []byte(`{ "messages": [{"id": "157b5e14568e8"}] }`)),
Expand All @@ -517,7 +517,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
Label: "Interactive List Message Send more than 10 QRs",
MsgText: "Interactive List Msg",
MsgURN: "whatsapp:250788123123",
MsgQuickReplies: []string{"ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9", "ROW10", "ROW11", "ROW12"},
MsgQuickReplies: []courier.QuickReply{{Text: "ROW1"}, {Text: "ROW2"}, {Text: "ROW3"}, {Text: "ROW4"}, {Text: "ROW5"}, {Text: "ROW6"}, {Text: "ROW7"}, {Text: "ROW8"}, {Text: "ROW9"}, {Text: "ROW10"}, {Text: "ROW11"}, {Text: "ROW12"}},
MockResponses: map[string][]*httpx.MockResponse{
"https://waba-v2.360dialog.io/messages": {
httpx.NewMockResponse(201, nil, []byte(`{ "messages": [{"id": "157b5e14568e8"}] }`)),
Expand All @@ -534,7 +534,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
MsgText: "Hola",
MsgURN: "whatsapp:250788123123",
MsgLocale: "spa",
MsgQuickReplies: []string{"ROW1", "ROW2", "ROW3", "ROW4"},
MsgQuickReplies: []courier.QuickReply{{Text: "ROW1"}, {Text: "ROW2"}, {Text: "ROW3"}, {Text: "ROW4"}},
MockResponses: map[string][]*httpx.MockResponse{
"https://waba-v2.360dialog.io/messages": {
httpx.NewMockResponse(201, nil, []byte(`{ "messages": [{"id": "157b5e14568e8"}] }`)),
Expand All @@ -549,7 +549,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
Label: "Interactive Button Message Send with image attachment",
MsgText: "Interactive Button Msg",
MsgURN: "whatsapp:250788123123",
MsgQuickReplies: []string{"BUTTON1"},
MsgQuickReplies: []courier.QuickReply{{Text: "BUTTON1"}},
MsgAttachments: []string{"image/jpeg:https://foo.bar/image.jpg"},
MockResponses: map[string][]*httpx.MockResponse{
"https://waba-v2.360dialog.io/messages": {
Expand All @@ -569,7 +569,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
Label: "Interactive Button Message Send with video attachment",
MsgText: "Interactive Button Msg",
MsgURN: "whatsapp:250788123123",
MsgQuickReplies: []string{"BUTTON1"},
MsgQuickReplies: []courier.QuickReply{{Text: "BUTTON1"}},
MsgAttachments: []string{"video/mp4:https://foo.bar/video.mp4"},
MockResponses: map[string][]*httpx.MockResponse{
"https://waba-v2.360dialog.io/messages": {
Expand All @@ -589,7 +589,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
Label: "Interactive Button Message Send with document attachment",
MsgText: "Interactive Button Msg",
MsgURN: "whatsapp:250788123123",
MsgQuickReplies: []string{"BUTTON1"},
MsgQuickReplies: []courier.QuickReply{{Text: "BUTTON1"}},
MsgAttachments: []string{"document/pdf:https://foo.bar/document.pdf"},
MockResponses: map[string][]*httpx.MockResponse{
"https://waba-v2.360dialog.io/messages": {
Expand All @@ -609,7 +609,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
Label: "Interactive Button Message Send with audio attachment",
MsgText: "Interactive Button Msg",
MsgURN: "whatsapp:250788123123",
MsgQuickReplies: []string{"ROW1", "ROW2", "ROW3"},
MsgQuickReplies: []courier.QuickReply{{Text: "ROW1"}, {Text: "ROW2"}, {Text: "ROW3"}},
MsgAttachments: []string{"audio/mp3:https://foo.bar/audio.mp3"},
MockResponses: map[string][]*httpx.MockResponse{
"*/messages": {
Expand All @@ -627,7 +627,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
Label: "Interactive List Message Send with attachment",
MsgText: "Interactive List Msg",
MsgURN: "whatsapp:250788123123",
MsgQuickReplies: []string{"ROW1", "ROW2", "ROW3", "ROW4"},
MsgQuickReplies: []courier.QuickReply{{Text: "ROW1"}, {Text: "ROW2"}, {Text: "ROW3"}, {Text: "ROW4"}},
MsgAttachments: []string{"image/jpeg:https://foo.bar/image.jpg"},
MockResponses: map[string][]*httpx.MockResponse{
"*/messages": {
Expand Down
2 changes: 1 addition & 1 deletion handlers/discord/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
To: msg.URN().Path(),
Channel: string(msg.Channel().UUID()),
Attachments: attachmentURLs,
QuickReplies: msg.QuickReplies(),
QuickReplies: handlers.TextOnlyQuickReplies(msg.QuickReplies()),
}

var body io.Reader
Expand Down
14 changes: 7 additions & 7 deletions handlers/discord/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ var testChannels = []courier.Channel{

var testCases = []IncomingTestCase{
{
Label: "Recieve Message",
Label: "Receive Message",
URL: "/c/ds/bac782c2-7aeb-4389-92f5-97887744f573/receive",
Data: `from=694634743521607802&text=hello`,
ExpectedRespStatus: 200,
ExpectedMsgText: Sp("hello"),
ExpectedURN: "discord:694634743521607802",
},
{
Label: "Recieve Message with attachment",
Label: "Receive Message with attachment",
URL: "/c/ds/bac782c2-7aeb-4389-92f5-97887744f573/receive",
Data: `from=694634743521607802&text=hello&attachments=https://test.test/foo.png`,
ExpectedRespStatus: 200,
Expand Down Expand Up @@ -90,7 +90,7 @@ var sendTestCases = []OutgoingTestCase{
ExpectedRequests: []ExpectedRequest{
{
Path: "/discord/rp/send",
Body: `{"id":"10","text":"Hello World","to":"694634743521607802","channel":"bac782c2-7aeb-4389-92f5-97887744f573","attachments":[],"quick_replies":null}`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sending arrays as nulls doesn't seem right...

Body: `{"id":"10","text":"Hello World","to":"694634743521607802","channel":"bac782c2-7aeb-4389-92f5-97887744f573","attachments":[],"quick_replies":[]}`,
},
},
},
Expand All @@ -107,15 +107,15 @@ var sendTestCases = []OutgoingTestCase{
ExpectedRequests: []ExpectedRequest{
{
Path: "/discord/rp/send",
Body: `{"id":"10","text":"Hello World","to":"694634743521607802","channel":"bac782c2-7aeb-4389-92f5-97887744f573","attachments":["https://foo.bar/image.jpg"],"quick_replies":null}`,
Body: `{"id":"10","text":"Hello World","to":"694634743521607802","channel":"bac782c2-7aeb-4389-92f5-97887744f573","attachments":["https://foo.bar/image.jpg"],"quick_replies":[]}`,
},
},
},
{
Label: "Attachement and quick replies",
MsgText: "Hello World",
MsgAttachments: []string{"image/jpeg:https://foo.bar/image.jpg"},
MsgQuickReplies: []string{"hello", "world"},
MsgQuickReplies: []courier.QuickReply{{Text: "hello"}, {Text: "world"}},
MsgURN: "discord:694634743521607802",
MockResponses: map[string][]*httpx.MockResponse{
"http://example.com/discord/rp/send": {
Expand All @@ -141,7 +141,7 @@ var sendTestCases = []OutgoingTestCase{
ExpectedRequests: []ExpectedRequest{
{
Path: "/discord/rp/send",
Body: `{"id":"10","text":"Error Sending","to":"694634743521607802","channel":"bac782c2-7aeb-4389-92f5-97887744f573","attachments":[],"quick_replies":null}`,
Body: `{"id":"10","text":"Error Sending","to":"694634743521607802","channel":"bac782c2-7aeb-4389-92f5-97887744f573","attachments":[],"quick_replies":[]}`,
},
},
ExpectedError: courier.ErrResponseStatus,
Expand All @@ -158,7 +158,7 @@ var sendTestCases = []OutgoingTestCase{
ExpectedRequests: []ExpectedRequest{
{
Path: "/discord/rp/send",
Body: `{"id":"10","text":"Error","to":"694634743521607802","channel":"bac782c2-7aeb-4389-92f5-97887744f573","attachments":[],"quick_replies":null}`,
Body: `{"id":"10","text":"Error","to":"694634743521607802","channel":"bac782c2-7aeb-4389-92f5-97887744f573","attachments":[],"quick_replies":[]}`,
},
},
ExpectedError: courier.ErrConnectionFailed,
Expand Down
18 changes: 9 additions & 9 deletions handlers/external/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/nyaruka/courier"
"github.com/nyaruka/courier/handlers"
"github.com/nyaruka/gocommon/gsm7"
"github.com/nyaruka/gocommon/jsonx"
"github.com/nyaruka/gocommon/urns"
)

Expand Down Expand Up @@ -328,7 +329,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
if i == len(parts)-1 {
formEncoded["quick_replies"] = buildQuickRepliesResponse(msg.QuickReplies(), sendMethod, contentURLEncoded)
} else {
formEncoded["quick_replies"] = buildQuickRepliesResponse([]string{}, sendMethod, contentURLEncoded)
formEncoded["quick_replies"] = buildQuickRepliesResponse([]courier.QuickReply{}, sendMethod, contentURLEncoded)
}
url := replaceVariables(sendURL, formEncoded)

Expand All @@ -339,7 +340,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
if i == len(parts)-1 {
formEncoded["quick_replies"] = buildQuickRepliesResponse(msg.QuickReplies(), sendMethod, contentType)
} else {
formEncoded["quick_replies"] = buildQuickRepliesResponse([]string{}, sendMethod, contentType)
formEncoded["quick_replies"] = buildQuickRepliesResponse([]courier.QuickReply{}, sendMethod, contentType)
}
body = strings.NewReader(replaceVariables(sendBody, formEncoded))
}
Expand Down Expand Up @@ -381,27 +382,26 @@ type quickReplyXMLItem struct {
Value string `xml:",chardata"`
}

func buildQuickRepliesResponse(quickReplies []string, sendMethod string, contentType string) string {
func buildQuickRepliesResponse(quickReplies []courier.QuickReply, sendMethod string, contentType string) string {
if quickReplies == nil {
quickReplies = []string{}
quickReplies = []courier.QuickReply{}
}
if (sendMethod == http.MethodPost || sendMethod == http.MethodPut) && contentType == contentJSON {
marshalled, _ := json.Marshal(quickReplies)
return string(marshalled)
return string(jsonx.MustMarshal(handlers.TextOnlyQuickReplies(quickReplies)))
} else if (sendMethod == http.MethodPost || sendMethod == http.MethodPut) && contentType == contentXML {
items := make([]quickReplyXMLItem, len(quickReplies))

for i, v := range quickReplies {
items[i] = quickReplyXMLItem{Value: v}
items[i] = quickReplyXMLItem{Value: v.Text}
}
marshalled, _ := xml.Marshal(items)
return string(marshalled)
} else {
response := bytes.Buffer{}

for _, reply := range quickReplies {
reply = url.QueryEscape(reply)
response.WriteString(fmt.Sprintf("&quick_reply=%s", reply))
reply.Text = url.QueryEscape(reply.Text)
response.WriteString(fmt.Sprintf("&quick_reply=%s", reply.Text))
}
return response.String()
}
Expand Down
12 changes: 6 additions & 6 deletions handlers/external/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ var longSendTestCases = []OutgoingTestCase{
{
Label: "Long Send",
MsgText: "This is a long message that will be longer than 30....... characters", MsgURN: "tel:+250788383383",
MsgQuickReplies: []string{"One"},
MsgQuickReplies: []courier.QuickReply{{Text: "One"}},
MockResponses: map[string][]*httpx.MockResponse{
"http://example.com/send*": {
httpx.NewMockResponse(200, nil, []byte(`0: Accepted for delivery`)),
Expand Down Expand Up @@ -627,7 +627,7 @@ var jsonSendTestCases = []OutgoingTestCase{
Label: "Send Quick Replies",
MsgText: "Some message",
MsgURN: "tel:+250788383383",
MsgQuickReplies: []string{"One", "Two", "Three"},
MsgQuickReplies: []courier.QuickReply{{Text: "One"}, {Text: "Two"}, {Text: "Three"}},
MockResponses: map[string][]*httpx.MockResponse{
"http://example.com/send": {
httpx.NewMockResponse(200, nil, []byte(`0: Accepted for delivery`)),
Expand All @@ -645,7 +645,7 @@ var jsonLongSendTestCases = []OutgoingTestCase{
Label: "Send Long message JSON",
MsgText: "This is a long message that will be longer than 30....... characters",
MsgURN: "tel:+250788383383",
MsgQuickReplies: []string{"One", "Two", "Three"},
MsgQuickReplies: []courier.QuickReply{{Text: "One"}, {Text: "Two"}, {Text: "Three"}},
MockResponses: map[string][]*httpx.MockResponse{
"*": {
httpx.NewMockResponse(200, nil, []byte(`0: Accepted for delivery`)),
Expand Down Expand Up @@ -733,7 +733,7 @@ var xmlSendTestCases = []OutgoingTestCase{
Label: "Send Quick Replies",
MsgText: "Some message",
MsgURN: "tel:+250788383383",
MsgQuickReplies: []string{"One", "Two", "Three"},
MsgQuickReplies: []courier.QuickReply{{Text: "One"}, {Text: "Two"}, {Text: "Three"}},
MockResponses: map[string][]*httpx.MockResponse{
"http://example.com/send": {
httpx.NewMockResponse(200, nil, []byte(`0: Accepted for delivery`)),
Expand All @@ -751,7 +751,7 @@ var xmlLongSendTestCases = []OutgoingTestCase{
Label: "Send Long message XML",
MsgText: "This is a long message that will be longer than 30....... characters",
MsgURN: "tel:+250788383383",
MsgQuickReplies: []string{"One", "Two", "Three"},
MsgQuickReplies: []courier.QuickReply{{Text: "One"}, {Text: "Two"}, {Text: "Three"}},
MockResponses: map[string][]*httpx.MockResponse{
"*": {
httpx.NewMockResponse(200, nil, []byte(`0: Accepted for delivery`)),
Expand Down Expand Up @@ -855,7 +855,7 @@ var xmlSendWithResponseContentTestCases = []OutgoingTestCase{
Label: "Send Quick Replies",
MsgText: "Some message",
MsgURN: "tel:+250788383383",
MsgQuickReplies: []string{"One", "Two", "Three"},
MsgQuickReplies: []courier.QuickReply{{Text: "One"}, {Text: "Two"}, {Text: "Three"}},
MockResponses: map[string][]*httpx.MockResponse{
"http://example.com/send": {
httpx.NewMockResponse(200, nil, []byte(`<return>0</return>`)),
Expand Down
2 changes: 1 addition & 1 deletion handlers/facebook_legacy/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
// include any quick replies on the last piece we send
if i == (len(msgParts)+len(msg.Attachments()))-1 {
for _, qr := range msg.QuickReplies() {
payload.Message.QuickReplies = append(payload.Message.QuickReplies, mtQuickReply{qr, qr, "text"})
payload.Message.QuickReplies = append(payload.Message.QuickReplies, mtQuickReply{qr.Text, qr.Text, "text"})
}
} else {
payload.Message.QuickReplies = nil
Expand Down
Loading