- Create your env with the following data:
PORT=8000
NYLAS_CLIENT_ID=nylasclient
NYLAS_CLIENT_SECRET=nylasclientsecret
NYLAS_API_SERVER=https://api.nylas.com
MONGODB_URL=mongodb://localhost:27017
- Configure redirect_uri in generateAuthURL function in controllers and your Nylas App Setting dashboard to:
FRONTEND_URL/mail
- Install dependencies:
npm install
- Start the code:
npm start
This documentation provides information about the payload structure required for each endpoint.
Description: Read a user's inbox when the email page is opened for the first time.
Request Payload:
{
"email": "current-user@gmail.com"
}Description: Send an email to a recepient.
Request Payload:
{
"subject": "test",
"body": "Hi, I am puja from Nylas",
"recipient_array": [
{
"name": "Receiver 1 (can put any random name as well)",
"email": "receiver@gmail.com"
}
],
"sender_email": "current-user@gmail.com"
}Description: Star an email and show it in the favorites section.
Request Payload:
{
"email": "pujuagarwal5263@gmail.com",
"starredEmail": {
"ID":"w234",
"subject": "testt",
"unread": true,
"snippet": "Hi",
"sentTo": [
{
"name": "puja",
"email": "test@gmail.com"
}
],
"sentBy": [
{
"name": "Ajinkya Palaskar",
"email": "palaskarajinkya22@gmail.com"
}
],
"date": "2023-09-30T14:24:16.000Z",
"body": "<div dir=\"ltr\">Hi</div>"
}
}Description: Get starred emails from the database to display in the favorites section.
Request Payload:
{
"email": "current-user@gmail.com"
}Description: Schedule an email to be sent at a specified date and time.
Request Payload:
{
"email": "pujuagarwal5263@gmail.com",
"scheduledEmail": {
"ID":"w234",
"subject": "testt",
"unread": true,
"snippet": "Hi",
"sentTo": [
{
"name": "puja",
"email": "test@gmail.com"
}
],
"sentBy": [
{
"name": "Ajinkya Palaskar",
"email": "palaskarajinkya22@gmail.com"
}
],
"date": "2023-09-30T14:24:16.000Z",
"body": "<div dir=\"ltr\">Hi</div>",
"scheduledAt": "2023-10-01T11:42:00.000Z"
}
}Description: Get scheduled emails from the database to display in the scheduled section.
Request Payload:
{
"email": "current-user@gmail.com"
}Description: Get users details by sending data in parameter.
URL structure:
/get_user_details/:emailAddress
Example
/get_user_details/:current-user@gmail.com
Description: Get availablity of any authenticated user from database. Get all calendar events in upcoming 7 days.
URL structure:
/get_availability/?email=user@gmail.com
put email ID of user-whose-availability-is-to-be-checked
Description: Create an event from your mail ID or Google Account and add more participants.
Request Payload:
{
"email": "current-user@gmail.com",
"startTime":"2023-07-30T15:05:00.000Z",
"endTime":"2023-07-30T17:05:00.000Z",
"title":"Meeting for Nylas Setup",
"description":"lorem ipsum ...",
"participants":"participant1@gmail.com,participant2@gmail.com"
}Description: To summarize text in given number of sentences using NLP based library.
{
"content": "lorem ipsum ...",
"number":3
}Description: To get sentiment analysis of given content using NLP based library.
{
"content": "lorem ipsum ..."
}