0% found this document useful (0 votes)
30 views2 pages

Resend API Key Setup Guide

On Day 11, participants will set up Resend, an API-first email platform for sending transactional emails. The session includes creating an account, generating an API key, adding and verifying a domain, and exploring documentation for sending emails. By the end, participants will be prepared to integrate email functionality into their app.

Uploaded by

william98607
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Resend API Key Setup Guide

On Day 11, participants will set up Resend, an API-first email platform for sending transactional emails. The session includes creating an account, generating an API key, adding and verifying a domain, and exploring documentation for sending emails. By the end, participants will be prepared to integrate email functionality into their app.

Uploaded by

william98607
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

📘 Day 11: Resend Setup for Emails

A great app communicates with its users. Today, we'll set up the final tool in our stack:
Resend. We will create a Resend account, get our API key, and prepare for the integration
that will allow our app to send transactional emails, like a welcome message upon signup.
🎯 Learning Objectives

By the end of today's session, you will be able to:


● Set up a Resend project and API key.
● Understand the difference between a test domain and a custom domain.
● Add and verify a domain with Resend.
● Locate the necessary code examples in the Resend documentation for sending an
email.
🧰 What is Resend?

Resend is an API-first email platform for developers. It focuses exclusively on transactional


email—the automated, one-to-one emails triggered by user actions:
● Welcome emails
● Password resets
● Invoices and receipts
● Notifications
For deliverability and reputation, email services like Resend require you to send from a
domain you own and have verified. For testing, however, they provide a "sandbox"
environment.
✅ Action Plan: Setting Up Your Mail Carrier (Approx. 45 mins)

1. Log into Resend:


○ Log into the Resend account you created on Day 1.
2. Create Your API Key:
○ On the left-side menu, navigate to "API Keys".
○ Click "+ Create API Key".
○ Name it something descriptive, like 14-Day-App-Key.
○ Set the "Permission" to "Full access".
○ Click "Add".
○ IMPORTANT: Resend will show you your API key only once. Copy it immediately
and save it somewhere secure (like a password manager or a private note). You
will need this tomorrow.
3. Add Your Domain:
○ On the left-side menu, navigate to "Domains".
○ Click "+ Add Domain".
○ Resend provides instructions for adding DNS records (like MX, TXT) to your
domain registrar (where you bought the domain, e.g., GoDaddy, Namecheap).
This step is for a "real" app.
○ For this course, we can use the default test sandbox. Resend allows you to
send test emails from onboarding@[Link] without setting up a custom
domain. This is perfect for development.
4. Explore the Documentation:
○ Go to the Resend Documentation ([Link]/docs).
○ Find the "Quickstart" guide.
○ Look at the code examples for sending an email. Notice the key pieces of
information required: from, to, subject, and the html body of the email.
○ You'll see you need your API key to authorize the request.
🤔 Reflection & Review (Approx. 15 mins)

● Why do email services like Resend require you to verify a domain you own before you
can send emails from it? What would happen if this rule didn't exist?
● An API key is like a password for your application. What's the risk if your Resend API key
was leaked publicly (e.g., you accidentally pushed it to GitHub)?
● Look at the code examples in the Resend docs. What are some ideas for other
transactional emails your app could send in the future to improve the user experience?
🎉 Day 11 Progress Checklist

● [ ] I have logged into my Resend account.


● [ ] I have created a new API key and stored it securely.
● [ ] I understand how to use the onboarding@[Link] address for testing.
● [ ] I have reviewed the Resend documentation and know what information is needed to
send an email.
● [ ] I am ready to integrate email into my app.

Common questions

Powered by AI

Developers can ensure the secure storage of API keys by using environment variables or dedicated secret management services such as AWS Secrets Manager or HashiCorp Vault. Keys should not be hardcoded in source files or shared in version control systems. Additionally, developers should adopt practices like regular key rotation, monitoring and alerting on unusual API usage patterns, limiting permissions to necessary scopes, and educating team members about security best practices. These measures help prevent accidental exposure and unauthorized access .

