MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / buildInboundReleasedEvent

Method buildInboundReleasedEvent

internal/agent/webhooks_api.go:172–190  ·  view source on GitHub ↗

buildInboundReleasedEvent fires when a reviewer releases a held inbound message to the agent (status pending_review → review_approved, now inbox- visible). This is the ONLY push signal an approved inbound message gets: email.received was suppressed while it was held and is not re-fired on release (p

(msg *identity.ReviewMessageMeta, ownerUserID, reviewerUserID string)

Source from the content-addressed store, hash-verified

170// is account-scoped + ownership-checked) but are kept distinct so a future
171// multi-reviewer ACL can't misroute the event to a non-owner reviewer.
172func (a *API) buildInboundReleasedEvent(msg *identity.ReviewMessageMeta, ownerUserID, reviewerUserID string) webhookpub.Event {
173 data := map[string]interface{}{
174 "message_id": msg.ID,
175 "direction": "inbound",
176 "from": msg.Sender,
177 "subject": msg.Subject,
178 "type": msg.Type,
179 "reviewed_by_user_id": reviewerUserID,
180 }
181 return webhookpub.Event{
182 ID: generateEventIDForAgent(),
183 Type: webhookpub.EventEmailReviewApproved,
184 CreatedAt: time.Now().UTC(),
185 UserID: ownerUserID,
186 AgentID: msg.AgentID,
187 MessageID: msg.ID,
188 Data: data,
189 }
190}
191
192// buildInboundRejectedEvent fires when a reviewer drops a held inbound message
193// (status pending_review → review_rejected; it stays hidden from the agent and

Calls 1

generateEventIDForAgentFunction · 0.85

Tested by 1