Skip to content

Use Google accounts and data with Nylas

You can create a Google connector in your Nylas application, then use that connector to authenticate your users’ Google accounts. This lets your application access their Gmail, Google Calendar, and Google Contacts information using the OAuth 2.0 protocol.

Set up your Google auth app

First, you need to connect your Nylas application to a Google provider auth app. This lets your users authenticate to your application with their Google accounts, and provides your project access to the data you specify in the Google API. Follow the steps in Create a Google provider auth app to set up a Google Cloud Platform project.

Google verification and security assessment

You might need to take extra steps to comply with Google’s OAuth 2.0 policies and complete their verification process before you can publish your GCP project.

Be sure to request the most restrictive scopes that you need for your project. If you request any of Google’s restricted scopes, Google will require your application to complete a security assessment. This could extend your verification timeline significantly, or cause Google to fail your review.

For more information, see Nylas’ Google verification and security assessment guide.

”Sign in with Google” branding guidelines

Your GCP project needs to include a “Sign in with Google” button that meets Google’s branding guidelines. This applies to the OAuth flow for both personal Gmail (@gmail.com) and Workspace email addresses.

Google OAuth verification

When you create your Google Cloud Platform project, you need to list the scopes that your Nylas application will use.

If your application accesses Google user data with the Google APIs and requests certain scopes, you might have to complete the Google verification process and a separate security assessment process. The processes that you need to complete depends on whether your application requests sensitive or restricted scopes.

Scope typeRequired processesGoogle policy and requirements
SensitiveGoogle verificationYour application must follow Google’s API Services User Data Policy.
RestrictedGoogle verification and security assessmentYour application must follow Google’s API Services User Data Policy and meet additional requirements for specific scopes.

Google provider limitations

  • The Gmail API has a set of usage limits that apply to all requests made from your Nylas application. This includes the number of messages you can send per day. For more information, see Google’s official Usage limits documentation.
  • The Google Calendar API has two sets of usage limits: the number of requests your application can make each minute, and the number of requests your application can make per user each minute. For more information, see Google’s official Manage quotas documentation.
  • If an attachment file name includes non-ASCII characters (for example, accented characters like ü), Google can’t detect its content type. Because of this, Nylas returns an empty content_type field.

One-click unsubscribe headers

As of February 2024, Google requires that users who send more than 5,000 messages per day to Gmail email addresses include one-click unsubscribe headers in their marketing and subscribed messages (see Google’s official Email sender guidelines). This is along with the visible unsubscribe links that must be in the body content of all marketing and subscribed messages.

To set up one-click unsubscribe headers using Nylas, include the custom_headers object in your Send Message or Create Draft request. This object accepts a set of key-value pairs, each of which represents the header’s name and its value. You must include the following headers:

  • List-Unsubscribe-Post: List-Unsubscribe=One-Click
  • List-Unsubscribe: The unsubscribe link (for example, a mailto link that uses the user’s email address, or a link to your list management software).
"custom_headers":[
{
"name": "List-Unsubscribe-Post",
"value": "List-Unsubscribe=One-Click"
},
{
"name": "List-Unsubscribe",
"value": "<mailto: [email protected]?subject=unsubscribe>, <https://mailinglist.example.com/unsubscribe.html>"
}
]