@@ -42,22 +42,7 @@ func queueChannelEvent(rc redis.Conn, c *Contact, e *ChannelEvent) error {
42
42
body ["optin_id" ] = e .OptInID_
43
43
}
44
44
45
- switch e .EventType () {
46
- case courier .EventTypeStopContact :
47
- return queueMailroomTask (rc , "stop_contact" , e .OrgID_ , e .ContactID_ , body )
48
- case courier .EventTypeWelcomeMessage :
49
- return queueMailroomTask (rc , "welcome_message" , e .OrgID_ , e .ContactID_ , body )
50
- case courier .EventTypeReferral :
51
- return queueMailroomTask (rc , "referral" , e .OrgID_ , e .ContactID_ , body )
52
- case courier .EventTypeNewConversation :
53
- return queueMailroomTask (rc , "new_conversation" , e .OrgID_ , e .ContactID_ , body )
54
- case courier .EventTypeOptIn :
55
- return queueMailroomTask (rc , "optin" , e .OrgID_ , e .ContactID_ , body )
56
- case courier .EventTypeOptOut :
57
- return queueMailroomTask (rc , "optout" , e .OrgID_ , e .ContactID_ , body )
58
- default :
59
- return fmt .Errorf ("unknown event type: %s" , e .EventType ())
60
- }
45
+ return queueMailroomTask (rc , "channel_event" , e .OrgID_ , e .ContactID_ , body )
61
46
}
62
47
63
48
func queueMsgDeleted (rc redis.Conn , ch * Channel , msgID courier.MsgID , contactID ContactID ) error {
@@ -70,15 +55,13 @@ func queueMailroomTask(rc redis.Conn, taskType string, orgID OrgID, contactID Co
70
55
// create our event task
71
56
eventJSON := jsonx .MustMarshal (mrTask {
72
57
Type : taskType ,
73
- OrgID : orgID ,
74
58
Task : body ,
75
59
QueuedOn : time .Now (),
76
60
})
77
61
78
62
// create our org task
79
63
contactJSON := jsonx .MustMarshal (mrTask {
80
64
Type : "handle_contact_event" ,
81
- OrgID : orgID ,
82
65
Task : mrContactTask {ContactID : contactID },
83
66
QueuedOn : time .Now (),
84
67
})
@@ -103,7 +86,6 @@ type mrContactTask struct {
103
86
104
87
type mrTask struct {
105
88
Type string `json:"type"`
106
- OrgID OrgID `json:"org_id"`
107
89
Task any `json:"task"`
108
90
QueuedOn time.Time `json:"queued_on"`
109
91
}
0 commit comments