Answered

Using hidden field email in mailchimp integration

  • 28 April 2022
  • 8 replies
  • 337 views

Hello, 

I have a Typeform survey and instead of asking the users for their emails, I use a hidden field (Since I already know their emails.)

I would like to use that hidden field when integrating with Mailchimp. In its current form, the connect integration does not allow that. It has to be an actual question of the survey. As shown below:


Is there a way for me to use the hidden field instead of an actual survey question without resorting to using third parties?

Thanks in advance!

icon

Best answer by levasa 29 April 2022, 22:38

View original

8 replies

I managed to make it work using a webhook running on AWS and the mailchimp sdk. But it seems it could be way simpler.

Userlevel 7
Badge +5

Hi @levasa Glad to hear you were able to make it work through webhooks! Our native integration requires an email question on the form, so the workaround you have currently sounds like a great one! You could also use Zapier to pass the data to your Mailchimp account. 

Userlevel 7
Badge +5

Can you give us more details on how you made this work, @levasa? I'm interested on this solution!

Hello, 

 

So, I wrote a lambda function, hooked it up through an API gateway endpoint.
Typeform sends the data over and it’s quite simple to parse and use. Below i a simplified version of my script. When calling Mailchimp, you can map responses to any fields you’d like too.

(handler here is a custom utility class I have to handle lambda errors, no need to worry about it for this.)
 

const mailchimp = require('@mailchimp/mailchimp_marketing');

mailchimp.setConfig({
apiKey: 'myKey',
server: 'myServer',
});

const audienceId = 'myAudience';

export const main = handler(async (event) => {
const surveyData = JSON.parse(event.body);

const subscribingUser = {
email: surveyData.form_response.hidden.email,
};

try {
const response = await mailchimp.lists.addListMember(audienceId, {
email_address: subscribingUser.email,
status: 'subscribed',
});
console.log(
`Successfully added contact as an audience member. The contact's id is ${response.id}.`
);
} catch (error) {
console.error(error);
}
});

Enjoy!

Userlevel 7
Badge +5

Hi @levasa 

Really impressed to see you went all the way to use webhooks 🤯
Kudos to you!

While this solution works you could also use Zapier or Integromat/Make if you don’t know how to code.

Userlevel 1

Hello @levasa Im the product lead at Typeform working to improve our Mailchimp integration. 
I’m working on a new feature (to map your hidden fields to mailchimp so that the integration can work without having to set up an email question) right now that I’d love your feedback on to solve your problem. Can you please schedule a meeting directly with me at https://calendly.com/chatwithjuliekim/30min

 

Userlevel 7
Badge +5

Wow, amazing @levasa! I'm really impressed! 😎

@Michaela can you explain how we can get this done using Make (in case the customer doesn't know how to code)? Thank you! 💙

Userlevel 7
Badge +6

Hello friends, hope everyone’s well 😊

 

@Gabi Amaral Happy to jump in with a bit of that no-code Make insight! 🤓

 

You could go about solving this by building a scenario that would watch your Typeform submissions and add/update your subscribers in Mailchimp. 

 

Generally speaking, when a new response is submitted to Typeform, all response details, including hidden fields, are available: 

 

That means you can then easily map any Mailchimp field with the matching Typeform form response: 

 

 

 

 

There are tons of things you could automate with Make, Typeform and Mailchimp/ If you’d like to learn more about the options, you can check out the features of the pre-built integrations we have on Make:

🖤  Typeform

💛  Mailchimp

 

Have a great rest of your day, everyone!

 

Reply