Modify Your Studio Script for HubSpot Integration

Integrating HubSpot with CXone Agent for Microsoft Teams requires adding actions to your existing Studio script. These actions execute the back end of the CRM configuration you set up in CXone. Add them to each script for the channelsClosed A way for contacts to interact with agents or bots. A channel can be voice, email, chat, social media, and so on. you want. For example, if you want to configure HubSpot integration for digital chat, modify your digital chat script. After you add the actions to the script, you need to customize them. This involves specifying the workflows you want to use.

Complete each of these tasks in the order given.

Download Template Script

Download this folder of template scripts. It contains voice and digital scripts for Desktop Studio and CXone Studio.

Each template script contains SNIPPET and WORKFLOW EXECUTE actions. This pair of actions is needed for each workflow you want to add to your script. The template scripts include two pairs of SNIPPET and WORKFLOW EXECUTE actions: one for a Search workflow and one for a Create workflow. You can delete the actions for the type of workflow you don't want. You can also copy and paste the SNIPPET and WORKFLOW EXECUTE actions to add more Create and Search workflows to your script.

Add Actions to Your Script

Modify your existing script for the channel you're working with.

In Desktop Studio

  1. Log in to Studio.

  2. Click File > Import from File. Select the voice or digital template script for Desktop Studio.

  3. Open the script you want to modify.

  4. Copy these actions from the template script and paste them where they belong in your existing script:

    Action Caption
    SNIPPET Snippet for Search Workflow

    WORKFLOW EXECUTE

    Workflow Execute for Search Workflow

    SNIPPET Snippet for Create Workflow
    WORKFLOW EXECUTE Workflow Execute for Create Workflow
    SNIPPET Snippet for Record ID
    SNIPPET Snippet for Send Workflow Response
    CUSTOMEVENT Send Workflow Response
    AGENT WORKFLOW CONFIGURATION None
  5. Save your script.

In CXone Studio

  1. In CXone, click the app selector and select Omnichannel RoutingStudio Three arrows joined at the base. One points straight up, one up and to the right, and one up and to the left. .
  2. Click Load Script. Select the voice or digital template script for CXone Studio.

  3. Open the script you want to modify.

  4. Add these actions to your script:

    Action Caption
    SNIPPET Snippet for Search Workflow

    WORKFLOW EXECUTE

    Workflow Execute for Search Workflow

    SNIPPET Snippet for Create Workflow
    WORKFLOW EXECUTE Workflow Execute for Create Workflow
    SNIPPET Snippet for Record ID
    SNIPPET Snippet for Send Workflow Response
    CUSTOMEVENT Send Workflow Response
    AGENT WORKFLOW CONFIGURATION None

    Copying actions between scripts isn't yet supported in CXone Studio.

  5. Copy the code from each SNIPPET action in the template script and paste it into the corresponding SNIPPET action you added to your script.

  6. Save your script.

Customize Studio Actions

Customize the Studio actions for:

Snippet for Search Workflow

This SNIPPET action contains the code for each HubSpot Search workflow. You can only configure one workflow per SNIPPET. You must have one SNIPPET action and one WORKFLOW EXECUTE action for each workflow.

  1. If you're using Desktop Studio, double-click the SNIPPET action in your script named Snippet for Search Workflow.

  2. If you're using CXone Studio, select the SNIPPET action in your script named Snippet for Search Workflow and click Open Editor in the action's properties.

  3. Determine which workflow you're using in this SNIPPET, then delete the code for the other workflows.

  4. For the workflow you want to use, edit the code according to the instructions for that workflow.

  5. To configure more than one Search workflow in this script:

    1. Copy and paste this SNIPPET.

    2. Copy and paste the WORKFLOW EXECUTE action that follows this SNIPPET.

  6. Save your script.

Workflow Execute for Search Workflow

This action must come after a SNIPPET with the code for a HubSpot Search workflow.

  1. If you're using Desktop Studio, double-click the Workflow Execute action in your script named Workflow Execute for Search Workflow to launch the Workflow Execute wizard.

  2. If you're using CXone Studio, select the Workflow Execute action in your script named Workflow Execute for Search Workflow and click Open Editor in the action's properties. This launches the Workflow Execute wizard.

  3. In the Configuration Name field, select the HubSpot integration you want this Workflow Execute action to use. The drop-down displays the names of all configured integrations in your CXone system.
  4. In the Actions field, select Search.

  5. Under Workflow Mapping, select the Search workflow mapping you want this script to execute. You can only select one mapping per Workflow Execute action.

  6. Click Next.
  7. Verify your selections in the pop-up window. If you need to change a selection, click No and make your change.
  8. Click Yes in the pop-up window to apply your selections to the Workflow Execute properties.
  9. Save your script.

