Automating Email Sending from Notion with AWS SES
Published on November 17, 2023
Introduction
Streamline your email communication by integrating Notion with AWS Simple Email Service (SES). In this tutorial, we'll guide you through the process of setting up an automation workflow to send emails using data from a Notion database. You'll accomplish this without writing complex code, thanks to the power of CodelessAPI.
Why CodelessAPI
CodelessAPI offers a user-friendly platform for creating integrations. It's available on a free plan, which means you can get started without upfront costs. With its intuitive visual interface, automation capabilities, and support for bulk emails, CodelessAPI provides more customization and flexibility compared to alternatives like Zapier and Make.
Prerequisites
- An AWS SES account: Before you begin, ensure you have an AWS SES account. If you don't have one, follow the official AWS SES setup guide to create an account. Make a note of the region you created your AWS SES account in. You can find this in the top right-hand corner of your AWS dashboard, revealing the region code (e.g., "us-east-1").
- A Notion account: You'll need access to your Notion account and a database containing the data you want to send via email.
- A CodelessAPI.io account: Sign up for a free account on CodelessAPI.io to set up the integration.
Step 1: Create an IAM Role in AWS
To allow CodelessAPI to interact with AWS SES, you need to create an IAM (Identity and Access Management) role in your AWS account. IAM roles provide the necessary permissions for CodelessAPI to access AWS services securely. These roles ensure that your integration is both controlled and secure. You can follow the AWS IAM setup guide to create the role. Here are the steps to create an IAM role:
- Log in to your AWS Management Console.
- Navigate to the Identity and Access Management (IAM) console.
- Choose "Roles" from the left sidebar.
- Click the "Create role" button to begin creating a new role.
- For use cases, use "CodelessAPI" or an appropriate use case for your integration.
- Now, select "Permissions" for the role. Search for "AmazonSES_FullAccess" and attach this policy to your role. This policy grants CodelessAPI the necessary permissions to use AWS SES.
- Follow the on-screen instructions to complete the role creation. You'll be asked to name the role and add tags if needed.
Step 2: Generate Access Keys
Access Key ID and Secret Access Key are credentials that allow CodelessAPI to authenticate and interact with AWS SES securely. Access Keys act as the credentials that grant access to your AWS resources without exposing your AWS account's root user credentials. To generate Access Keys for your IAM role, follow these steps:
- Log in to your AWS Management Console.
- Navigate to the Identity and Access Management (IAM) console.
- Choose "Roles" from the left sidebar.
- Search for the role you created earlier (the one for CodelessAPI) and click on it.
- In the role details, navigate to the "Security credentials" tab.
- Click "Create access key" to generate new Access Keys.
- Once generated, you'll see the Access Key ID and Secret Access Key. Make sure to copy both and save them in a secure location. You'll need these keys to configure the AWS SES module in CodelessAPI.
Refer to the AWS IAM Access Key setup guide for mode detailed instructions.
Step 3: Set Up CodelessAPI Workflow
CodelessAPI provides a user-friendly and intuitive platform for setting up integrations. It offers a free plan that allows you to get started without any upfront costs. In this step, we'll create a new workflow in CodelessAPI to integrate Notion and AWS SES.
- Access CodelessAPI: Log in to your CodelessAPI.io account.
- Navigate to Workflow: Click on the "Create new Workflow" button in the Workflow section of your dashboard.
- Create your Workflow: Provide a name and description for your Workflow, and then click "Create". You'll be redirected to the Workflow builder page.
Step 4: Connect Notion to CodelessAPI
Now, let's connect your Notion data to CodelessAPI. This connection will allow you to access the data you want to include in your emails. Here's how:
- Drag Notion Module: In the left sidebar of your workflow builder, expand the "Data" section, then expand the "Read" section and find the Notion module and drag it onto your canvas.
- Configure Notion Module: Click on the Notion module you've added to your canvas. This is where you'll set up the connection. Click on "New Notion Account"
- Authenticate Your Notion Account: Follow the authentication process to connect your Notion account to CodelessAPI. Select the relevant workspace and database that contains the data you want to send via email with SendGrid.
- Link the modules To dictate the flow of data, you need to link your modules together. Click the "Start" module and then click "Link". You should see a blue line with an arrow pointing towards your cursor. Move your cursor over to the "Notion" module and click. You should now see an arrow going from the Start module to the Notion module.
Step 5: Add the Text Replace Module
Use the "Text Replace" module if you'd like to send personalized emails or would like to use a custom template.
- Drag Test Replace Module: In the left sidebar of your workflow builder, expand the "Operations" section and find the "Text Replace" module and drag it onto your canvas.
- Link the modules Similar to above, link the "Notion" module to the "Text Replace" module.
- Configure the Text Replace Module: Click on the Text Replace module you've added to your canvas. Within the "Text body" field is where you can paste your html template or your personalized message.
- Replace words for customizability Use the "Add new replace condition" option to replace words from your body text. By setting the "Replace with" to the "map" option. You can select a field from the Notion data source. Make sure to click on the "Add replace condition" button after you've added yoru condition!
For example, the body text "Hi [NAME]" can have the "[NAME]" replaced with data from the Notion source. Each row in the data source will generate a new personalized template with all the words replaced based on the "Text Replace" modules configurations.
You've now added the ability to generate personalized templates! Link the "Text Replace" module to the "End" module and click run to see the output templates. Optionally add the "ChatGPT" module to before the "Text Replace" module, and then feed in both Notion and the "ChatGPT" module to automate generating personalized emails!
Step 6: Adding the AWS SES Module
Now that you've set up your data source, it's time to add the AWS SES module to your workflow. The AWS SES module will enable you to send emails efficiently and effectively. Follow these steps to add it to your canvas:
- Access Advanced Operations: In the left sidebar of the workflow builder, find the "Advanced Operations" section and expand it.
- Select AWS SES: Among the advanced options, locate the "AWS SES" module and drag it onto your canvas.
- Link the modules Similar to above, this time link both the "Notion" module and the "Text Replace" module to the "AWS SES" module.
With the AWS SES module added, you're ready to configure it to connect securely to your AWS SES account.
Step 7: Configuring AWS SES Module
The AWS SES module is now on your canvas, and you'll need to configure it to connect to your AWS SES account securely. To configure the AWS SES module, follow these steps:
- Add AWS SES Account Click on the AWS SES module on the canvas, and then select "Configure" from the options. In the configuration panel, click on "New AWS SES Account" and paste your Access Key ID and Secret Access Key and add your AWS SES region. Provide a name and description for the account.
- Set email values You'll now be able to configure the email settings by clicking on your newly created AWS SES account and filling out the necessary details. These details include the sender's email, recipient's email, email subject, and email content. You can either set these fields manually or use a "map" option to automate the process.
The "From email" option refers to the email address from which your AWS account will send emails. Ensure that these email addresses are verified in your AWS SES account. You can verify individual email addresses (e.g., "hello@codelessapi.io") or domain identities (e.g., "codelessapi.io"). Verifying domain identities allows you to send emails from any email address under that domain. You can follow the official AWS SES documentation for more details on email verification.
All the fields, including sender and recipient emails, subject, and content, can be set manually or mapped to data from your Notion module. Mapping fields is useful when you want to send mass emails. You can connect a data source to your AWS SES module and select specific fields from your data source. For example, if your Notion contains a list of leads with an "Email" column, you can map the recipient email field to this column. This way, you can send emails to multiple recipients based on your data source. CodelessAPI makes it easy to automate the process, saving you time and effort.
- Link the modules You can now link the "AWS SES" module to the "End" module. This completes you workflow and ensures that it operates seamlessly.
Step 8: Testing and Running the Workflow
Before you finalize your email automation, it's crucial to test your workflow and ensure that emails are sent correctly. Here's how you can run the workflow for validation:
- Use Built-in Run Feature: CodelessAPI.io offers a built-in run feature to validate your API endpoint. Click the "Run" button located at the bottom of the left sidebar to test your workflow.
- Inspect Results: Review the results of your test run. Ensure that emails are being sent correctly and that the data flows as expected.
- Copy API Link: Once you're satisfied with the results, you can either run your workflow manually or copy the API associated with your workflow to trigger it based on an event. Find your Workflow API by clicking on the "Start" module and selecting the "Configuration" option. Copy the provided API link.
Conclusion
With the power of CodelessAPI, AWS SES, and Notion integration, you can streamline your email workflows and reach your audience seamlessly. Automating email sending from Notion is now a code-free process, allowing you to focus on your content and audience engagement.
If you encounter any issues or have questions, feel free to reach out to our support team at hello@codelessapi.io. Happy emailing!