---
schema_version: "1"
id: 5500b9c18ff15f8db297201954df8a8bc01f20b41176d996d214d5fcc6c66e62
title: Messaging Framework for Omniscripts
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_messaging_framework_11452.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_messaging_framework_11452.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 185666870cabaab3e4c7d0c0551a980c32e18d594ce13b55a552c2effd947fd3
description: Communicate between an Omniscript, windows, Lightning web components, and Omniscript elements with window post messages, session storage messages, and PubSub messaging.
products:
  - Omnistudio
release: "264"
---
# Messaging Framework for Omniscripts

Communicate between an Omniscript, windows, Lightning web components, and Omniscript elements with window post messages, session storage messages, and PubSub messaging.

Determine which object or component needs to handle and use data, and use the corresponding property.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
          <colgroup>
            <col>
            <col>
            <col>
            <col>
          </colgroup>
          <thead class="slds-text-title_caps ">
            <tr class="">
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d64198e45">
                <p style="margin-bottom:0;">Property</p>
              </th>
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d64198e51">
                <p style="margin-bottom:0;">Description</p>
              </th>
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d64198e57">
                <p style="margin-bottom:0;">Object or Component</p>
              </th>
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d64198e63">
                <p style="margin-bottom:0;">Example</p>
              </th>
            </tr>
          </thead>
          <tbody>
            <tr class="">
              <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e45 ">
                <p style="margin-bottom:0;">Window postMessage</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e51 ">
                <p style="margin-bottom:0;">Send information from an element to a window object in key-value pairs.</p>
              </td>

              <td data-label="Object or Component" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e57 ">
                <p style="margin-bottom:0;">Window object</p>
              </td>

              <td data-label="Example" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e63 ">
                <p style="margin-bottom:0;">
                  <a href="https://help.salesforce.com/s/articleView?id=xcloud.os_messaging_framework_11452.htm&amp;release=264.0.0&amp;type=5" title="Communicate between Omniscript, windows, and components with window post messages and session storage messages.">Message with Window Post Messages and Session Storage Messages</a>
                </p>
              </td>

            </tr>
            <tr class="">
              <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e45 ">
                <p style="margin-bottom:0;">Pub/Sub</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e51 ">
                <p style="margin-bottom:0;">Communicate with Omniscript from a custom LWC by sending key-value pairs. Use the events passed in the key-value pairs to trigger custom behavior in a component.</p>
              </td>

              <td data-label="Object or Component" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e57 ">
                <p style="margin-bottom:0;">Lightning Web Components</p>
              </td>

              <td data-label="Example" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e63 ">
                <p>
                  <a href="https://help.salesforce.com/s/articleView?id=xcloud.os_communicate_with_omniscript_from_a_lightning_web_component_18222.htm&amp;release=264.0.0&amp;type=5" title="Send data from Omniscript actions and steps to other Lightning web components using the Publish and Subscribe property.">Communicate from Omniscript to a Lightning Web Component</a>
                </p>
                <p style="margin-bottom:0;">This topic is part of creating custom Lightning web components for
                  Omniscripts.</p>
              </td>

            </tr>
            <tr class="">
              <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e45 ">
                <p style="margin-bottom:0;">Session Storage</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e51 ">
                <p style="margin-bottom:0;">Send information to a Session Storage object using key-value pairs. A session storage object clears when a page session ends.</p>
              </td>

              <td data-label="Object or Component" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e57 ">
                <p style="margin-bottom:0;">Session Storage object</p>
              </td>

              <td data-label="Example" class="slds-cell-wrap" style="vertical-align:top;" headers="d64198e63 ">
                <p style="margin-bottom:0;">
                  <a href="https://help.salesforce.com/s/articleView?id=xcloud.os_messaging_framework_11452.htm&amp;release=264.0.0&amp;type=5" title="Communicate between Omniscript, windows, and components with window post messages and session storage messages.">Message with Window Post Messages and Session Storage Messages</a>
                </p>
              </td>

            </tr>
          </tbody>
        </table>

## Message with Window Post Messages and Session Storage Messages

Communicate between Omniscript, windows, and components with window post messages and session storage messages.

Pass element information and data JSON from Omniscript elements containing the window post message, session storage message, and LWC Pub/Sub message. For information on using the pub/sub message in Omniscript, see [Communicate from Omniscript to a Lightning Web Component](https://help.salesforce.com/s/articleView?id=xcloud.os_communicate_with_omniscript_from_a_lightning_web_component_18222.htm&release=264.0.0&type=5 "Send data from Omniscript actions and steps to other Lightning web components using the Publish and Subscribe property.").

1. To add window post messages or session storage messages:
    
    1. In the element, check the **Window Post Message** checkbox or the **Session Storage Message** checkbox.
        
        Default Messaging:
        
        ```
        {
          Type: <element_type>,
          OmniEleName: <element_name>
        }
        ```
        
        When enabled, the default messaging sends the name of the element and the type of the element.
    
    1. (Optional) In the **Messages** property, add additional messaging to the node by entering a Key/Value pair.
        
        The **Value** field accepts merge syntax. For information on merge fields, see [Access Omniscript Data JSON with Merge Fields](https://help.salesforce.com/s/articleView?id=xcloud.os_access_omniscript_data_json_with_merge_fields_22053.htm&release=264.0.0&type=5 "Enable Omniscript elements and element properties to access data JSON using merge fields. A merge field is a variable that references the value of a JSON node. For example, if a JSON node is \"FirstName\": \"John\", then the merge field %FirstName% returns John.").
    
    1. Pass a value in the c\_\_messagingKey URL parameter to change the node that stores the messaging payload for window.postMessage and session storage message.
2. To add messages to a Step:
    
    1. In the Step's properties, click **Edit Properties as JSON**.
    
    1. Paste in the following JSON before the closing curly bracket:
        
        ```
        "wpm": false,
        "ssm": false,
        "message": {}
        ```
    2. Enable WPM or SSM by setting the value equal to true.
        
        ```
        "wpm": true
        ```
    3. Add additional key/value pairs inside the message object.
        
        ```
        "message": {"Account":%AccountId%, "Status": %AccountStatus%}
        ```

What’s next: Preview the Omniscript and test the messaging behavior by inspecting the corresponding element in your browser’s console or developer tools.