Changelog: Twilio Chat JavaScript SDK
We intend to sunset the Programmable Chat API on July 25, 2022 to focus on the next generation of chat: the Twilio Conversations API. Learn more. We have also prepared this Migration Guide to assist in the transition from Chat to Conversations.
Latest releases for the Programmable Chat JavaScript SDK
Programmable Chat’s Javascript SDK is now at version v4.1. We recommend using the following links in your projects. As we patch bugs, these links will automatically be updated with the fixes with full backwards compatibility.
- js — Non-minified Chat SDK bundled for browsers, hosted on Twilio CDN.
- min — Minified Chat SDK bundled for browsers, hosted on Twilio CDN.
- Documentation — Hosted on Twilio CDN.
- npm — Chat Node.js SDK package.
Changelog
Links are provided to specific patch versions here. We don't recommend using these links unless you have a specific need for a certain patch of a release.
Programmable Chat 4.1.0 (December 16, 2020)
Changes
- Bugfixes.
- Dependency bumps.
- Various documentation improvements.
Programmable Chat 4.0.0 (July 17, 2020)
Changes
Message.timestamp
renamed toMessage.dateCreated
.Channel.lastMessage.timestamp
also renamed toChannel.lastMessage.dateCreated
.- Update reason
timestamp
forMessage
objects got also renamed todateCreated
. - Channel status
"known"
renamed to"notParticipating"
. Media.getContentUrl
renamed toMedia.getContentTemporaryUrl
.- Various
attributes
arguments now accept all valid JSON values (numbers, strings, objects, arrays, booleans, nulls).
Programmable Chat 3.4.0 (May 28, 2020)
Changes
- Added read-only
state
property to the Channel class which reflects the Conversations state.
Programmable Chat 3.3.7 (April 30, 2020)
Changes
- Connection errors are now reported with more details about what actually happened.
Programmable Chat 3.3.5 (April 16, 2020)
Bug Fixes
- Typing timeout indicator now gets correctly set to reflect the setting for the instance on the console
- Logger name is now set to "twilio-chat"
Programmable Chat 3.3.4 (January 6, 2020)
Bug Fixes
- Extended media message sending documentation
- Fixed media messages send from node.js
Programmable Chat 3.3.3 (November 27, 2019)
Bug Fixes
- Extended documentation.
- Updated to latest twilio-sync with fixes in objects caching
Programmable Chat 3.3.2 (September 18, 2019)
Bug Fixes
- Fixed
Client.setPushRegistrationId
/Client.unsetPushRegistrationId
to resolve only after successful operation. - Fixed emitting
Client#channelRemoved
event correctly for private channels. - Improved documentation: added
Channel#removed
event. - Removed
isomorphic-form-data
from dependencies. - Fixed issues appearing in restrictive browser environments, enabling SDK operation without session storage.
Programmable Chat 3.3.1 (July 24, 2019)
Bug Fixes
- Updated twilio-sync.js dependency with security fixes
- Fixed a bug when removing a Member from Channel
Programmable Chat 3.3.0 (June 27, 2019)
Changes
- Added
Channel.getMemberBySid
method to get Member by provided Sid - Added
Channel.getMemberByIdentity
method to get Member by provided Identity - Property
Channel.createdBy
can be null - Added
Message.member_sid
property - Property
Message.author
can be null - Added
Message.getMember
method to get authoring Member of Message bymember_sid
(if available) and if not found then byauthor
(identity)
Programmable Chat 3.2.4 (June 25, 2019)
Changes
- Introduced
Client#event:connectionError
event. - Fixed a bug, where recovery after a partial network degradations the websocket did not reconnect.
Programmable Chat 3.2.3 (April 15, 2019)
Changes
- Consumed new version of Sync JS SDK version 0.10.3
- Link to the token generation material got updated
Programmable Chat 3.2.2 (April 2, 2019)
Bug Fixes
- Fixed a bug where sending messages while offline caused duplicate messages at network reconnect
Programmable Chat 3.2.1 (February 21, 2019)
Bug Fixes
- Improved error handling in operations with
User
,Member
,Channel
,Message
Programmable Chat 3.2.0 (December 7, 2018)
Overview
In this release we are introducing Member Attributes and the ability to change them.
Changes
- Added
dateCreated
,dateUpdated
,type
, andattributes
properties toMember
class - Added
Member.updateAttributes
method to set a Member's Attributes (requires new permissions to be added to the according role:editOwnMemberAttributes
oreditAnyMemberAttributes
)
Bug Fixes
- Fixed a connectivity bug that caused unhandled promise rejections
Programmable Chat 3.1.0 (October 18, 2018)
Overview
In this release we are introducing a User Notification Level to each Channel. The assigned level determines whether the currently logged-in User will receive pushes for that Channel. The assigned level be any of muted
or default
, where default
defers to global Chat Service push configuration.
Changes
- Added
Channel.setUserNotificationLevel
method to set User's Notification level - Added
notificationLevel
property toChannel
class
Bug Fixes
- Fixed a connectivity bug that caused reconnection recovery to fail, including when going into the background on iOS (react native).
Programmable Chat 3.0.2 (July 23, 2018)
Changes
- Improved startup and synchronization time in some cases
Bug Fixes
- Resolved potential issue in Channel synchronization on startup
- Fixed bug preventing building React Native apps in Release configuration
Programmable Chat 3.0.1 (June 25, 2018)
Changes
- Improve diagnostics, start adding timestamps to log lines
Bug Fixes
@types\loglevel
package is not required anymore in TypeScript projects usingtwilio-chat
Programmable Chat 3.0.0 (May 31, 2018)
Overview
In this release we have revised all updated events. Each revised event now receives an object which contains:
- updated object itself, i.e.
channel
,member
,message
,user
- array of reasons the event is being triggered, i.e. object is updated because of update in
attributes
,friendlyName
,body
, etc.
Additionally, the Channel.LastMessage
structure is updated to contain only last message's creation timestamp
and index
(effectively removing author
and sid
)
Breaking Changes
- updated events now include reasons for the update. Changed events are:
Client#event:channelUpdated
Channel#event:updated
Client#event:memberUpdated
Channel#event:memberUpdated
Member#event:updated
Client#event:messageUpdated
Channel#event:messageUpdated
Message#event:updated
Client#event:userUpdated
User#event:updated
- Changing
channel.sendMessage()
promise resolve type toPromise<number>
- Default
logLevel
is now set tosilent
, log lines now includes timestamp - Removed
sid
andauthor
properties fromChannel.LastMessage
type
Additive Changes
- Adjust docs for
Client.shutdown()
, introducing new types for various methods - Adding new events on client:
tokenAboutToExpire
,tokenExpired
(essentially removing need forAccessManager
use) - Added
index
property toChannel.LastMessage
type
Programmable Chat 2.2.0 (March 13, 2018)
Changes
- Added method
Client.unsetPushRegistrationId
to deregister from push notifications - Added
lastMessage
structure toChannel
- Added helper method
Client.getLocalChannels
to get (sorted) locally known channels, sorting is possible byuniqueName
,friendlyName
, orlastMessage
Bug Fixes
- Fixed re-using of
ClientOptions
between two clients creations in the same browser or node.js session - Various updates and fixes for documentation
Programmable Chat 2.1.0 (January 15, 2018)
Changes
- For
Message
with typemedia
thebody
property now is null (instead of placeholder about unsupported media messaging) - Adjusting
Client#connectionStateChanged
event: addingdisconnected
anddisconnecting
states
Bug Fixes
- Fixed race in session initialization
- Various updates and fixes for documentation
Programmable Chat 2.0.1 (December 19, 2017)
Overview
This release is identical to 2.0.0. The sole purpose is to publish the new version to npmjs.com
.
Programmable Chat 2.0.0 (December 1, 2017)
Overview
Removed deprecated Client
constructor and Client.initialize
function, the correct way now is to use static function Client.create
.
Behavioral breaking change in adding Member and joining Channel, now if User is already in the Channel, then Channel.add
and Channel.join
will throw SessionError
. Changed function signature in Consumption Horizon functions, after successful setting of last message consumed these functions returns unread messages count in given Channel for logged in User.
Breaking Changes
Channel.add
andChannel.join
functions will throw anSessionError
in case of User already exists in the Channel- Consumption horizon functions now returns
Promise<number>
with count of unread messages in the channel after the operation:Channel.advanceLastConsumedMessageIndex
Channel.updateLastConsumedMessageIndex
Channel.setAllMessagesConsumed
Channel.setNoMessagesConsumed
Removed deprecated functions
Client
constructorClient.initialize
function
Bug Fixes
Client.version
property now correctly displays Client's version- Fixed getting next page of Channel's User Descriptors after calling
Channel.getUserDescriptors
Programmable Chat 1.2.1 (October 12, 2017)
Bug Fixes
- Fixed incorrect handling of network timeouts in React Native
- Fixed session errors handling
Programmable Chat 1.2.0 (September 18, 2017)
New Features
- Added Multimedia Messaging (beta) API (see * Media Support for more information) . Note Sending media messages on existing instances requires adding a new permission in your channel roles.
- In
Channel.sendMessage
method you can provideFormData
(for browsers) orSendMediaOptions
(browsers and node.js apps) to send media from your client Message
class is extended withtype
attributeMessage
class is extended withmedia
attribute which holdsMedia
class instance- Role should contain Channel level
sendMediaMessage
permission for users to be able to send Media Messages
Programmable Chat 1.1.2 (August 22, 2017)
Bug Fixes
- Fixed a big in client creation which caused the operation to fail in rare cases
Programmable Chat 1.1.1 (August 16, 2017)
Changes
- Added
PushNotification
interface for push notification representation - Added
Client#event:pushNotification
event - Added static method
Client.parsePushNotification
to handle push payload and return thePushNotification
instance back to client (intended use is Firebase service worker)
Bug Fixes
- Fixed unhandled promise rejections on new client creation in some rare cases
- SDK Reference Documentation fixes and updates
Programmable Chat 1.0.4 (July 14, 2017)
Bug Fixes
- Fixed additional issues related to Channel and ChannelDescriptor status updates not behaving as expected (which were not addressed in the 1.0.3 release)
Programmable Chat 1.0.3 (July 12, 2017)
Bug Fixes
- Fixed issues related to Channel status and uniqueName updates not behaving as expected
- SDK Reference Documentation fixes and updates
Programmable Chat 1.0.2 (July 4, 2017)
Changes
- Improvements made to the reliability of retrieval of Channel and User Descriptors
Bug Fixes
- Fix for clients with identities containing spaces / pluses / etc. during fetching Channel Descriptors
- Fix for object properties accessors in User, Member, Channel, Message
- Documentation fixes
Programmable Chat 1.0.1 (May 19, 2017)
Changes
- Added a new Factory method for creating the SDK Chat Client instance, specifically to avoid issues caused by using client that was created but not fully initialized. Note that the old manual constructor has been marked as
deprecated
.
Bug Fixes
- Fixed a rare issue whereby the client did not correctly initialize. This caused the typing indicator feature not to work correctly
- Fixed an issue whereby
messageRemoved
events were not correctly firing for messages that present at client init (i.e. not added after client init) - The JS library should now be React Native friendly
- Various Documentation fixes
Programmable Chat 1.0.0 (May 2, 2017)
With this release, Programmable Chat is now in GA. A number of breaking changes were introduced as part of the GA release. To see what has changed and to migrate from the latest Beta SDK to the new GA SDK, please read the * GA Migration Guide for JavaScript.
Overview
Client initialization has been simplified to reflect most users typical usage of the system. All user channels (channels for which the current user is joined to or an owner of) will be subscribed to from client startup but only the members roster will be synchronized initially. This keeps client startup fast while still reflecting the latest activity immediately to the client.
UserInfo
has been deprecated and replaced with two distinct classed, User
and UserDescriptor
. Similar to ChannelDescriptor
class, a UserDescriptor
represents a snapshot of data in time that should be utilized directly after obtaining it but not retained since it will not be updated with new data over time.
Users are no longer implicitly subscribed to to improve performance on large instances. You can subscribe up to a maximum 100 of users at once after which your least recently subscribed User will be unsubscribed.
Changes
- Removed
Client.getPublicChannels()
functionClient.getUserChannels()
functionClient#event:userInfoUpdated
eventMember.userInfo
propertyMember#event:userInfoUpdated
eventUserInfo
class
- Added
Channel.getUserDescriptors()
functionChannelDescriptor.isPrivate
propertyChannelDescriptor.lastConsumedMessageIndex
propertyChannelDescriptor.status
propertyChannelDescriptor.type
propertyClient.getPublicChannelDescriptors()
functionClient.getSubscribedChannels()
functionClient.getSubscribedUsers()
functionClient.getUser(identity)
functionClient.getUserChannelDescriptors()
functionClient.getUserDescriptor(identity)
functionClient#event:userSubscribed
eventClient#event:userUnsubscribed
eventClient#event:userUpdated
eventMember.getUser()
functionMember.getUserDescriptor()
function- new
User
class - new
UserDescriptor
class
Programmable Chat 0.13.0 (March 30, 2017)
Changelog
- Enable optimized UserInfo retrieval
Bug Fixes
- Fixed a bug whereby a Client init race condition caused issues in some browsers (EDGE and other browsers more rarely)
- Ensure callbacks will arrive for channel left (fixed a race)
- Fixed an issue whereby leaving and rejoining a channel caused events to not be received after the rejoin
- Fixed an issue so that the
channelAdded
event for public channels being joined was correctly fired again
Programmable Chat 0.12.0 (February 23, 2017)
Changes
- The
endpoint_id
identifier specified in access tokens is now automatically generated and persisted in the client browser cache. The following should be observed with this change:endpoint_id
is no longer a required identifier in your generated access tokens, you may omit it from this build forwardendpoint_id
will be ignored if specified with your access token
- Added a
direction
parameter to channel.getMessage method.backwards
is default direction to keep api compatible with previous versions
Bug Fixes
- Fixed a bug whereby the
anchor
parameter in channel.getMessage method was incorrectly processed.
Programmable Chat 0.11.1 (December 7, 2016)
Bug Fixes
- Fixed an issue where sometimes a 404 error was returned when querying a channel for messages and members, when the channel was retrieved through
getChannelBySid
andgetChannelByUniqueName
directly after the client start - Fixed an issue where the client sometimes failed to successfully start with a subscription setup error
- Fixed an issue where under certain conditions, the incorrect connection state was for the client instance
Programmable Chat 0.11.0 (November 21, 2016)
Changes
- Constructor doesn't accept AccessManager interface anymore. Just token. Also user has to call client.updateToken himself when needed.
- Removed
client.identity
property. Use client.userInfo.identity client.getUserChannels
is now paged and returns only channels which are related to the identity (statuses are: invited, joined, and private channels)client.getPublicChannels
returns list of channelDescriptor, also in paged mannerchannel.getMessagesPaged
is removedchannel.getMessages()
returns paginator instead of array- Added counter methods: channel.getMessagesCount, channel.getUnreadMessagesCount, channel.getMembersCount
userInfo#updated
event now also reports a name of a key which has been updated
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.