node.js - Mailchimp Webhooks x-mandrill-signature or x-mailchimp-signature - Stack Overflow

I'm trying to connect a Mailchimp webhook to my application hosted with Vercel.The webhook connec

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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信