Integrating your NetSuite with Gmail
The goal of this blog is to explain how this tool can be used to connect any Gmail account with NetSuite ERP. By the end of this blog, you should be able to understand and connect NetSuite ERP with any Gmail account.
NetSuite provides complete integration between NetSuite and Google Apps, enabling you to increase productivity by using google single sign-on. This solution is specifically designed for Gmail users that want to safely and securely leverage the power of NetSuite and connect it directly with the Gmail user interface.
Google has provided us with a certain amount of API(s) to access its applications. So for our Gmail integration, we will be working with Google Gmail API(s). To start working with Gmail API, we have to first enable it from the Google Developers Console.
Once you get access to Google Gmail API(s), you can easily modify, read and retrieve data from the user’s emails received on the account.
Gmail APIs to use:
- Users.messages: list (To retrieve the list of unread emails bypassing it unread filter).
- Users.messages: get (Provide message-id retrieve from users.messages: list to retrieve particular message data/body/attachments).
- Users.messages.attachment: get (Provide message-id and attachment-id to retrieve attachment from the particular message).
- Users.messages: modify (To mark processed emails as read).
Using these APIs, sender email, attachment, and email body can easily be retrieved from an email.
In NetSuite, A script will be scheduled as a daily event after every 30 minutes, it will get all the unread emails from the user’s mailbox.
Create a custom record in NetSuite account. Add the following fields in it:
- Sender Email
- Email Body
Create a record and set these fields with sender email and email body values and for attachments, create a file and save it to the NetSuite file cabinet and attach it to the same record.
As this process will be repeated every 30 minutes, it will be creating records for the received emails. And thus, your Gmail account will be synced with NetSuite.