Skip to content

Release 5.0.0

Compare
Choose a tag to compare
@smooch-ci-web smooch-ci-web released this 30 Sep 20:14
· 45 commits to master since this release

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 (minimum 4) 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

Conversation List

A new conversation list view has been introduced allowing users to navigate between their conversations.

  • If the canUserSeeConversationList config setting is set to true the user will be able to navigate to this view once they have at least one conversation.
  • If the canUserCreateMoreConversations config setting is set to true 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 of type:personal. It will also create a user if one does not already exist.

  • updateConversation allows integrators to update the displayName, iconUrl, description, and metadata 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. Returns null 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:

Synchronous validation (errors thrown) has been added in the following methods:

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 the options argument

    • appId is no longer supported. The suggestion to use integrationId instead was first mentioned in the v4.29.0 release, and as of v5.0.0 support for it has been removed.
    • userId is no longer supported, externalId should be used instead
    • Renamed fixedIntroPane to fixedHeader
  • login no longer supports userId, externalId should be used instead

  • getUser will now return an empty object rather than undefined if there is no user

  • updateUser will now return an empty object rather than undefined if there is no user

  • getConversation has been removed in favor of getDisplayedConversation

  • getConversations no longer accepts an offset 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 of createConversation

  • conversationId is now a required argument for sendMessage and triggerPostback

  • The following user properties have been updated for the payload returned by getUser and updateUser

    • _id is now id
    • userId is now externalId
    • properties is now metadata
  • The following conversation properties have been updated for the payload returned by createConversation, getConversationById, getConversations, getDisplayedConversation,getMoreConversations, login, and updateConversation

    • _id is now id
    • The following participant properties have been updated for the participants included in the participants array
      • _id is now id
      • appUserId is now userId
    • The following message properties have been updated for the messages included in the messages array
      • _id is now id
      • authorId is now userId and will only be included for messages with role = "user"
      • name is now displayName
      • role now has the values of either user or business rather than appUser or appMaker
      • The following action properties have been updated for the actions included in the actions array
        • _id is now id

Delegates

  • The following conversation properties have been updated of the data object passed down with beforeDisplay, beforeSend, and beforePostbackSend delegates

    • _id is now id

    • The following participant properties have been updated for the participants included in the conversation

      • _id is now id
      • appUserId is now userId
  • The following message properties have been updated for the message passed to the beforeDisplay and beforeSend delegates

    • _id is now id
    • authorId is now userId and will only be included for messages with role = "user"
    • name is now displayName
    • role now has the values of either user or business rather than appUser or appMaker
    • The following action properties have been updated for the actions included in the actions array
      • _id is now id

Events

  • All conversation, participant, message, and action property changes described in the Client APIs and Delegates 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.

v5 Web Messenger UI

customText

The default values for the following strings have been modified:

  • connectedNotificationText to Sync your conversation and continue messaging us through your favorite app.
  • couldNotConnect to Offline. You will not receive messages.. To retry connecting, users are now presented with a circular arrow icon
  • emailFieldLabel to Email
  • emailFormButton to Submit
  • notificationSettingsChannelsDescription to Sync this conversation by connecting to your favorite messaging app to continue the conversation your way.
  • shareLocation to Location
  • smsContinue to Send
  • smsInvalidNumberError to Please submit a valid phone number.
  • uploadDocument to File
  • uploadPhoto to Image