Skip to content

Commit

Permalink
Adjust buttons params
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Nov 30, 2023
1 parent 15e1a0e commit cd73dc8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions handlers/meta/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -833,12 +833,12 @@ func (h *handler) sendWhatsAppMsg(ctx context.Context, msg courier.MsgOut, clog

for _, p := range v {
if strings.HasPrefix(p.Value, "http") {
component := &whatsapp.Component{Type: "button", Index: strings.TrimPrefix(k, "button."), SubType: "url"}
component.Params = append(component.Params, &whatsapp.Param{Type: p.Type, Text: p.Value})
component := &whatsapp.Component{Type: "button", Index: strings.TrimPrefix(k, "button."), SubType: "quick_reply"}
component.Params = append(component.Params, &whatsapp.Param{Type: "url", Text: p.Value})
template.Components = append(template.Components, component)
} else {
component := &whatsapp.Component{Type: "button", Index: strings.TrimPrefix(k, "button."), SubType: "payload"}
component.Params = append(component.Params, &whatsapp.Param{Type: p.Type, Payload: p.Value})
component := &whatsapp.Component{Type: "button", Index: strings.TrimPrefix(k, "button."), SubType: "quick_reply"}
component.Params = append(component.Params, &whatsapp.Param{Type: "payload", Payload: p.Value})
template.Components = append(template.Components, component)
}

Check warning on line 843 in handlers/meta/handlers.go

View check run for this annotation

Codecov / codecov/patch

handlers/meta/handlers.go#L833-L843

Added lines #L833 - L843 were not covered by tests
}
Expand Down

0 comments on commit cd73dc8

Please sign in to comment.