Set Sent Folder via API

Nylas API Endpoint Enhancement: Set Sent Folder

Learn how you can set the Sent folder on IMAP accounts via the Nylas API.

Jieun Kim | November 25, 2019

End-users with custom IMAP accounts can now set their sent folder manually, so even in the case of language differences where the “Sent” folder is labeled with the word for “Sent” in other languages, your users can now manually set their “Sent” folder to display all sent messages. Previously, Sent folders could be updated manually via the Nylas Dashboard. This means your support team has been doing a great job assigning the Sent folder for your end-users by going into the Nylas dashboard and setting it per their request.

However, we heard from developers that they’d like to build this functionality into their own applications so end-users can select their own sent folders right inside their CRM. We’ve heard you and taken heed!

Here’s an example of how to make use of this added functionality. 

First, make sure that the account is a custom IMAP account. You can do this by making a GET call to the /account endpoint and check the response you receive: if the ‘provider’ attribute is set to ‘custom’, you are good to go.

Next, make a PUT call to /folders/{id} endpoint which takes a new body parameter: `name`.

So, say you’d like to set folder ID 41a815dvlgslz7y7dz6c5kbhb as the Sent folder for an account. Make a call like so:

curl -X PUT \

  https://api.nylas.com/folders/41a815dvlgslz7y7dz6c5kbhb \

  -H 'Authorization: Basic QU9PR294S3dIdU5nZ2Y4QThWOTQwSGM3alZGWkVlOg==' \

  -H 'Content-Type: application/json' \

  -H 'cache-control: no-cache' \

  -d '{

    "name": "Sent"

}'

This will be especially handy for customers that have IMAP accounts in different languages. For example, if your users are in Sweden, their sent folders are labeled “Skickat”; Nylas may not automatically detect it as the sent folder which means that emails might not automatically appear in the sent folder. We developed this new feature so customers can set their sent folder regardless of the name! For the Swedish end-user, the same call above might look like this:

curl -X PUT \

  https://api.nylas.com/folders/41a815dvlgslz7y7dz6c5kbhb \

  -H 'Authorization: Basic QU9PR294S3dIdU5nZ2Y4QThWOTQwSGM3alZGWkVlOg==' \

  -H 'Content-Type: application/json' \

  -H 'cache-control: no-cache' \

  -d '{

    "name": "Skickat”"

}'

Sign up today to get a free API key and try it out, or if you’re already a customer, test out the new features and let us know what you think!

 

About the Author

jieun kim is a technical writer based in nyc. in her spare time, she enjoys contemplating unusual shapes and accumulating large stacks of books.

Ready to Start Building?

Connect up to 10 accounts for free today. No credit card required.