-
Notifications
You must be signed in to change notification settings - Fork 861
feat(docs): add inbound integration page to documentation #2594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
R44VC0RP
wants to merge
1
commit into
resend:canary
Choose a base branch
from
R44VC0RP:canary
base: canary
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,99 @@ | ||||||
| --- | ||||||
| title: 'Send (& recieve) emails using Inbound' | ||||||
| sidebarTitle: 'Inbound' | ||||||
| description: 'Learn how to send and recieve emails using React Email and the Inbound Node.js SDK.' | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo in the description: "recieve" should be "receive". Prompt for AI agents
Suggested change
|
||||||
| 'og:image': 'https://react.email/static/covers/react-email.png' | ||||||
| --- | ||||||
|
|
||||||
| ## 1. Install dependencies | ||||||
|
|
||||||
| Get the [@react-email/components](https://www.npmjs.com/package/@react-email/components) package and the [Inbound Node.js SDK](https://www.npmjs.com/package/inboundemail). | ||||||
|
|
||||||
| Make sure you have an account on [inbound](https://inbound.new), you will need an inbound API key. | ||||||
|
|
||||||
| <CodeGroup> | ||||||
|
|
||||||
| ```sh npm | ||||||
| npm install inboundemail @react-email/components | ||||||
| ``` | ||||||
|
|
||||||
| ```sh yarn | ||||||
| yarn add inboundemail @react-email/components | ||||||
| ``` | ||||||
|
|
||||||
| ```sh pnpm | ||||||
| pnpm add inboundemail @react-email/components | ||||||
| ``` | ||||||
|
|
||||||
| ```sh bun | ||||||
| bun add inboundemail @react-email/components | ||||||
| ``` | ||||||
|
|
||||||
| </CodeGroup> | ||||||
|
|
||||||
| ## 2. Create an email using React | ||||||
|
|
||||||
| Start by building your email template in a `.jsx` or `.tsx` file. | ||||||
|
|
||||||
| ```tsx email.tsx | ||||||
| import * as React from 'react'; | ||||||
| import { Html, Button } from "@react-email/components"; | ||||||
|
|
||||||
| export function Email(props) { | ||||||
| const { url } = props; | ||||||
|
|
||||||
| return ( | ||||||
| <Html lang="en"> | ||||||
| <Button href={url}>Click me</Button> | ||||||
| </Html> | ||||||
| ); | ||||||
| } | ||||||
|
|
||||||
| export default Email; | ||||||
| ``` | ||||||
|
|
||||||
| ## 3. Send email | ||||||
|
|
||||||
| <Info>When integrating with other services, you need to convert your React template into HTML before sending. Inbound takes care of that for you. You can just directly pass the React template to the SDK.</Info> | ||||||
|
|
||||||
| Import the email template you just built and use the Inbound SDK to send it. | ||||||
|
|
||||||
| ```tsx | ||||||
| import { Inbound } from 'inboundemail'; | ||||||
| import { Email } from './email'; | ||||||
|
|
||||||
| const inbound = new Inbound(process.env.INBOUND_API_KEY); | ||||||
|
|
||||||
| await inbound.emails.send({ | ||||||
| from: '[email protected]', | ||||||
| to: '[email protected]', | ||||||
| subject: 'hello world', | ||||||
| react: <Email url="https://example.com" />, | ||||||
| }); | ||||||
| ``` | ||||||
|
|
||||||
| ## 4. Reply to an email | ||||||
|
|
||||||
| Use the Inbound SDK to reply to an email with the same template you just created. | ||||||
|
|
||||||
| ```tsx | ||||||
| import { Inbound } from 'inboundemail'; | ||||||
| import { Email } from './email'; | ||||||
|
|
||||||
| const inbound = new Inbound(process.env.INBOUND_API_KEY); | ||||||
|
|
||||||
| await inbound.emails.reply(email.id,{ | ||||||
| react: <Email url="https://example.com" />, | ||||||
| }); | ||||||
| ``` | ||||||
|
|
||||||
| ## Try it yourself | ||||||
|
|
||||||
| <Card | ||||||
| title="Inbound example" | ||||||
| icon='arrow-up-right-from-square' | ||||||
| iconType="duotone" | ||||||
| href="https://github.com/inboundemail/inbound" | ||||||
| > | ||||||
| See the full source code. | ||||||
| </Card> | ||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "recieve" should be spelled "receive" in the page title.
Prompt for AI agents