Snippet for Create Workflow

This SNIPPET action contains the code for each HubSpot Create workflow. You can only configure one workflow per SNIPPET. You must have one SNIPPET action and one WORKFLOW EXECUTE action for each workflow.

  1. If you're using Desktop Studio, double-click the SNIPPET action in your script named Snippet for Create Workflow.

  2. If you're using CXone Studio, select the SNIPPET action in your script named Snippet for Create Workflow and click Open Editor in the action's properties.

  3. Determine which workflow you're using in this SNIPPET, then delete the code for the other workflows.

  4. For the workflow you want to use, edit the code according to the instructions for that workflow.

  5. To configure more than one Create workflow in this script:

    1. Copy and paste this SNIPPET.

    2. Copy and paste the WORKFLOW EXECUTE action that follows this SNIPPET.

  6. Save your script.

Workflow Execute for Create Workflow

This action must come after a SNIPPET with the code for a HubSpot Create workflow.

  1. If you're using Desktop Studio, double-click the Workflow Execute action in your script named Workflow Execute for Create Workflow to launch the Workflow Execute wizard.

  2. If you're using CXone Studio, select the Workflow Execute action in your script named Workflow Execute for Create Workflow and click Open Editor in the action's properties. This launches the Workflow Execute wizard.

  3. In the Configuration Name field, select the HubSpot integration you want this Workflow Execute action to use. The drop-down displays the names of all configured integrations in your CXone system.
  4. In the Actions field, select Create.

  5. Under Workflow Mapping, select the Create workflow mapping you want this script to execute. You can only select one mapping per Workflow Execute action.

  6. Click Next.
  7. Verify your selections in the pop-up window. If you need to change a selection, click No and make your change.
  8. Click Yes in the pop-up window to apply your selections to the Workflow Execute properties.
  9. Save your script.

Snippet for Record ID

This SNIPPET action holds the record ID for the record created by the Create workflow. If you do not have any Create workflows in your script, you can delete this action. If you have more than one Create workflow, this action can hold the record IDs for each.

  1. If you're using Desktop Studio:

    1. Right-click the WORKFLOW EXECUTE action in your script named Workflow Execute for Create Workflow.

    2. Copy the value of the resultSet (out) property.

    3. Double-click the SNIPPET action in your script named Snippet for Record ID.

    4. Paste the value of the resultSet (out) property between the curly brackets in the code, replacing the word array.

    5. Change [RecordType] to the type of record created by the Create workflow.

  2. If you're using CXone Studio:

    1. Select the WORKFLOW EXECUTE action in your script named Workflow Execute for Create Workflow.

    2. From the properties panel on the right, copy the value of the Result Set property.

    3. Select the SNIPPET action in your script named Snippet for Record ID and click Open Editor in the action's properties.

    4. Paste the value of the Result Set property between the curly brackets in the code, replacing the word array.

    5. Change RecordType to the type of record created by the Create workflow.

  3. If you have more than one Create workflow in your script, repeat the steps above for each Create workflow.

  4. Save your script.

Agent Workflow Configuration

This action executes workflows when the agent manually triggers them in CXone Agent for Microsoft Teams. It moves information between the script and CXone Agent for Microsoft Teams, depending on the workflow the agent used.

  1. Select the AGENT WORKFLOW CONFIGURATION action in your script.

  2. In the properties panel on the right, locate the AgentUserId property. If this is a voice script, make sure the property's value is {global:__AgentID}. If this is a digital script, make sure the property's value is {AgentID}.

  3. If you're using Desktop Studio, double-click the Agent Workflow Configuration action in your script. This launches the Custom CRM Configurations wizard.

  4. If you're using CXone Studio, select the Agent Workflow Configuration action in your script and click Open Editor in the action's properties. This launches the Custom CRM Configurations wizard.

  5. Select the Custom CRM Configuration you want this Agent Workflow Configuration action to use. The drop-down displays the names of all configured integrations in your CXone environment.
  6. Select one or more Actions that you want agents to be able to perform when this script runs.

  7. In the Workflow Mapping section, select the workflows that you want to assign to the Actions you selected. You can only select one workflow per action. If you want to change a workflow mapping, clear the first selection before choosing a new workflow. The Action column shows which action each workflow option corresponds to.

  8. Click Next.
  9. Verify your selections on the Custom CRM Configurations Updated window. If you need to change a selection, close the window and make your change.
  10. Click Save in the Custom CRM Configurations Updated window to apply your selections to the Agent Workflow Configuration properties.
  11. Save your script.

Test Your Script

Test your script by simulating an interaction in Desktop Studio or CXone Studio.

The next step of integrating HubSpot with CXone Agent for Microsoft Teams is to configure workflows.