Release 5.0.0
v5.0.0
Upgrading to 5.0.0
This new major version of the Web Messenger brings a new loader script found here. Until the old loader script is replaced with the new snippet, no changes will be seen. Once the new script is running, the latest version of the Web Messenger will be loaded by default. Additionally this script also supports version pinning.
Detailed Changelog
✨ New Features
Loader Script
-
There is a new loader script for version
5.0.0
of the Web Messenger that will need to be used to load the latest version. -
In addition to serving the new version of the Web Messenger, the new loader allows integrators to pin a specific version (>=
4.0.0
)- If no changes are made to the loader script, the latest version will be loaded
- Integrators can instead replace the included version (
5
) with a supported major version (minimum4
) or a specific version (e.g.:4.29.21
)
Example pinning version 4.29.21
:
<script>
!function(o,p,s,e,c){var i,a,h,u=[],d=[];function t(){var t="You must provide a supported major version.";try{if(!c)throw new Error(t);var e,n="https://cdn.smooch.io/",r="smooch";if((e="string"==typeof this.response?JSON.parse(this.response):this.response).url){var o=p.getElementsByTagName("script")[0],s=p.createElement("script");s.async=!0;var i=c.match(/([0-9]+)\.?([0-9]+)?\.?([0-9]+)?/),a=i&&i[1];if(i&&i[3])s.src=n+r+"."+c+".min.js";else{if(!(4<=a&&e["v"+a]))throw new Error(t);s.src=e["v"+a]}o.parentNode.insertBefore(s,o)}}catch(e){e.message===t&&console.error(e)}}o[s]={init:function(){i=arguments;var t={then:function(e){return d.push({type:"t",next:e}),t},catch:function(e){return d.push({type:"c",next:e}),t}};return t},on:function(){u.push(arguments)},render:function(){a=arguments},destroy:function(){h=arguments}},o.__onWebMessengerHostReady__=function(e){if(delete o.__onWebMessengerHostReady__,o[s]=e,i)for(var t=e.init.apply(e,i),n=0;n<d.length;n++){var r=d[n];t="t"===r.type?t.then(r.next):t.catch(r.next)}a&&e.render.apply(e,a),h&&e.destroy.apply(e,h);for(n=0;n<u.length;n++)e.on.apply(e,u[n])};var n=new XMLHttpRequest;n.addEventListener("load",t),n.open("GET","https://"+e+".webloader.smooch.io/",!0),n.responseType="json",n.send()}(window,document,"Smooch","<integration-id>","4.29.21");
</script>
Conversation List
A new conversation list view has been introduced allowing users to navigate between their conversations.
- If the
canUserSeeConversationList
config setting is set totrue
the user will be able to navigate to this view once they have at least one conversation. - If the
canUserCreateMoreConversations
config setting is set totrue
the user will be able to create new conversations from this view.
See our public guide for more detail.
Client APIs
-
createConversation
allows integrators to create a conversation oftype
:personal
. It will also create auser
if one does not already exist. -
updateConversation
allows integrators to update thedisplayName
,iconUrl
,description
, andmetadata
properties of a conversation. -
hasMoreConversations
determines if the user has more conversations to be fetched from the server -
getMoreConversations
fetches and returns the next conversations (at most 10) of the user to be loaded to the view. -
getDisplayedConversation
returns the conversation object currently viewed by the user. Returnsnull
if the user is viewing the conversation list.
Events
- A new
reconnecting
event can now be subscribed to. For example:Smooch.on('reconnecting', () => { console.log('Reconnecting...'); })
customText
The following new customizable strings have been introduced. See the readme for more details.
- Errors displayed in the notification banner:
couldNotConnectRetry
couldNotConnectRetrySuccess
couldNotLoadConversations
- Channel Linking:
emailLinkingErrorMessage
linkChannelPageHeader
syncConversation
- Conversation List:
conversationListHeaderText
conversationListRelativeTimeJustNow
conversationListRelativeTimeMinute
conversationListRelativeTimeMinutes
conversationListRelativeTimeHour
conversationListRelativeTimeHours
conversationListRelativeTimeYesterday
conversationListTimestampFormat
conversationListPreviewAnonymousText
conversationListPreviewCarouselText
conversationListPreviewFileText
conversationListPreviewFormText
conversationListPreviewFormResponseText
conversationListPreviewImageText
conversationListPreviewLocationRequestText
conversationListPreviewUserText
newConversationButtonText
🧨 Breaking Changes
SDK Initialization Validation
The initialization validation of the SDK that we perform in some of our Client API methods, which may return an error saying Must provide an externalId and a JWT to log in.
, is now returned as a rejected Promise
in the following asynchronous methods:
- getConversationById
- loadConversation (added validation)
- markAllAsRead (added validation)
- render
- sendMessage
- triggerPostback
Synchronous validation (errors thrown) has been added in the following methods:
- setPredefinedMessage (added validation)
- showNotificationChannelPrompt (added validation)
customText
The following custom strings have been removed. The usages of these strings in the config can be safely removed from your code.
connectNotificationSingleButtonText
connectNotificationOthersText
couldNotConnectInner
couldNotConnectWithRetry
couldNotConnectWithRetryInner
introductionText
Client APIs
-
init
has had changes to theoptions
argumentappId
is no longer supported. The suggestion to useintegrationId
instead was first mentioned in the v4.29.0 release, and as ofv5.0.0
support for it has been removed.userId
is no longer supported,externalId
should be used instead- Renamed
fixedIntroPane
tofixedHeader
-
login
no longer supportsuserId
,externalId
should be used instead -
getUser
will now return an empty object rather thanundefined
if there is no user -
updateUser
will now return an empty object rather thanundefined
if there is no user -
getConversation
has been removed in favor ofgetDisplayedConversation
-
getConversations
no longer accepts anoffset
and will now return all the conversations currently stored in memory.getMoreConversations
can be used to load more conversations into memory. -
startConversation
has been removed in favor ofcreateConversation
-
conversationId
is now a required argument forsendMessage
andtriggerPostback
-
The following user properties have been updated for the payload returned by
getUser
andupdateUser
_id
is nowid
userId
is nowexternalId
properties
is nowmetadata
-
The following
conversation
properties have been updated for the payload returned bycreateConversation
,getConversationById
,getConversations
,getDisplayedConversation
,getMoreConversations
,login
, andupdateConversation
_id
is nowid
- The following
participant
properties have been updated for the participants included in theparticipants
array_id
is nowid
appUserId
is nowuserId
- The following
message
properties have been updated for the messages included in themessages
array_id
is nowid
authorId
is nowuserId
and will only be included for messages withrole = "user"
name
is nowdisplayName
role
now has the values of eitheruser
orbusiness
rather thanappUser
orappMaker
- The following
action
properties have been updated for the actions included in theactions
array_id
is nowid
Delegates
-
The following
conversation
properties have been updated of the data object passed down withbeforeDisplay
,beforeSend
, andbeforePostbackSend
delegates-
_id
is nowid
-
The following
participant
properties have been updated for the participants included in theconversation
_id
is nowid
appUserId
is nowuserId
-
-
The following
message
properties have been updated for the message passed to thebeforeDisplay
andbeforeSend
delegates_id
is nowid
authorId
is nowuserId
and will only be included for messages withrole = "user"
name
is nowdisplayName
role
now has the values of eitheruser
orbusiness
rather thanappUser
orappMaker
- The following
action
properties have been updated for the actions included in theactions
array_id
is nowid
Events
- All
conversation
,participant
,message
, andaction
property changes described in theClient APIs
andDelegates
sections also apply to events.
💅 Enhancements
Redesign
The Web Messenger has been redesigned! Except for what is highlighted here the behaviour is the same, but it is now packaged with a sleeker and more modern design.
customText
The default values for the following strings have been modified:
connectedNotificationText
toSync your conversation and continue messaging us through your favorite app.
couldNotConnect
toOffline. You will not receive messages.
. To retry connecting, users are now presented with a circular arrow iconemailFieldLabel
toEmail
emailFormButton
toSubmit
notificationSettingsChannelsDescription
toSync this conversation by connecting to your favorite messaging app to continue the conversation your way.
shareLocation
toLocation
smsContinue
toSend
smsInvalidNumberError
toPlease submit a valid phone number.
uploadDocument
toFile
uploadPhoto
toImage