From 9ea14dab6d79a51452fd03625393c2d123850ee5 Mon Sep 17 00:00:00 2001 From: cohitre Date: Mon, 4 Mar 2024 19:44:41 -0800 Subject: [PATCH] Code example --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b8f9429..93f920c 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,32 @@ Coming soon We'll use [Waypoint](https://www.usewaypoint.com) for this example, however, you can use any email API like Amazon SES, SendGrid, or MailGun. -
+```javascript +import axios from 'axios'; + +import { renderHtmlDocument } from '@usewaypoint/email-builder'; + +// Replace this with the JSON for your Reader document +const CONFIGURATION: TReaderDocument = {} + +await axios({ + method: 'post', + url: 'https://live.waypointapi.com/v1/email_messages', + headers: { + 'Content-Type': 'application/json', + }, + auth: { + username: API_KEY_USERNAME, + password: API_KEY_PASSWORD, + }, + + data: { + to: 'friend@example.com', + subject: 'Hello', + bodyHtml: renderHtmlDocument(CONFIGURATION, 'root'), + }, +}); +``` ---