Skip to content

Commit

Permalink
Add WithParams() for msg triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Jun 15, 2023
1 parent 11f6e31 commit 47a3958
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions flows/triggers/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ const TypeMsg string = "msg"

// MsgTrigger is used when a session was triggered by a message being received by the caller
//
// {
// "type": "msg",
// "flow": {"uuid": "50c3706e-fedb-42c0-8eab-dda3335714b7", "name": "Registration"},
// "contact": {
// "uuid": "9f7ede93-4b16-4692-80ad-b7dc54a1cd81",
// "name": "Bob",
// "created_on": "2018-01-01T12:00:00.000000Z"
// },
// "msg": {
// "uuid": "2d611e17-fb22-457f-b802-b8f7ec5cda5b",
// "channel": {"uuid": "61602f3e-f603-4c70-8a8f-c477505bf4bf", "name": "Twilio"},
// "urn": "tel:+12065551212",
// "text": "hi there",
// "attachments": ["https://s3.amazon.com/mybucket/attachment.jpg"]
// },
// "keyword_match": {
// "type": "first_word",
// "keyword": "start"
// },
// "triggered_on": "2000-01-01T00:00:00.000000000-00:00"
// }
// {
// "type": "msg",
// "flow": {"uuid": "50c3706e-fedb-42c0-8eab-dda3335714b7", "name": "Registration"},
// "contact": {
// "uuid": "9f7ede93-4b16-4692-80ad-b7dc54a1cd81",
// "name": "Bob",
// "created_on": "2018-01-01T12:00:00.000000Z"
// },
// "msg": {
// "uuid": "2d611e17-fb22-457f-b802-b8f7ec5cda5b",
// "channel": {"uuid": "61602f3e-f603-4c70-8a8f-c477505bf4bf", "name": "Twilio"},
// "urn": "tel:+12065551212",
// "text": "hi there",
// "attachments": ["https://s3.amazon.com/mybucket/attachment.jpg"]
// },
// "keyword_match": {
// "type": "first_word",
// "keyword": "start"
// },
// "triggered_on": "2000-01-01T00:00:00.000000000-00:00"
// }
//
// @trigger msg
type MsgTrigger struct {
Expand Down Expand Up @@ -125,6 +125,12 @@ func (b *MsgBuilder) WithConnection(channel *assets.ChannelReference, urn urns.U
return b
}

// WithParams sets the params for the trigger
func (b *MsgBuilder) WithParams(params *types.XObject) *MsgBuilder {
b.t.params = params
return b
}

// Build builds the trigger
func (b *MsgBuilder) Build() *MsgTrigger {
return b.t
Expand Down

0 comments on commit 47a3958

Please sign in to comment.