v2.4.2

marketing

Insider-backed contact management, newsletter subscription, transactional email queueing, callback forwarding, and email-event fanout.

FieldValue
Serverless servicedrive-api-marketing
Runtimenodejs22.x, arm64
Deployed HTTP operations6
Local worker harnesses1 (POST /marketing/email/transactional/process)
OpenAPI/openapi/marketing.yaml · interactive

Deployed routes

FunctionMethodPathAuthInputOutput
getContactGET/subscription/contactAPI keyQuery email or profileId{fetchMode, success, status, message, contact}
upsertContactPOST/subscription/contactAPI keyInsider contact body; optional dryRun=1Insider upsert response
emailSubscriptionPOST/subscription/emailPublicEmail subscription bodyInsider contact update response
transactionalEmailQueuePOST/marketing/email/transactional/queueAPI keyTransactionalEmailRequestQueue result or dry-run payload
transactionalEmailCallbackPOST/marketing/email/transactional/callbackPublic plus X-Ins-AuthInsider callback payload plus requestIdForwarded callback response
emailEventNotifyPOST/marketing/email/webhookPublicEmail event notification bodySNS publish result

Worker harnesses

FunctionLocal method/pathDeployed triggerPurpose
transactionalEmailProcessPOST /marketing/email/transactional/processSQSResolves attachment URLs and sends queued transactional email through InsiderMessaging.

The process operation is present in OpenAPI because it is mounted as an HTTP-shaped local harness for offline testing. It is marked with x-drive-deployment: local-test-http and is removed from deployed stacks by serverless-ifelse.

Behaviour notes

  • getContact requires exactly one lookup identity: email or Insider UUID profileId.
  • upsertContact requires identifiers.email; ContactSource=ENQUIRY sets BehaviourLastEnquiryDate, and ContactSource=ASKDRIVE applies name/value mapping.
  • emailSubscription normalises email before sending to Insider and uses NEWSLETTER_2023_DRIVE as the contact source.
  • transactionalEmailQueue resolves templateKey from DynamoDB, supports rawContent, rewrites callback URLs to the proxy endpoint, and deduplicates FIFO SQS messages by sha256 of the request body.
  • transactionalEmailCallback forwards Insider delivery events to the original callback URL stored by the queue handler. HMAC verification is currently disabled in code because the proxied request body is modified before forwarding.
  • emailEventNotify validates with EmailEventNotifySchema and publishes SNS attributes for eventSource, eventName, subject, and subjectHasFromDrive.

Source map

  • Routes and triggers: services/marketing/serverless.yml
  • Handlers: services/marketing/functions/
  • Insider integration: libs/marketing-automation/
  • Transactional email schema: services/marketing/schemas/transactional.email.request.ts
Esc