Skip to content

Commit

Permalink
Adjust payload field for buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Nov 29, 2023
1 parent c6cc2ef commit 0df8156
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion handlers/meta/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ func (h *handler) sendWhatsAppMsg(ctx context.Context, msg courier.MsgOut, clog
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, Text: p.Value})
component.Params = append(component.Params, &whatsapp.Param{Type: p.Type, 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
7 changes: 4 additions & 3 deletions handlers/meta/whatsapp/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ type Button struct {
}

type Param struct {
Type string `json:"type"`
Text string `json:"text"`
Image *struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Payload string `json:"payload,omitempty"`
Image *struct {
Link string `json:"link,omitempty"`
} `json:"image,omitempty"`
Video *struct {
Expand Down

0 comments on commit 0df8156

Please sign in to comment.