Transactional emails play a crucial role in enhancing user experience by providing timely and relevant communications based on user actions. Beyond welcome emails, password resets, and notifications, potential applications include onboarding guides for new users, account activity alerts (e.g., unusual login attempts), personalized product recommendations based on user behavior, order shipment updates, and engagement metrics for subscription renewals. These emails not only improve the user journey but also foster engagement and trust by ensuring users are informed and connected with the service .

If a Resend API key is exposed publicly, it could be exploited by unauthorized users to send emails on behalf of the application, leading to potential abuse such as spam or fraudulent activities. This could damage the application's reputation and lead to blacklisting of the domain. To mitigate these risks, developers should store API keys in secure environments, such as encrypted storage or secret management tools, avoid hardcoding them into source files, and routinely rotate keys. Additionally, it is critical to monitor usage for suspicious activities and revoke any compromised keys immediately .

The learning objectives for setting up Resend include creating a Resend project and API key, understanding domain verification, and locating code examples in documentation. These objectives contribute to developing app communication features by equipping developers with the necessary skills to establish a reliable email system which is crucial for delivering transactional emails. By grasping domain verification, developers ensure email deliverability and reputation, and by mastering API usage, they enable programmatic email sending. Together, these skills enhance the app's capability to engage users effectively, improving the overall user experience and interaction .

Reviewing documentation such as Resend's is crucial before implementing transactional email features because it provides developers with a comprehensive understanding of the service's capabilities, best practices, and configuration requirements. This practice ensures that developers are aware of current APIs, understand the parameters needed for successful integration, and can troubleshoot common issues effectively. Additionally, it helps prevent errors by clarifying steps for secure implementation and usage limitations, contributing to a more efficient development process and reducing time spent on debugging .

It's important for email services like Resend to require verification of domain ownership to ensure emails are sent from legitimate and authorized sources. This helps prevent spoofing, where malicious actors send emails pretending to be from a trusted domain, which could lead to phishing attacks or reputational damage. If this verification step was not enforced, there would be an increased risk of spam and fraudulent activities, as any unauthorized user could send emails from domains they do not control, compromising email deliverability and user trust .

A test domain in Resend allows you to send emails from a generic address (e.g., onboarding@resend.dev) without setting up a custom domain. This is useful for development as it simplifies the initial setup and avoids the need for domain verification. A custom domain requires verification through DNS records, allowing emails to be sent from a domain that you own, which is essential for production environments where brand consistency and trust are important. The main difference in integration is the additional step of domain verification for custom domains, which involves updating DNS settings with your domain registrar .

The sandbox environment provided by Resend plays a critical role in the email integration process by allowing developers to test sending emails without configuring a custom domain. This greatly benefits developers during the testing phase by simplifying setup, reducing configuration time, and avoiding costs associated with domain verification, particularly in early development stages. It provides a controlled environment for developers to experiment and debug their email integration, ensuring that the logic works properly before deploying to a live environment .

Key elements needed from the Resend documentation to successfully send an email include the sender’s address ('from'), the recipient’s address ('to'), the email subject, and the HTML body content. Each element is important as 'from' indicates the source of the email, essential for domain reputation and user trust; 'to' specifies the recipient, crucial for ensuring delivery to the right user; the subject serves as the headline capturing the recipient's attention; and the HTML body contains the actual message, ensuring the email is informative and engaging. Additionally, using the API key authorizes the email-sending request .

Integrating Resend involves several crucial steps: logging into your Resend account, creating an API key, and adding/verifying a domain. It's important to securely store the API key as it grants full access to sending emails. Next, developers need to configure the domain, which includes setting DNS records for verification to ensure emails are sent from authorized sources. Reviewing and implementing code examples from the Resend documentation helps developers understand the necessary parameters (from, to, subject, body) and prepare for API requests. Considerations during setup include security of the API key, ensuring DNS is correctly configured, and understanding the limitations of the test environment versus production .

You might also like