🎉 New SDK Release! (V6) #416
Replies: 5 comments 8 replies
-
@Eclairemoy — Wow, this is a huge update! We're especially excited to see the robust typing and the auto-pagination. On the pagination front, we had done some gymnastics to make something work using higher order functions, but it felt kludgy. I didn't know this type of looping is possible... This is a lot cleaner. With our own internal services, we've found the type checking to help a lot across networking boundaries, as we've discovered too many errors when something changes over the wire. Quick question... How does the typing interplay with the version selection? In other words, if different versions emit different data structures, does that mean that changing the version number (e.g. Tiny API question... Since you're moving to positional parameters plus options hashes, would it make sense for Overall though, this looks like a big step up and it's great to see Intercom doubling down on the API front. It will make it easier for us to integrate it with our other systems as we adopt more AI-based support workflows. |
Beta Was this translation helpful? Give feedback.
-
I'm a founder and my company is currently a client of Intercom. We're on one of the paid plans. I just migrated to this new SDK release (took maybe 10 minutes) so here's my feedback. Overall, it feels like this SDK update is much more modernized. The previous SDK wasn't even an ES module so I'm glad to get rid of the old import style. The type updates and new inline documentation were super helpful while migrating methods to the new format--I don't remember seeing that on previous versions. Other than that, not much changed for me. Just converted some camelCase arguments to underscore format and I was good to go. Building an SDK is easy, but keeping it up-to-date is the hard part. The previous SDK felt like it was kinda neglected so hopefully Intercom can keep this quality up going forward. I'm going to start using this in prod and will report back if anything unexpected comes up. Very happy with the update so far though! |
Beta Was this translation helpful? Give feedback.
-
We use Intercom here at Thera. We have to build integrations on a monthly basis, so seeing a Typescript client that has pagination with an iterator and declarative version selection is music to my ears. We're not going to start using this until it's promoted from alpha to a stable version. @Eclairemoy, you have a timeline for that? |
Beta Was this translation helpful? Give feedback.
-
I just tried beta3, and I encountered an issue that makes it somewhat troublesome to use. Why are all fields in each object defined as nullable/optional? When I retrieve a contact object, there are certain fields that are always to be present. However, because the type declaration makes all fields nullable, I have to add code to check these fields; otherwise, TypeScript throws an error. |
Beta Was this translation helpful? Give feedback.
-
Hello @Eclairemoy CTO credal.ai here, we're working on an Intercom integration but are not going to start until we can depend on the V6 Node SDK. When do you expect it to be released? This will be very helpful for our engineering planning and what we can push for our customers interested in intercom. |
Beta Was this translation helpful? Give feedback.
-
V6 Release
The Intercom team is excited to announce a new and improved TypeScript SDK, currently available as an
alpha
version. Check out the API reference here.During this time, we hope to gather feedback from the Intercom community to help drive the direction of the latest API changes.
Please feel free to leave in any suggestions here to improve the experience for everyone!
Installation
Install the latest alpha by running the following command:
This will install a version that looks like the following:
6.0.0-alpha
6.0.0-alpha1
6.0.0-alpha2
New Features
1. Strongly typed
All types and endpoints are strongly typed and up to date with Intercom’s latest API.
In version
5.0.0
, some of the SDK types includedany
andunknown
properties, which put more onus on the caller to determine what type was expected.But with the new
alpha
, you’ll always know exactly what type you’re working with. For example, consider theRequestOptions
type:Before
After
2. Rich documentation
The new SDK includes in-lined documentation on both endpoints and object properties. This helps the user recognize exactly what parameters need to be specified and allows them to iterate even faster.
For example, consider the following endpoint documentation:
3. Improved exception handling
The SDK now defines structured errors that users can use to influence their program’s control flow. For example, consider the following:
With this, users can write their programs to take specific actions whenever an endpoint returns any of the well-known Intercom errors (the Intercom.NotFoundError in this case).
4. Auto-pagination
Intercom’s paginated endpoints now support auto-pagination with an idiomatic iterator.
Callers don’t need to manually fetch the next page at all - they can simply iterate over the entire list, and the client will automatically fetch the next page behind the scenes.
Before
After
5. Version selection
The Intercom client now includes version selection support.
The SDK is configured to use the latest stable version by default (i.e.
2.11
), but users can override this value to influence the behavior of the server. Configuring a version is as simple as the following:Migration Guide
These improvements include a few breaking changes (primarily related to request parameters), which are categorized by the following:
1. Client constructor
The client constructor is simplified and doesn’t require a nested type to specify the API token.
Before
After
2. Positional parameters
You’ll notice a few parameters are moved out of the in-lined request type and refactored as positional parameters.
Before
After
Note that additional optional parameters are still included in a separate in-lined request type like so:
Before
After
2. Request properties naming convention (camelCase -> snake_case).
Request properties now use the
snake_case
naming convention, whereas response properties preserve the camelCase naming convention.Before
After
Beta Was this translation helpful? Give feedback.
All reactions