Skip to content

Commit

Permalink
Merge pull request #64 from weni-ai/fix/process-trigger
Browse files Browse the repository at this point in the history
process trigger in propper way to prevent be saved on history
  • Loading branch information
rasoro authored Aug 22, 2024
2 parents 6f44488 + e037543 commit 8a37c46
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/websocket/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,16 +486,21 @@ func (c *Client) setupClientInfo(payload OutgoingPayload) error {
func (c *Client) processTrigger(payload OutgoingPayload, triggerTo postJSON, app *App) error {
if payload.Trigger != "" {
rPayload := OutgoingPayload{
Type: "message",
From: c.ID,
Callback: c.Callback,
Type: "message",
Message: Message{
Type: "text",
Text: payload.Trigger,
},
}
err := c.Redirect(rPayload, triggerTo, app)
trPayload, err := formatOutgoingPayload(rPayload)
if err != nil {
return err
}
if _, err := triggerTo(c.Callback, trPayload); err != nil {
return err
}
}
return nil
}
Expand Down

0 comments on commit 8a37c46

Please sign in to comment.