Skip to content

Commit 33ea6c9

Browse files
authored
Merge pull request #852 from nyaruka/whatsapp_fix
Fix panic from legacy whatsapp handler with bad interactive message payload
2 parents b4705ef + cc64ad4 commit 33ea6c9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

handlers/whatsapp_legacy/handler.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ func (h *handler) receiveEvents(ctx context.Context, channel courier.Channel, w
222222
} else if msg.Type == "image" && msg.Image != nil {
223223
text = msg.Image.Caption
224224
mediaURL, err = resolveMediaURL(channel, msg.Image.ID)
225-
} else if msg.Type == "interactive" {
226-
if msg.Interactive.Type == "button_reply" {
225+
} else if msg.Type == "interactive" && msg.Interactive != nil {
226+
if msg.Interactive.Type == "button_reply" && msg.Interactive.ButtonReply != nil {
227227
text = msg.Interactive.ButtonReply.Title
228-
} else {
228+
} else if msg.Interactive.Type == "list_reply" && msg.Interactive.ListReply != nil {
229229
text = msg.Interactive.ListReply.Title
230230
}
231231
} else if msg.Type == "location" && msg.Location != nil {

0 commit comments

Comments
 (0)