Version:
Only show these results:

Clean Conversation in Nylas v2

Clean Conversation has been updated for Nylas v3! For more information, see the v3 Clean Conversation documentation.

Nylas' Neural APIs are the intelligence center of the platform. They provide machine learning capabilities that abstract complex AI techniques so they can be applied to any data connected to Nylas. You can easily start using the Neural APIs without any previous AI training or machine learning expertise.

The Clean Conversation endpoint uses neural language processing and machine learning to remove all extra information (for example, images and attachments) from an email message and return only the information that you need.

ℹ️ Clean Conversations is available for Plus plans only. Not available for Calendar-only plans.

How Clean Conversation works

When you make a request to the Clean Conversation endpoint, Nylas uses advanced neural language processing and machine learning models to clean structured email messages. It extracts the relevant content using a machine learning model, and caches the results to reduce response times.

Configuration options

The Clean Conversation endpoint offers multiple options to control how Nylas parses email messages:

  • ignore_links: When true, removes links in the message or signature. Defaults to true.
  • ignore_images: When true, removes images from the message or signature. Defaults to true.
  • images_as_markdown: When true, Nylas returns images as Markdown links. Defaults to false.
  • ignore_tables: When true, removes tables from the message or signature. Defaults to true.
  • remove_conclusion_phrases: When rue, removes phrases such as "Best" and "Regards" in the signature. Defaults to true.

You set each of these options on a per-request basis, so no need to worry about deciding how you want all of your cleaned email messages to look. For more information, see the Clean Conversation reference documentation.

Clean an email message

To clean an email message, make a PUT /neural/conversation request that includes the ID of the message you want to update. You can also specify whether Nylas should ignore included links, images, and more while cleaning the message.

Nylas returns the parsed email message as part of the message object. All of the extra HTML content is stripped out, leaving only the message text.

