Skip to content

Releases: nylas/nylas-nodejs

v7.2.0

27 Feb 23:21
Compare
Choose a tag to compare

Changelog

Added

  • Added support for roundTo field in availability response model (#540)
  • Added support for attributes field in folder model (#540)
  • Added support for icloud as an auth provider (#540)

Changed

  • Fixed query params not showing up in method parameters for finding a message (#539)
  • Fixed missing fields in message models (#541, #542)

Removed

  • Removed unnecessary clientId from detectProvider params (#540)

v7.1.0

12 Feb 20:30
Compare
Choose a tag to compare

The first release adds support for a new endpoint and a couple of updates.

Changelog

Added

  • Added support for /v3/connect/tokeninfo endpoint (#536)

Updated

  • Models can now directly be imported from the top-level nylas package (#534)
  • Fixed inaccuracies in event and webhook models (#535)

v6.11.1

09 Feb 17:23
Compare
Choose a tag to compare

Changelog

Updates

  • Fix issue where Graph events were returning 400 on update (#524)
  • Make comment param in rsvp optional (#529)

v7.0.0

09 Feb 14:33
Compare
Choose a tag to compare

The Nylas Node SDK v7.0.0 is out of beta now Generally Available! This SDK sees a number of changes, including breaking changes, and more importantly brings full support of the new Nylas API v3.

Changelog

Breaking changes

  • Node SDK v7 supports the Nylas API v3 exclusively, dropping support for any endpoints that are not available in v3. See API v3 Features and Changes for more information.
  • Convert Nylas class from a static to a non-static class.
  • Officially support minimum Node 16.
  • Dropped the use of 'Collections' in favor of 'Resources'.
  • Removed all REST calls from models and moved them directly into resources.

Added

  • Created models for all API resources and endpoints, for all HTTP methods to reduce confusion on which fields are available for each endpoint.
  • Created error classes for the different API errors as well as SDK-specific errors.
  • Added support for both ES6 and CommonJS module systems.

Updated

  • Rewrote the majority of SDK to be more modular and efficient.

Removed

  • Removed the use of custom strings for serialization and deserialization, now automatically converting to camelCase and from the API's snake_case.
  • Local Webhook development support is removed due to incompatibility with the new API version.

Docs and References

Please refer to the README.md for a quick description and getting started guide with the new SDK. Furthermore, we have an UPGRADE.md for instructions on upgrading from v6.x to v7.x, as well as a reference guide for the Node SDK.

v6.11.0

29 Nov 14:56
Compare
Choose a tag to compare

Release Notes

Added

Fixed

  • Nullify replyToMessageId is an empty string (#484, #509)
  • Nullify visibility if visibility is an empty string (#507, #470)
  • Fix numbers defaulting to 0 instead of null (#469)
  • Fix parsing of Number arrays (#503, #502)
  • Fix configured timeout not being used (#506, #489)
  • Bump node-fetch dependency from 2.6.1 to 2.6.12 (#504, #496)

v6.10.0

04 Apr 19:15
Compare
Choose a tag to compare

This latest release of the Nylas Node SDK includes support for verifying webhook signatures.

Release Notes

Added

  • Add support for verifying webhook signatures (#442)

Usage

To verify a webhook signature

const Nylas = require('nylas');
const express = require('express');
const cors = require('cors');

const app = express();

// Enable CORS
app.use(cors());

// The port the express app will run on
const port = 9000;

// Nylas app credentials
const NYLAS_CLIENT_SECRET = process.env.NYLAS_CLIENT_SECRET;
if (!NYLAS_CLIENT_SECRET) {
  throw new Error('NYLAS_CLIENT_SECRET is required')
}

// Create a callback route for the Nylas Event Webhook
app.post('/', express.json(), async (req, res) => {
  // Verify the Nylas Event Webhook signature to ensure the request is coming from Nylas
  const signature =
    req.headers['x-nylas-signature'] || req.headers['X-Nylas-Signature'];
  if (
    !WebhookNotification.verifyWebhookSignature(
      NYLAS_CLIENT_SECRET,
      signature,
      JSON.stringify(req.body)
    )
  ) {
    res.status(403).send('Invalid signature');
  }

  const { body } = req;

  // Log the webhook event to the console
  console.log('Webhook event received: ', JSON.stringify(body, undefined, 2));

  // Send a 200 response to the Nylas Event Webhook
  res.status(200).send({ success: true });
});

v6.9.0

14 Mar 20:29
Compare
Choose a tag to compare

This latest release of the Nylas Node SDK brings a few new features.

Release Notes

Added

  • Add missing generic type in RestfulModelCollection for better type safety (#424)
  • Add 409 to error mapping (#430)
  • Add startTimezone, endTimezone and timezone fields to When (#429)
  • Allow configurable timeout for API calls (#427)

Security

  • Bump minimist sub-dependency from 1.2.0 to 1.2.6 (#425)
  • Bump mkdirp sub-dependency from 0.5.1 to 0.5.6 (#425)

Usage

Configuring request timeout

You can now add a request timeout as part of the initial Nylas SDK configuration, as in the example below.

const Nylas = require('nylas');

// Initialize an instance of the Nylas SDK using the client credentials and timeout
Nylas.config({
  clientId: "CLIENT_ID",
  clientSecret: "CLIENT_SECRET",
  timeout: 60 // 60 second timeout
});

Contributors 🎉

v6.8.0

03 Feb 14:32
Compare
Choose a tag to compare

This new release of the Nylas Node SDK brings a few couple of new features, most notably the release of local webhook development support built directly into the SDK. When implementing this feature in your app, the SDK will create a tunnel connection to a websocket server and registers it as a webhook callback to your Nylas account. See below for a usage example.

Release Notes

Added

  • Local webhook testing support (#422)
  • Add hideParticipants field to Event (#420)

Usage

Webhook Tunnel

During the setup process you can pass in methods to override the websocket client's callback methods. The most important method is the onMessage method which returns a parsed delta event from the webhook server.

const Nylas = require('nylas');
const { openWebhookTunnel } = require('nylas/lib/services/tunnel');
const { WebhookTriggers } = require('nylas/lib/models/webhook');

// Initialize an instance of the Nylas SDK using the client credentials
Nylas.config({
  clientId: "CLIENT_ID",
  clientSecret: "CLIENT_SECRET",
});

// Define the callback for the onMessage event
const onMessageListener = (delta) => {
    if(delta.type === WebhookTriggers.MessageUpdated) {
      console.log("Got message from webhook. Data: " + delta.objectData);
   }
}

// Pass your config in to create, register, and open the webhook tunnel for testing
openWebhookTunnel({
    onMessage: onMessageListener,
    triggers: [WebhookTriggers.MessageUpdated]
}).then(r => console.log("Webhook connected and active. " + r))

v6.7.0

18 Jan 15:39
Compare
Choose a tag to compare

This new release of the Nylas Node SDK brings a few new features.

Release Notes

Added

  • Add support for rate limit errors (#405)
  • Add responseType to AuthenticateUrlConfig (#411)
  • Add new attributes for Event webhook notifications (#417)

Changed

  • Change Event visibility field to be writeable (#408)

Security

  • Bump decode-uri-component sub-dependency from 0.2.0 to 0.2.2 (#410)
  • Bump qs sub-dependency from 6.5.2 to 6.5.3 (#412)
  • Bump json5 sub-dependency from 2.1.0 to 2.2.3 (#416)
  • Bump minimatch sub-dependency from 3.0.4 to 3.1.2 (#418)

v6.6.1

21 Oct 19:52
Compare
Choose a tag to compare

This new release of the Nylas Node SDK fixes the calendar color implementation from #397.

Release Notes

Fixed

  • Fix calendar color implementation (#403)