A channel is an entry point into your agent, such as a website where you would like to embed your agent, a Slack app, and so on.

watsonx Orchestrate channels webchat

Embedding webchat

To simplify integration with your website, the CLI includes an easy-to-use webchat embed command. This command will, for the currently active environment, take the name of an agent and produce a script tag that you can place in the <head></head> of your page.

When targeting local, it uses your agent’s draft variant. On a production instance, it uses your agent’s live (deployed) variant by default.

[BASH]
$ orchestrate channels webchat embed --agent-name=test_agent1
<script>
    window.wxOConfiguration = {{
        orchestrationID: "my-tenant-id",
        hostURL: "my-host-url",
        rootElementID: "root",
        showLauncher: true,
        chatOptions: {{
            agentId: "test_agent1",
            agentEnvironmentId: "my-agent-draft-env-id"
        }},
    }};
    setTimeout(function () {{
        const script = document.createElement('script');
        script.src = `my-host-url/wxochat/wxoLoader.js?embed=true`;
        script.addEventListener('load', function () {{
        wxoLoader.init();
        }});
        document.head.appendChild(script);
    }}, 0);
</script>