curl --location --request PUT 'https://api.nylas.com/neural/conversation' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"message_id": ["10vg4dz96l004qluhp5rk7gbb"]
}'
[
{
"account_id": "**********",
"bcc": [],
"body": "<div dir=\"ltr\"><div id=\":ar\" class=\"a3s aiL msg4815224842221839925\"><u></u>\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n<div style=\"margin-bottom:0;padding-bottom:0;min-width:100%;margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-right:0;padding-left:0;width:100%\"><div id=\"m_4815224842221839925emailPreHeader\" style=\"opacity:0;color:transparent;line-height:0;font-size:0px;overflow:hidden;border-width:0;display:none!important\">Virtual calendars are now included with Nylas Platform and Calendar subscriptions.</div> \n<div style=\"display:none;white-space:nowrap;font:15px courier;line-height:0\">\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\n</div> \n \n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-spacing:0;border-collapse:collapse\"> \n<tbody> \n<tr> \n<td valign=\"top\" style=\"word-break:break-word;min-width:600px;border-collapse:collapse;background-color:#f2f3f3\"> \n<table width=\"600\" align=\"center\" id=\"m_4815224842221839925boxing\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-spacing:0;border-collapse:collapse\"> \n<tbody> \n<tr> \n<td id=\"m_4815224842221839925template-wrapper\" style=\"word-break:break-word;border-collapse:collapse\">\n<table id=\"m_4815224842221839925free-logo\" style=\"border-spacing:0;border-collapse:collapse\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse\" valign=\"top\"> \n<center> \n<table class=\"m_4815224842221839925table600 m_4815224842221839925table_header_logo\" style=\"border-spacing:0;border-collapse:collapse;margin-top:0;margin-right:auto;margin-bottom:0;margin-left:auto;background:#000\" bgcolor=\"#000000\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\" height=\"86\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse\"> \n<center> \n<div id=\"m_4815224842221839925singleIMG1\">\n<a href=\"https://email.nylas.com/CSQ00K0mV0NL03BE3O02W06\" target=\"_blank\"> <img class=\"m_4815224842221839925img_header_logo CToWUd\" alt=\"Logo\" style=\"outline:none;border-right-width:0;border-bottom-width:0;border-left-width:0;text-decoration:none;border-top-width:0;display:block;max-width:100%;line-height:100%\" width=\"126\" src=\"https://12qf1516hja245v1v537ieww-wpengine.netdna-ssl.com/wp-content/uploads/2019/08/[email protected]\"> </a>\n</div> \n</center> </td> \n</tr> \n</tbody> \n</table> \n</center> </td> \n</tr> \n</tbody> \n</table>\n<table id=\"m_4815224842221839925free-image1\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse;background-color:#ffffff\" bgcolor=\"#ffffff\" valign=\"top\"> \n<center> \n<div id=\"m_4815224842221839925singleIMG2\">\n<a href=\"https://email.nylas.com/x0L0000N3n20V3S0LB6QEWO\" target=\"_blank\"> <img class=\"m_4815224842221839925img_full CToWUd\" alt=\"[email protected]\" style=\"outline:none;border-right-width:0;border-bottom-width:0;border-left-width:0;text-decoration:none;border-top-width:0;display:block;max-width:100%;line-height:100%\" width=\"600\" src=\"https://info.nylas.com/rs/857-LSW-455/images/Virtual_Calendar_NewsletterHero%402x.png\"> </a>\n</div> \n<table class=\"m_4815224842221839925table600\" style=\"border-spacing:0;border-collapse:collapse;margin-top:0;margin-right:auto;margin-bottom:0;margin-left:auto\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\"> \n<tbody> \n</tbody> \n</table> \n</center> </td> \n</tr> \n</tbody> \n</table>\n<table id=\"m_4815224842221839925free-text\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse;background-color:#ffffff\" bgcolor=\"#ffffff\" valign=\"top\"> \n<center> \n<table class=\"m_4815224842221839925table600 m_4815224842221839925table_header_content\" style=\"border-spacing:0;border-collapse:collapse;margin-top:0;margin-right:auto;margin-bottom:0;margin-left:auto\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse;line-height:40px;font-size:40px\" height=\"45px\"></td> \n</tr> \n<tr> \n<td style=\"word-break:break-word;font-family:&#39;Lato&#39;,Arial,sans-serif;font-size:14px;line-height:23px;border-collapse:collapse\"> \n<div id=\"m_4815224842221839925text1\">\n<h2 style=\"text-align:center\">Schedule&nbsp;Securely With&nbsp;Virtual Calendars</h2> \n<p style=\"text-align:center\"><span style=\"font-size:11pt;font-family:&#39;Source Sans Pro&#39;,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap\">Build flexible, secure scheduling features with just a few lines of code. Virtual Calendars eliminate the need for your users to authenticate with their personal calendars and provide all the seamless scheduling features your users love</span>.<br></p>\n</div> </td> \n</tr> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse;line-height:40px;font-size:40px\" height=\"30px\"></td> \n</tr> \n</tbody> \n</table> \n</center> </td> \n</tr> \n</tbody> \n</table>\n<table id=\"m_4815224842221839925CTA\" style=\"border-spacing:0;border-collapse:collapse\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse;background-color:#ffffff\" bgcolor=\"#ffffff\" valign=\"top\"> \n<center> \n<table class=\"m_4815224842221839925table600\" style=\"border-spacing:0;border-collapse:collapse;margin-top:0;margin-right:auto;margin-bottom:0;margin-left:auto\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\"> \n<tbody> \n<tr style=\"outline:medium none\"> \n<td style=\"word-break:break-word;border-collapse:collapse\"> \n<center> \n<table style=\"border-spacing:0;border-collapse:collapse;margin-top:0;margin-right:auto;margin-bottom:0;margin-left:auto\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse\" align=\"center\" id=\"m_4815224842221839925tableCTAContent1\"><a href=\"https://email.nylas.com/x0L0000N3n20V3S0LB6QEWO\" class=\"m_4815224842221839925primary_button_green\" style=\"background-color:#00e5bf;color:#000000!important;padding:14px 46px!important;width:165px;margin-left:auto;margin-right:auto;text-align:center;box-sizing:border-box;font-size:12px;line-height:12px;display:block;font-weight:bold;font-family:Arial,sans-serif;letter-spacing:0.4px;white-space:nowrap;border:none;text-decoration:none\" target=\"_blank\">READ MORE</a></td> \n</tr> \n</tbody> \n</table> \n</center> </td> \n</tr> \n<tr> \n<td class=\"m_4815224842221839925col_cta_content\" style=\"word-break:break-word;border-collapse:collapse;line-height:20px;font-size:20px\" height=\"55px\"></td> \n</tr> \n</tbody> \n</table> \n</center> </td> \n</tr> \n</tbody> \n</table>\n<table id=\"m_4815224842221839925free-twoCols\" style=\"border-spacing:0;border-collapse:collapse\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse;background-color:#ffffff\" bgcolor=\"#ffffff\" valign=\"top\"> \n<center> \n<table class=\"m_4815224842221839925table600 m_4815224842221839925table_twoCols_content\" style=\"border-spacing:0;border-collapse:collapse;margin-top:0;margin-right:auto;margin-bottom:0;margin-left:auto\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\"> \n<tbody> \n<tr> \n<td class=\"m_4815224842221839925col_two_content\" style=\"word-break:break-word;border-collapse:collapse\"> <img alt=\"[email protected]\" style=\"outline:none;border-right-width:0;border-bottom-width:0;border-left-width:0;text-decoration:none;border-top-width:0;display:block;max-width:100%;line-height:100%\" width=\"300\" id=\"m_4815224842221839925imgContent4\" src=\"https://info.nylas.com/rs/857-LSW-455/images/Inbox_Zero_SQ%402x.png\" class=\"CToWUd a6T\" tabindex=\"0\"><div class=\"a6S\" dir=\"ltr\" style=\"opacity:0.01\"><div id=\":cw\" class=\"T-I J-J5-Ji aQv T-I-ax7 L3 a5q\" title=\"Download\" tabindex=\"0\"><div class=\"wkMEBb\"><div class=\"aSK J-J5-Ji aYr\"></div></div></div></div> \n<div id=\"m_4815224842221839925textContent9\" style=\"text-align:center\"> \n<p>Instantly connect 100% of email accounts with Hosted Auth.</p> \n</div> \n<div id=\"m_4815224842221839925tableCTAContent3\"> \n<p><a href=\"https://email.nylas.com/K00O6LS00VNo3MBEQ0230W0\" class=\"m_4815224842221839925primary_button_green\" style=\"background-color:#00e5bf;color:#000000!important;padding:14px 46px!important;width:165px;margin-left:auto;margin-right:auto;text-align:center;box-sizing:border-box;font-size:12px;line-height:12px;display:block;font-weight:bold;font-family:Arial,sans-serif;letter-spacing:0.4px;white-space:nowrap;border:none;text-decoration:none\" target=\"_blank\">READ MORE</a></p> \n</div> </td> \n<td class=\"m_4815224842221839925col_two_content\" style=\"word-break:break-word;border-collapse:collapse\"> <img alt=\"[email protected]\" style=\"outline:none;border-right-width:0;border-bottom-width:0;border-left-width:0;text-decoration:none;border-top-width:0;display:block;max-width:100%;line-height:100%\" width=\"300\" id=\"m_4815224842221839925imgContent5\" src=\"https://info.nylas.com/rs/857-LSW-455/images/Privacy_Shield_Ruling_SQ%402x.png\" class=\"CToWUd a6T\" tabindex=\"0\"><div class=\"a6S\" dir=\"ltr\" style=\"opacity:0.01\"><div id=\":cx\" class=\"T-I J-J5-Ji aQv T-I-ax7 L3 a5q\" title=\"Download\" tabindex=\"0\"><div class=\"wkMEBb\"><div class=\"aSK J-J5-Ji aYr\"></div></div></div></div> \n<div id=\"m_4815224842221839925textContent10\" style=\"text-align:center\"> \n<p>Learn what the recent Privacy Shield Ruling means for your users&#39; data.</p> \n</div> \n<div id=\"m_4815224842221839925tableCTAContent4\"> \n<p><a href=\"https://email.nylas.com/wSEW36BLV0000Q2N00O3p0N\" class=\"m_4815224842221839925primary_button_green\" style=\"background-color:#00e5bf;color:#000000!important;padding:14px 46px!important;width:165px;margin-left:auto;margin-right:auto;text-align:center;box-sizing:border-box;font-size:12px;line-height:12px;display:block;font-weight:bold;font-family:Arial,sans-serif;letter-spacing:0.4px;white-space:nowrap;border:none;text-decoration:none\" target=\"_blank\">READ MORE</a></p> \n</div> </td> \n</tr> \n<tr> \n<td class=\"m_4815224842221839925col_two_postcontent\" style=\"word-break:break-word;border-collapse:collapse;line-height:40px;font-size:40px\" height=\"40px\"></td> \n</tr> \n</tbody> \n</table> \n</center> </td> \n</tr> \n</tbody> \n</table>\n<table id=\"m_4815224842221839925prefooter-text\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse;background-color:#ffffff\" bgcolor=\"#ffffff\" valign=\"top\"> \n<center> \n<table class=\"m_4815224842221839925table600 m_4815224842221839925table_prefooter_content\" style=\"background-color:#000;border-spacing:0;border-collapse:collapse;margin-top:0;margin-right:auto;margin-bottom:0;margin-left:auto\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse\" height=\"35px\"></td> \n</tr> \n<tr> \n<td style=\"word-break:break-word;font-family:&#39;Lato&#39;,Arial,sans-serif;font-size:14px;line-height:23px;color:#666;border-collapse:collapse\"> \n<div id=\"m_4815224842221839925prefootertext\" style=\"text-align:center\">\n<p style=\"color:#fff;text-align:center\">Save up to 24 months of development time with the Nylas APIs</p> \n<p> <a style=\"color:#00e5bf;font-weight:bold;text-decoration:none\" href=\"https://email.nylas.com/SS0W3B0EV0603LQ0200QO5E\" target=\"_blank\">Get free API key »</a> </p>\n</div> </td> \n</tr> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse\" height=\"35px\"></td> \n</tr> \n</tbody> \n</table> \n</center> </td> \n</tr> \n</tbody> \n</table>\n<table id=\"m_4815224842221839925footer-logos\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse;background-color:#f2f3f3\" bgcolor=\"#ffffff\" valign=\"top\"> \n<center> \n<table class=\"m_4815224842221839925table600\" style=\"border-spacing:0;border-collapse:collapse;margin-top:0;margin-right:auto;margin-bottom:0;margin-left:auto\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse\" height=\"25px\"></td> \n</tr> \n<tr> \n<td style=\"word-break:break-word;font-family:&#39;Lato&#39;,Arial,sans-serif;font-size:14px;line-height:23px;color:#666;border-collapse:collapse\"> \n<div id=\"m_4815224842221839925footerLogos\" style=\"width:210px;margin-left:auto;margin-right:auto\"> \n<a href=\"https://email.nylas.com/c0603OQL0V3S02BWB0EcO00\" style=\"color:#999999\" target=\"_blank\"><img width=\"33px\" style=\"margin-right:20px\" src=\"https://www.nylas.com/wp-content/themes/Avada-Child-Theme/img/[email protected]\" alt=\"Twitter\" class=\"CToWUd\"></a> \n<a href=\"https://email.nylas.com/hVQ2F6S00L000OBQ3030W6E\" style=\"color:#999999\" target=\"_blank\"><img width=\"33px\" style=\"margin-right:20px\" src=\"https://www.nylas.com/wp-content/themes/Avada-Child-Theme/img/[email protected]\" alt=\"Github\" class=\"CToWUd\"></a> \n<a href=\"https://email.nylas.com/m000373060OB2VQESQG0LW0\" style=\"color:#999999\" target=\"_blank\"><img width=\"33px\" style=\"margin-right:20px\" src=\"https://www.nylas.com/wp-content/themes/Avada-Child-Theme/img/[email protected]\" alt=\"Facebook\" class=\"CToWUd\"></a> \n<a href=\"https://email.nylas.com/f00QB0V0EH002S3OL3W8Q06\" style=\"color:#999999\" target=\"_blank\"><img width=\"33px\" src=\"https://www.nylas.com/wp-content/themes/Avada-Child-Theme/img/[email protected]\" alt=\"Linkedin\" class=\"CToWUd\"></a> \n</div> </td> \n</tr> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse\" height=\"30px\"></td> \n</tr> \n</tbody> \n</table> \n</center> </td> \n</tr> \n</tbody> \n</table>\n<table id=\"m_4815224842221839925footer\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse;background-color:#f2f3f3\" bgcolor=\"#ffffff\" valign=\"top\"> \n<center> \n<table class=\"m_4815224842221839925table600 m_4815224842221839925table_footer_content\" style=\"border-spacing:0;border-collapse:collapse;margin-top:0;margin-right:auto;margin-bottom:0;margin-left:auto\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\"> \n<tbody> \n<tr> \n<td style=\"word-break:break-word;font-family:&#39;Lato&#39;,Arial,sans-serif;font-size:14px;line-height:23px;color:#666;border-collapse:collapse\"> \n<div id=\"m_4815224842221839925footerText\">\n<div style=\"text-align:center\"> \n<p>© 2020 Nylas Inc. All rights reserved.</p> \n<p><a style=\"color:#000;text-decoration:underline\" href=\"https://email.nylas.com/M30W0O0ELQ62B009V0QS0I3\" target=\"_blank\">Privacy Policy</a> | <a style=\"color:#000;text-decoration:underline\" href=\"https://email.nylas.com/Y0B6Q0a3Q00OE003VSL0JW2\" target=\"_blank\">Copyright</a> | <a style=\"color:#000;text-decoration:underline\" href=\"https://info.nylas.com/UnsubscribePage.html?mkt_unsubscribe=1&amp;mkt_tok=eyJpIjoiTWpoak4yUm1NV1psWVRRMSIsInQiOiJIeUFTbkkycTdyd25GYUFEbDFmYkpZV2VLTGlnZXdJeDZyWmNKVVR4MXMyNndMSmhWMGVEZHNTa0N1TzlqVDE1Y3lTYzZCK3FPQXBaWGkzQUlYa2Q5cjJLbGxzR3ErQUZnb3FJVit2WXEvY1YrSUxpTnJ1U2tOdFd5QUtqdmtYNSJ9\" target=\"_blank\">Unsubscribe</a></p> \n<p>944 Market St, San Francisco, CA 94102</p> \n</div>\n</div> </td> \n</tr> \n<tr> \n<td style=\"word-break:break-word;border-collapse:collapse\" height=\"30px\"></td> \n</tr> \n</tbody> \n</table> \n</center> </td> \n</tr> \n</tbody> \n</table></td> \n</tr> \n</tbody> \n</table> </td> \n</tr> \n</tbody> \n</table> \n \n\n<img src=\"https://email.nylas.com/trk?t=1&amp;mid=ODU3LUxTVy00NTU6MDoxNTAyOjQyNTc6MzY5NDA6MTg2Mjo5OjMzNDA6MTYyNDcwMDpueWxhc3dvcmt0ZXN0KzAxQGdtYWlsLmNvbQ%3D%3D\" width=\"1\" height=\"1\" style=\"display:none!important\" alt=\"\" class=\"CToWUd\"><div class=\"yj6qo\"></div><div class=\"adL\">\n</div></div><div class=\"adL\">\n</div></div><br clear=\"all\"><div><br></div>-- <br><div dir=\"ltr\" class=\"gmail_signature\" data-smartmail=\"gmail_signature\"><div dir=\"ltr\"><br><table style=\"border:none;border-collapse:collapse\"><colgroup><col width=\"84\"><col width=\"540\"></colgroup><tbody><tr style=\"height:79pt\"><td style=\"vertical-align:top;padding:5pt;overflow:hidden\"><p dir=\"ltr\" style=\"line-height:1.2;margin-top:0pt;margin-bottom:0pt\"><a href=\"https://www.nylas.com/\" target=\"_blank\"><span style=\"font-size:11pt;font-family:Arial;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline;white-space:pre-wrap\"><span style=\"border:none;display:inline-block;overflow:hidden;width:70px;height:70px\"><img src=\"https://lh6.googleusercontent.com/zJp7cuIKWhNYHc6KsuHUsfrhyCp9DKxg243bjSLP9JKi9SEX-uMtTAr5qy54Kdlr3RNkTwAEvIDHKBCjodqu8uVLLbReY47_-KtRilUatWsZRRfO2LH9ZTCykLEVBOj8iJ7XmNeX\" width=\"70\" height=\"70\" style=\"margin-left:0px;margin-top:0px\"></span></span></a></p></td><td style=\"vertical-align:top;padding:5pt;overflow:hidden\"><p dir=\"ltr\" style=\"line-height:1.8;margin-top:0pt;margin-bottom:0pt\"><span style=\"font-size:10pt;font-family:&quot;Source Sans Pro&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;font-weight:700;vertical-align:baseline;white-space:pre-wrap\">Nylas Product Team</span></p><p dir=\"ltr\" style=\"line-height:1.38;margin-top:0pt;margin-bottom:0pt\"><span style=\"font-size:8pt;font-family:&quot;Source Sans Pro&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap\">Nylas Team, </span><a href=\"https://www.nylas.com/\" target=\"_blank\"><span style=\"font-size:8pt;font-family:&quot;Source Sans Pro&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap\">Nylas</span></a></p><p dir=\"ltr\" style=\"line-height:1.38;margin-top:0pt;margin-bottom:0pt\"><span style=\"font-size:8pt;font-family:&quot;Source Sans Pro&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap\"><a href=\"mailto:[email protected]\" target=\"_blank\">[email protected]</a></span></p></td></tr><tr style=\"height:63pt\"><td colspan=\"2\" style=\"vertical-align:top;padding:5pt;overflow:hidden\"><p dir=\"ltr\" style=\"line-height:1.2;margin-top:0pt;margin-bottom:0pt\"><a href=\"https://www.nylas.com/resources/savings-calculator-integrations/\" target=\"_blank\"><span style=\"font-size:11pt;font-family:Arial;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline;white-space:pre-wrap\"><span style=\"border:none;display:inline-block;overflow:hidden;width:306px;height:45px\"><img src=\"https://lh3.googleusercontent.com/bTFwY25C4D9lD4GJHxsVEWr8--YG25chLhjDJb3rWpmXPw5RngwZHUWhbDracmaXL7n6mtt5JPM9egiGaFwU2bNKMrvMcctgvrHFOI7YxIzze7CTKKVJRqD8kq2hNUE2IJiPWFmL\" width=\"306\" height=\"45\" style=\"margin-left:0px;margin-top:0px\"></span></span></a></p></td></tr></tbody></table></div></div></div>",
"cc": [],
"conversation": "__\n\nVirtual calendars are now included with Nylas Platform and Calendar\nsubscriptions.\n\n[ ![Logo](https://12qf1516hja245v1v537ieww-wpengine.netdna-ssl.com/wp-\ncontent/uploads/2019/08/[email protected])\n](https://email.nylas.com/CSQ00K0mV0NL03BE3O02W06) \n\n--- \n\n[\n![[email protected]](https://info.nylas.com/rs/857-LSW-455/images/Virtual_Calendar_NewsletterHero%402x.png)\n](https://email.nylas.com/x0L0000N3n20V3S0LB6QEWO) \n\n--- \n| \n--- \n\nBuild flexible, secure scheduling features with just a few lines of code.\nVirtual Calendars eliminate the need for your users to authenticate with their\npersonal calendars and provide all the seamless scheduling features your users\nlove. \n\n \n| | [READ MORE](https://email.nylas.com/x0L0000N3n20V3S0LB6QEWO) \n--- \n|\n![[email protected]](https://info.nylas.com/rs/857-LSW-455/images/Inbox_Zero_SQ%402x.png)\n\nInstantly connect 100% of email accounts with Hosted Auth.\n\n[READ MORE](https://email.nylas.com/K00O6LS00VNo3MBEQ0230W0)\n\n|\n![[email protected]](https://info.nylas.com/rs/857-LSW-455/images/Privacy_Shield_Ruling_SQ%402x.png)\n\nLearn what the recent Privacy Shield Ruling means for your users' data.\n\n[READ MORE](https://email.nylas.com/wSEW36BLV0000Q2N00O3p0N)",
"date": 1608244442,
"events": [],
"files": [],
"from": [{
"email": "[email protected]",
"name": "Leyah Williams"
}],
"id": "**********",
"labels": [
{
"display_name": "Important",
"id": "c2ig7rwrpethf9bqoaq7tnerm",
"name": "important"
},
{
"display_name": "Inbox",
"id": "cgf6uw9mvagi1fibv67kgz7z",
"name": "inbox"
}
],
"model_version": "0.0.1",
"object": "message",
"reply_to": [],
"snippet": "Virtual calendars are now included with Nylas Platform and Calendar subscriptions. Schedule Securely With Virtual Calendars Build flexible, secure scheduling features with just a few lines of code.",
"starred": false,
"subject": "Nylas Virtual Calendars",
"thread_id": "*********",
"to": [{
"email": "[email protected]",
"name": "Dorothy Vaughan"
}],
"unread": false
}
]

