Charles Snelgrove
Charles Snelgrove

Reputation: 1

What is the correct format for the signed data when matching the x-mandrill-signature for webhook authentication?

I can't get the signature I generate to match the signature in the x-mandrill-signature header as described in https://mailchimp.com/developer/transactional/guides/track-respond-activity-webhooks/#authenticating-webhook-requests

Here is the data (modified for anonymity) I have from the webhook: URl - https://webhook.site/totally-real-UUID

Headers
content-type            application/x-www-form-urlencoded
content-length          649
x-mandrill-signature    6k2SNoA7LhKOiM8ZOajMNNlajK4=
accept                  */*
host                    webhook.site
user-agent          Mandrill-Webhook/1.0

Raw Content

mandrill_events=%5B%7B%22event%22%3A%22send%22%2C%22_id%22%3A%22468397ea38324bb6a14fa24d2caf28c5%22%2C%22msg%22%3A%7B%22ts%22%3A1722280404%2C%22subject%22%3A%22My+totally+real+subject%22%2C%22email%22%3A%fake%40email.com%22%2C%22tags%22%3A%5B%5D%2C%22opens%22%3A%5B%5D%2C%22clicks%22%3A%5B%5D%2C%22state%22%3A%22sent%22%2C%22smtp_events%22%3A%5B%5D%2C%22subaccount%22%3A%22Totally+Real+Emails%22%2C%22resends%22%3A%5B%5D%2C%22reject%22%3Anull%2C%22_id%22%3A%22468397ea38324bb6a14fa24d2caf28c5%22%2C%22sender%22%3A%22info%40mydomain.com%22%2C%22template%22%3A%22very-real-template%22%7D%2C%22ts%22%3A1722280404%7D%5D

Form values

mandrill_events [{"event":"send","_id":"468397ea38324bb6a14fa24d2caf28c5","msg":{"ts":1722280404,"subject":"My totally real subject","email":"[email protected]","tags":[],"opens":[],"clicks":[],"state":"sent","smtp_events":[],"subaccount":"Totally Real Emails","resends":[],"reject":null,"_id":"468397ea38324bb6a14fa24d2caf28c5","sender":"[email protected]","template":"very-real-template"},"ts":1722280404}]

I've tried constructing the signed data several different ways, but I can' figure out how it's supposed to be formatted to give me the correct signature. Here are some examples that haven't worked:

signed_data="https://webhook.site/totally-real-UUIDmandrill_events%5B%7B%22event%22%3A%22send%22%2C%22_id%22%3A%22468397ea38324bb6a14fa24d2caf28c5%22%2C%22msg%22%3A%7B%22ts%22%3A1722280404%2C%22subject%22%3A%22My+totally+real+subject%22%2C%22email%22%3A%fake%40email.com%22%2C%22tags%22%3A%5B%5D%2C%22opens%22%3A%5B%5D%2C%22clicks%22%3A%5B%5D%2C%22state%22%3A%22sent%22%2C%22smtp_events%22%3A%5B%5D%2C%22subaccount%22%3A%22Totally+Real+Emails%22%2C%22resends%22%3A%5B%5D%2C%22reject%22%3Anull%2C%22_id%22%3A%22468397ea38324bb6a14fa24d2caf28c5%22%2C%22sender%22%3A%22info%40mydomain.com%22%2C%22template%22%3A%22very-real-template%22%7D%2C%22ts%22%3A1722280404%7D%5D"
signed_data="https://webhook.site/totally-real-UUIDmandrill_events[{"event":"send","_id":"468397ea38324bb6a14fa24d2caf28c5","msg":{"ts":1722280404,"subject":"My totally real subject","email":"[email protected]","tags":[],"opens":[],"clicks":[],"state":"sent","smtp_events":[],"subaccount":"Totally Real Emails","resends":[],"reject":null,"_id":"468397ea38324bb6a14fa24d2caf28c5","sender":"[email protected]","template":"very-real-template"},"ts":1722280404}]"
signed_data="https://webhook.site/totally-real-UUIDmandrill_eventseventsend_id468397ea38324bb6a14fa24d2caf28c5msgts1722280404subjectMy totally real [email protected]_eventssubaccountTotally Real Emailsresendsrejectnull_id468397ea38324bb6a14fa24d2caf28c5senderinfo@mydomain.comtemplatevery-real-templatets1722280404"

How the data should be formatted?

Upvotes: 0

Views: 30

Answers (0)

Related Questions