This content originally appeared on DEV Community and was authored by Dmytro Werner
This is a submission for the Nylas Challenge: AI Expedition.
What I Built and Why
Hello everyone 🙂
Using Nylas-API and Cloudflare-AI I have build Mailbox AI Assistant to help:
- organize your emails 💻
- send congratulations to your contacts if they have birthday 🥳
- get your next events 🎊
- automatically summarize content from email and send the answer to emails, that were not read 📖 🤖
- get information, how much emails I have got this week 🗓
Main idea was to automatize minor things, that you could forget, like congratulations or get information about your email and calendar.
Demo
First of all we could get information about emails of the current week. For this one I have used ´queryParams´ from Nylas API:
const messages = await nylas.messages.list({
identifier,
queryParams: {
received_after: Math.floor(startOfWeek.getTime() / 1000)
}
});
Second feature is to get contacts and they birthday days. If it is today, add button with functionality to send congratulations according to personal information from your contact, like name and age. This one we get from contacts using Nylas API.
const contacts = await nylas.contacts.list({
identifier,
queryParams: {},
});
Next one is to get events.
const calendars = await nylas.calendars.find({
identifier,
calendarId: "primary",
});
And now main content with most of codes. So we have emails, that are you did not read.
const messages = await nylas.messages.list({
identifier,
queryParams: {
unread: true,
},
});
You can summarize email content using cloudflare model cf/facebook/bart-large-cnn
.
In the next step you can generate the answer using other cloudflare model cf/openchat/openchat-3.5-0106
.
If you click send email, generated email will be send to person, that wrote this one.
Code
Submitting for Nylas AI and Communications Challenge
Using Nylas-API and Cloudflare-AI I have build Mailbox AI Assistant to help:
- organize your emails 💻
- send congratulations to your contacts if they have birthday 🥳
- get your next events 🎊
- automatically summarize content from email and send the answer to emails, that were not read 📖 🤖
- get information, how much emails I have got this week 🗓
Your Journey
That was really interesting to use nylas api to get information from my mail account. Best part of this, that you can write directly in your request the queryParams
with some conditions, that I have used for getting emails for current week.
Im most proud of finishing the main features of this project and integrating AI text generating with key features of Nylas API.
Most challenging was to create the concept and implement the logic for using AI to summarize and generate response of text. The solution for this was to create generating step by step with possibility to send response if thats ok or regenerate response.
I found documentation of Nylas very good structured and prepared. Very useful was the page with endpoints:
Documentation Nylas
List of models of cloudflare you can find under:
Cloudflare Models
Thanks a lot for organization this challenge. Made me happy to work on this one 🤗
This content originally appeared on DEV Community and was authored by Dmytro Werner
Dmytro Werner | Sciencx (2024-08-28T20:19:07+00:00) Nylas Mailbox AI Assistant 🤖. Retrieved from https://www.scien.cx/2024/08/28/nylas-mailbox-ai-assistant-%f0%9f%a4%96/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.