-
Notifications
You must be signed in to change notification settings - Fork 71
Update payloads for tasks queued to mailroom #723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,7 @@ import ( | |
func queueMsgHandling(rc redis.Conn, c *Contact, m *Msg) error { | ||
channel := m.Channel().(*Channel) | ||
|
||
// queue to mailroom | ||
body := map[string]any{ | ||
"contact_id": c.ID_, | ||
"org_id": channel.OrgID_, | ||
"channel_id": channel.ID_, | ||
"msg_id": m.ID_, | ||
"msg_uuid": m.UUID(), | ||
|
@@ -32,15 +29,18 @@ func queueMsgHandling(rc redis.Conn, c *Contact, m *Msg) error { | |
|
||
func queueChannelEvent(rc redis.Conn, c *Contact, e *ChannelEvent) error { | ||
body := map[string]any{ | ||
"org_id": e.OrgID_, | ||
"contact_id": e.ContactID_, | ||
"event_id": e.ID_, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like we should some day model whether channel events are handled.. i.e. have mailroom update their status like we do for messages. |
||
"event_type": e.EventType_, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I want to switch these to all be a single |
||
"urn_id": e.ContactURNID_, | ||
"channel_id": e.ChannelID_, | ||
"extra": e.Extra(), | ||
"new_contact": c.IsNew_, | ||
"occurred_on": e.OccurredOn_, | ||
"created_on": e.CreatedOn_, | ||
} | ||
if e.OptInID_ != 0 { | ||
body["optin_id"] = e.OptInID_ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. best I can tell we're not doing optin triggers correctly in the engine because this isn't being passed - the triggers work but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
switch e.EventType() { | ||
case courier.EventTypeStopContact: | ||
|
@@ -61,7 +61,7 @@ func queueChannelEvent(rc redis.Conn, c *Contact, e *ChannelEvent) error { | |
} | ||
|
||
func queueMsgDeleted(rc redis.Conn, ch *Channel, msgID courier.MsgID, contactID ContactID) error { | ||
return queueMailroomTask(rc, "msg_deleted", ch.OrgID_, contactID, map[string]any{"org_id": ch.OrgID_, "msg_id": msgID}) | ||
return queueMailroomTask(rc, "msg_deleted", ch.OrgID_, contactID, map[string]any{"msg_id": msgID}) | ||
} | ||
|
||
// queueMailroomTask queues the passed in task to mailroom. Mailroom processes both messages and | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to repeat
org_id
orcontact_id
in the task payload... mailroom gets that from the queue