Updating from V1 to V2 JavaScript syntax in Zoom Contact Center

Zoom Contact Center is discontinuing support for the V1 JavaScript code syntax. Customers currently using V1 syntax must update their JavaScript code to the V2 syntax to ensure continued functionality.

JavaScript code is utilized in two key areas within Zoom Contact Center flows:

Requirements for updating from V1 to V2 JavaScript Syntax in Zoom Contact Center

Table of Contents

How to determine the version of JavaScript code in the ZCC flow

You can identify if your JavaScript code is using V1 syntax by checking for references to module.exports. This syntax is specific to V1 JavaScript.

V1 Javascript example

module.exports = async() => {
    
}

V2 Javascript example

async function main () {
    
}

Only V1 JavaScript is affected by this change. If your flow includes V1 JavaScript, you must update the code to comply with the V2 syntax.

How to identify and update V1 JavaScript Code in Script widgets

To locate the Script widget in your flow, inspect the JavaScript code for module.exports, which indicates V1 syntax.

To update a Script widget from V1 to V2, you need to replace the widget entirely. This involves deleting the existing widget and adding a new one. We recommend following these steps:

  1. Export a copy of your ZCC flow and save it to your computer for backup.
  2. Locate the Script widget in your flow then click the edit icon on each widget to view its code.
  3. Check the code within each Script widget for references to require or module.exports.
    If these references exist, the widget is using Script V1. See the example below for a typical Script V1.



  4. Your flow may include a mix of both Script V1 and Script V2 widgets. Inspect each Script widget individually to determine its version.
    Note: If any Script widgets use V1, they must be updated to V2. Before making any changes, create a new draft version of your flow to preserve the current state.
  5. Identify all Script widgets using V1 that need to be updated.
  6. Drag a new Script widget into your Flow.
  7. Copy the custom code from the old V1 widget into the new V2 widget. For example, custom code in the old widget might appear on lines 12 and 16–24. Transfer only the custom parts.



  8. In the new Script widget, paste the custom code into the async function. Ensure the code does not reference module.exports or require.



  9. Change the name of the old V1 widget to something like old widget.
  10. Assign the new V2 widget the exact same name (case-sensitive) as the original V1 widget. This ensures any flow references to the widget name remain intact.
  11. Save then Publish your flow.
  12. Test your flow. If you have any issues, you can revert your flow version.

How to identify and update V1 Event Script code in Start widgets

To upgrade the Event Script code from V1 to V2, you’ll need to delete the existing event and recreate it. We recommend following the outlined steps below.

  1. Export a copy of your ZCC flow and save it to your computer for backup.
  2. Open your flow and click on the Start widget.
  3. Identify any Event Scripts and click the edit icon to view their code.



  4. Identify V1 JavaScript Code. Old V1 Event Scripts can be recognized by the use of require and module.exports in their code, as shown in the example below.
    Keep in mind that multiple Event Scripts may exist within your flow. All Event Scripts are configured on the Start widget, so ensure you check each one for the use of V1 JavaScript.



  5. If multiple Event Scripts use V1 JavaScript, repeat the following steps for each script. Before making any changes, create a new draft version of your flow.
  6. Locate the V1 Event Script in the Start widget, edit it, and copy the JavaScript code into a text editor on your computer.
    Note: The Event type configured in the dropdown (for example, Engagement accepted in the example below).



  7. After saving the event type and JavaScript code, delete both the script and the Event Script by clicking the red trashcan icon.
  8. Recreate the Event on the Start widget and configure it as a new V2 Event Script.
  9. Paste the JavaScript code from your text editor into the new script. Use the example provided as a guide for V2 Event Script formatting.



  10. Save then Publish your flow.
  11. Test your flow. If you have any issues, you can revert your flow version.