Sending automated e-mails using Expressa and Zapier

Integrating Expressa with Zapier is as easy as it gets!

Sending automated e-mails using Expressa and Zapier

Expressa has a very comprehensible and easy to use API, which makes it extremely easy to integrate it with third party applications. In this article, we'll learn how to integrate Expressa into Zapier and send automatic confirmation e-mails when a user answers a form from Google Forms.

Mind you that, while we will be using Google Forms on this example, pretty much any kind of Zapier trigger can be used instead. Let's get started!

Prerequisites: You only need an Expressa and a Zapier account to be able to follow this article.

1 - Create a form on Google Forms

First of all, we'll need a form on Google Forms to act as the trigger on Zapier. In our example, we created a simple form which receivers a support request from a customer, and we will be sending a confirmation e-mail later on. We have added two questions to our sample form: What is your name? and How can we help you? We also have the Email field, as you can see on the screenshot below, which is automatically generated when we activate the option to collect the e-mail address of the responder.

Form configuration

You may also create any kind of form that you want, you'll just need to adapt the steps of this article to your use case as we progress. The only really important detail that you need to make sure to activate is the option to collect the e-mail address of the responder, since we will send the automated e-mail to that exact address.

If you're not familiar with Google Forms, you can find more information on how to create forms here.

2 - Create a template on Expressa

After your form is created, you know which kind of data you'll be dealing with when the form is answered. As such, it's time to create a template on Expressa which makes use of that data. In our example, we will use the name of the responder and the details of the support request on the template.

Creating an Expressa template is very simple. All you need to do is opening your workspace on Expressa (create a new workspace in case it's needed) and navigate to EMail → Templates on the navigation sidebar. Then, select the option to Create a new Template.

Template and schema

There are many features available on the template editor, but for this example we just need to be sure to configure the schema of the template to reflect the data we will receive from the form, and add the schema fields as placeholders on text components within the template.

On our sample schema, we configured two properties: name and issue. Both are text properties and, later on, we will map the answer of the question What is your name? to the property name and the answer of the question How can we help you? to the property issue. Then, we added the name property as placeholder on the header of the email, and the issue property as placeholder for the content, as you can see on the screenshot above.

If you wish to understand better how the template editor works and what you can accomplish with it, be sure to read our documentation on it here. You can also learn more about how the schema works here.

3 - Configure a new Zap on Zapier

Now that both the form on Google Forms and the template on Expressa are properly created and configured, it's time to integrate both into a new Zap on Zapier. So, go to your Zapier account and create a new Zap.

The first thing you are asked to do after creating a new Zap is choosing a trigger which executes it. On our example, we will, of course, use the Google Forms trigger and the Trigger Event will be the New Form Response event. Then, connect your Google account to the Zap and select the form you want to integrate (in our case, the form is called Create Support Request). Make sure to test the trigger to ensure it works.

Trigger configuration

After you confirm the trigger, you'll be asked to select an App to process the event executed by the trigger. Since Expressa still does not have a built-in app on Zapier, we will select the app Code by Zapier. Also, choose Run Javascript as Action event.

4 - Integrate Expressa into your new Zap

The only thing left now is making the form data available for the Javascript code that will be executed by your Zap and then actually writing the code itself, so let's do that now.

First, we will make the data from the form available. If your form is different than the one we created, you may need to adapt the data to your use case, but on our case, we created three data fields: name, issue and email. The email field is required regardless of the use case, since it's the e-mail we will be sending the automated e-mail to.

After the data is properly mapped, it's time to write the code. Thankfully, Expressa already provides us with a built-in snippet of exactly what we want to achieve, so we just need to retrieve that snippet from Expressa and adapt it to our use case.

To retrieve the snippet from Expressa, open your template, open the Snippets panel and then copy the snippet called Send Mail. Afterwards, you just need to adapt it so it uses the data received from the form and insert your own API key. Generating an API key is very easy and fast, and you can find how to do it here.

After adapting the snippet, you just need to paste it into your Zap. Here's our snippet looked like after being adapted

1const url = 'https://cloud.expressa.io/api/{workspaceId}/email/mails/send'
2
3const result = await fetch(url, {
4    method: 'POST',
5    body: JSON.stringify({
6        to: inputData.email,
7        subject: "Support request confirmation",
8        templateId: "{tenantId}",
9        data: {
10          "name": inputData.name,
11          "issue": inputData.issue
12        }
13    }),
14    headers: {
15        "x-api-key": "{API_KEY}",
16        "Content-Type": "application/json",
17    }
18})
19
20// Retrieve the ID of the sent mail
21const { _id } = await result.json()
22
23output = { _id }


And that's it!

If everything was properly set up and configured, your Zap should be ready to use, so make sure to give it a test run and, if it works as expected, it is ready to be published.

Congratulations, you just integrated Expressa into Zapier and are able to send automated e-mails!

But there's more…

With this article, we are just scratching the surface of what can be accomplished with Expressa. If you're interested, make sure to read both our User and Developer documentation to discover new features. We are sure that you'll find many other use cases for Expressa.

Also, be sure to check our homepage for more information about the product. We hope you enjoyed this article and had fun experimenting with Expressa!