You can submit up to 20 email messages per request.

Before and after Clean Conversation request

Before

Nylas v3

After

Unsubscribe \n\n \nHi there,\n\nNylas API v3 is now generally available! The new infrastructure introduces: \n\n * Instant email and event functionality, boosting performance, security, and scalability.\n * Simplified integrations such as API keys for auth, enhanced webhooks, Microsoft Graph, and more to streamline engineering efforts even further.\n * New email features such as Bounce Detection, Smart Compose, Scheduled Send, and custom domain for email tracking links to improve email deliverability and efficiency.\n\nCheck out Nylas docs and join our webinar on Feb 15 to learn more, and start\nmigrating today!\n\nHave questions about migrating? Contact your dedicated Nylas customer success\nmanager (CSM) or email [email protected]. \n\n© 2024 Nylas Inc. All rights reserved.\n\nPrivacy Policy | Copyright | Unsubscribe\n\n2100 Geng Rd. #210, Palo Alto, CA 94303

Return plain text

The following JSON sample removes all images, tables, and links from an email message. Any images will instead be returned as part of the Files object.

{
"message_id": [
"{message_id}"
],
"ignore_links": true,
"ignore_images": true,
"ignore_tables": true,
"remove_conclusion_phrases": true
}

Clean email messages with images

When you submit an email message that contains images to the Clean Conversation endpoint, you can choose how Nylas handles the images. If you want to return them, set ignore_images: false. If you want to return the images as Markdown links, set images_as_markdown: true and ignore_images: false.

