A simple lambda function that can be used to transfer SendGrid event data to Mixpanel pings.
-
To get started, you'll need the Serverless Framework installed. You'll also need your environment configured with AWS credentials.
-
Recommended: Map relevant Mixpanel characteristics to SendGrid SMTP API unique_args for the emails you are sending through SendGrid.
-
Add the MIXPANEL_TOKEN env var for each environment to
serverless.env.yml
.
dev:
MIXPANEL_TOKEN: "DEV TOKEN"
staging:
MIXPANEL_TOKEN: "STAGING TOKEN"
prod:
MIXPANEL_TOKEN: "PROD TOKEN"
-
Add your AWS credentials profile to
serverless.yml
. -
Deploy.
sls deploy --stage prod
- Setup the SendGrid Event Webhook with the lambda endpoint.
HTTP POST URL
https://EXAMPLE.execute-api.us-east-1.amazonaws.com/dev/mixpanel_sendgrid_events
- ๐ SendGrid event data is in Mixpanel and I don't have to run the webhook through our app!