Typeform.com is a fantastic surveying tool. It lets you create powerful user-friendly forms that you can share via links or embed in web pages. I've personally used Typeforms in the past to conduct user feedback surveys and market research. One of the most powerful ways to use Typeform is as a lead generation tool. For example, asking website visitors to fill out a custom survey on your website in return for a customised evaluation, free ebook or guide. This allows you to generate and qualify leads while helping people understand their problem better and teaching how you can help. Currently, a client is using Typeforms to provide an easy way to trial and participate in one of their self-development programs. The tricky part for them, however, is sending the customised responses based on the survey results. They have a fantastic set of templates but it's starting to take up way too much manual time to send each survey participant their customised response.
To fix the problem, we've decided to set up a script that runs every 5 minutes and requests form submissions that were completed in the preceding 5 minutes. It then takes each submitted set of answers, combines them back with the original questions, prints them out into a templated email and sends it to the survey participant along with any attachments (if appropriate). It also sends a copy of the email to an admin email address to keep track of results.
For more information on how to do this check out the links below.
First, I made a list with every form I wanted to automate answers from, with ids, custom content and attachments if applicable. Find a form's id by looking at the ID code in its URL, for example, with admin1234.typeform.com/to/j7w2a6ZV, the form's id is j7w2a6ZV Note the use of <br/> to create line breaks in the final HTML email.
Set up an automatically recurring function. Cron is incredibly powerful, learn more about it by checking out the links below.
Inside the Cron Job I have a loop that goes through the list of forms and performs three functions for each form. Function #1 Handles the fetching of Typeform answers. Function #2 Handles attachments Function #3 Sends the emails
My "sendEmail" function is just a lazy wrapper of SendGrid's Node Library, although I used a custom function called "makeHTMLTemplate" to form the actual HTML email.
The last step is to create the email. Someone has yet to build the best templating engine for formatting HTML emails* so I just do it with giant ugly strings; *Or I haven't bothered looking hard enough - I have removed all styling or this would look absolutely disgusting. - You can find great HTML email templates by searching on GitHub.
The resulting auto-responding emails look like this, with the Typeform answers nicely formatted, custom messages and attachments (not shown in pic).
That's it! Hope you found this interesting and or useful!!