Nylas returns inline images as part of the cleaned message and includes a content ID (cid), as in the following examples:

  • Inline image: "conversation": "<img src='cid:1781777f666586677621' />\n\nImage from Gmail"
  • Inline image as Markdown: "conversation": "![Nylas logo](cid:1781777f666586677621)\n\nImage from Gmail"

🔍 The content ID is an internal ID for Nylas. If you want to download an image from a cleaned email message, use the corresponding ID from the Files object in the response instead.

Nylas returns some inline images with a link to the original image source, if the link is available. If the link isn't available, Nylas returns the cid.

Nylas doesn't return image attachments as part of the cleaned message. You can find information about attached images in the Files object that Nylas returns.

"files": [{
"content_disposition": "inline",
"content_id": "<NYLAS_CID>",
"content_type": "image/jpg",
"filename": "IMG_0864.jpg",
"id": "<NYLAS_FILE_ID>",
"size": 2773662
}],

Download images

To download an image that was included in a cleaned email message, make a GET /files/{id}/download request that includes the file ID, as in the following example.

curl --location --request GET 'https://api.nylas.com/files/<NYLAS_FILE_ID>/download' \
--header 'Authorization: Bearer <NYLAS_ACCESS_TOKEN>'

Nylas returns a data file that you can download.

Clean Conversation message feedback

If you used the Clean Conversation endpoint to clean an email message and the result wasn't what you expected, you can send feedback to Nylas using the /neural/conversation/feedback endpoint. Nylas uses this data to retrain the machine learning model for better results in the future.

curl --location --request POST 'https://api.nylas.com/neural/conversation/feedback' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <NYLAS_ACCESS_TOKEN>' \
--data-raw '{
"message_id":"<MESSAGE_ID>"
}'
{
"model_version": "av45hcbkka",
"message_id": "<MESSAGE_ID>",
"feedback_at": "1607537180",
}

Keep in mind

You should keep the following things in mind as you work with the Clean Conversation endpoint:

  • If you pass a forwarded email message in your request, Nylas returns an empty message.
  • The Clean Conversation endpoint currently supports English language text only.
  • The Nylas SDKs currently don't support the Clean Conversation endpoint.
  • You currently cannot use webhooks with the Clean Conversation endpoint.