I'm trying to connect a Mailchimp webhook to my application hosted with Vercel. The webhook connects properly using an appropriate GET and POST in my app, but it cannot verify the request headers from Mailchimp.
According to the docs, the mailchimp webhook req will have either a x-mandrill signature in the header or an x-mailchimp one. I cannot see either in my app. Here is the relevent docs: :~:text=Mailchimp%20includes%20an%20X%2DMandrill,hexadecimal%20signature%20will%20not%20work.
Mailchimp includes an X-Mandrill-Signature HTTP header with webhook POST requests; this header will contain the signature for the request. To verify a webhook request, you’ll need to generate a signature using the same method and key that Mailchimp Transactional uses and compare that to the value of the X-Mandrill-Signature header.
Here is my code:
const mailchimpSignature = req.headers['x-mailchimp-signature'] ||
req.headers['X-Mailchimp-Signature'];
const mandrillSignature = req.headers['x-mandrill-signature'] ||
req.headers['X-Mandrill-Signature'];
console.log('Signature headers present:', {
mailchimp: !!mailchimpSignature,
mandrill: !!mandrillSignature
});
// If neither signature is present, log available headers and fail verification
if (!mailchimpSignature && !mandrillSignature) {
console.error('No signature headers found. Available header names:', Object.keys(req.headers));
return false;
}
There is only Vercel headers, is it a problem with Vercel or am I missing a beat for mailchimp webhook authentication?
Thank you
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744871126a4598267.html
评论列表(0条)