Skip to content

Add watsonx Orchestrate Embed Chat Examples with Node.js Implementations#27

Open
rohitmulay-ibm wants to merge 4 commits into
mainfrom
secure-embed-chat-example
Open

Add watsonx Orchestrate Embed Chat Examples with Node.js Implementations#27
rohitmulay-ibm wants to merge 4 commits into
mainfrom
secure-embed-chat-example

Conversation

@rohitmulay-ibm
Copy link
Copy Markdown
Collaborator

@rohitmulay-ibm rohitmulay-ibm commented Apr 27, 2026

PR Description

Overview

This PR introduces comprehensive embed chat integration examples for IBM watsonx Orchestrate, providing developers with ready-to-use implementations for both anonymous and secure chat scenarios.

What's Added

📁 New Directory Structure

  • embed_chat_examples/ - Root directory for all embed chat examples
  • Complete documentation and implementation guides

🔓 Anonymous Embed Chat (Node.js)

  • Simple, unsecured embed chat integration for development/testing
  • Express.js server implementation
  • Static HTML demo page
  • Quick start guide with setup instructions
  • Use case: Development, testing, internal demos

🔐 Secure Embed Chat (Node.js)

  • Production-ready secure embed chat with JWT authentication
  • RS256 JWT token generation and validation
  • Public/private key pair management
  • User identity verification
  • Comprehensive security documentation
  • Use case: Production deployments, user-specific experiences

📚 Documentation

  • Main README with feature comparison matrix
  • Individual README files for each example
  • Security best practices and guidelines
  • Step-by-step setup instructions
  • Configuration guides for watsonx Orchestrate

🛠️ Infrastructure

  • .gitignore file for Python, Node.js, and IDE-specific files
  • Package management files (package.json, package-lock.json)
  • Example JWT keys for development
  • Server configuration templates

Key Features

  • Two implementation patterns: Anonymous and Secure
  • JWT-based authentication: RS256 algorithm with public/private key pairs
  • User identity management: Custom claims support (name, email, groups)
  • Production-ready: Security best practices and error handling
  • Easy deployment: Docker-ready with clear setup instructions
  • Comprehensive docs: Step-by-step guides for both scenarios

Technical Details

  • Framework: Express.js (Node.js)
  • Authentication: JWT (RS256)
  • Security: Token validation, key management, CORS configuration
  • Frontend: Vanilla HTML/CSS/JavaScript with modern UI

Testing

Both examples include:

  • Local development server setup
  • Test endpoints for JWT generation
  • Demo HTML pages for validation
  • Clear success/error indicators

@rohitmulay-ibm rohitmulay-ibm changed the title wxO embed chat examples Add watsonx Orchestrate Embed Chat Examples with Node.js Implementations Apr 27, 2026
@rohitmulay-ibm rohitmulay-ibm marked this pull request as ready for review April 27, 2026 16:48
Copy link
Copy Markdown

@TazmanianDI TazmanianDI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I t

@@ -0,0 +1,1372 @@
<!DOCTYPE html>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're being inconsistent in your file name schema. The folder is snake case and the files names are kabob case. Pick up and stick with it. And I would just rename the folder to anonymous-users since really what this example is showing is the most basic use case. Everything in here is going to be for embed so repeating that in all the folders names will be redundant. And "node" doesn't mean anything here.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">

<script>
/**
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's follow our own chat coding standard. That means don't use jsdoc here. Use // line comments.

<div id="root"></div>

<!-- Animated Background -->
<div class="animated-bg">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all totally unnecessary for the purpose of this tutorial. Examples really should be pretty narrowly scoped to the functionality required to educate the customer about the feature. The purpose here is education, not a demo. Having all of this html is pretty but it just more code the developer has to wade through to figure out what specifically they need to understand in order to make use of this feature. There's over 1000 lines of html code here and a less observant developer may think this is all necessary in order to use the chat. I think just a simple "Example web page" or somewhat would be fine with just a couple lines of html.

Focus on the main purpose of these examples. They're meant to be functional, not pretty.

@@ -0,0 +1,1372 @@
<!DOCTYPE html>
<html lang="en">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably move this down a couple of layers to start a pattern. Some of these tutorials will probably eventually involve multiple types of code. This one is plain javascript for the client but we might have one that's in react at same point.

You should leave the README.me here.

And then I would move this file to anonymous-users/client/javascript/static/index.html. Then we can have client/server folders and javascripr/react/angular/web-components folders.


<body>
<!-- Mount node for the chat (fullscreen-overlay/direct render). -->
<div id="root"></div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure this root element is unnecessary so we can leave it out of our examples.

hostURL: "https://your-instance.watson-orchestrate.ibm.com",

// ID of the HTML element where the chat will be mounted
rootElementID: "root",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And same above, I would remove all the "root" stuff.

}
};

getIdentityToken().then(() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You won't need this if you rely on the token event instead.

- You're building a proof-of-concept
- No sensitive data or systems are accessed

**Quick start:**
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't repeat this info here. If you want a table of contents, fine but leave the instructions in each file.

@@ -0,0 +1,73 @@
# IBM watsonx Orchestrate Embed Chat Examples
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should probably split this folder. I would make this embed_chat/examples. Then you could potentially have embed_chat/utilities or embed_chat/common where you can put stuff to share across examples to avoid repeating things.

- [Configuring security for embedded chat](https://www.ibm.com/docs/en/watsonx/watson-orchestrate/base?topic=chat-configuring-security-embedded)
- [Configuring security with scripting](https://www.ibm.com/docs/en/watsonx/watson-orchestrate/base?topic=chat-configuring-security-scripting)

## Quick Comparison
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely don't repeat this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants