Passing a Noibu Help Code into Live Chat

Last updated: March 20, 2026

This guide outlines how to:

  1. Generate a Noibu Help Code using the Noibu SDK

  2. Automatically pass that Help Code into a Live Chat session

This allows your support team to immediately correlate a live chat with a specific user session in Noibu.


Step 1: Generate a Noibu Help Code

Before sending anything to chat, you must generate a Help Code using the Noibu SDK.

Please review the full Help Code documentation here - Help Code Overview

In short, the Help Code is generated using:

window.NOIBUJS.requestHelpCode(false);

This returns a unique session identifier that can be shared with your support team.


Step 2: Send the Help Code to Live Chat

Once generated, the Help Code can be passed programmatically into the Chat widget.

Note: The exact implementation depends on the API version you are using. The example below demonstrates a common pattern using the Zendesk Web Widget API.

Example Implementation (Pseudocode)

1. Load the Chat Resource

$( window ).on('load', function() { 
loadChatResource();
});

function loadChatResource() {
if (noExistingChat) {
chatIcon.on('click', function(){
startNewChat(element);
})
};
}

2. Start Chat and Request Help Code

function startNewChat(element) {
script.addEventListener("load", function(event) {
chatWidgetAPIGlobalFunction('chatWidget:on', 'chat:start', function() {
requestNoibuHelpCode(successNoibuCallback, failureNoibuCallback, timeoutDurationInt);
});
});
}

3. Request the Help Code (with Timeout Protection)

async function requestNoibuHelpCode(success, failure, timeoutInt) {
try {
const timeoutPromise = new Promise((_, reject) => {
setTimeout(() => reject(new Error('timeout')), timeoutInt);
});

const helpCodePromise = window.NOIBUJS.requestHelpCode(false);
const helpCode = await Promise.race([helpCodePromise, timeoutPromise]);
success(helpCode);
} catch (err) {
failure(err.message === 'timeout' ? 'TIMEOUT' : 'ERROR');
}
}

This ensures:

  • The Help Code request does not hang indefinitely

  • Errors and timeouts are handled cleanly

4. Save and Send the Help Code to Chat

function successNoibuCallback(noibuHelpCode) {

if (window.noibuHelpCode) {

if (window.noibuHelpCode !== noibuHelpCode) {

console.log("Updating saved Noibu helpcode from", window.noibuHelpCode, "to", noibuHelpCode);

window.noibuHelpCode = noibuHelpCode;

window.noibuHelpCodeTimestamp = new Date();

}

} else {

console.log("Saving Noibu helpcode to", noibuHelpCode);

window.noibuHelpCode = noibuHelpCode;

window.noibuHelpCodeTimestamp = new Date();

}



if (window.noibuHelpCode) {

sendHelpCodeToChat(window.noibuHelpCode);

}

}

5. Handle Failures

function failureNoibuCallback(error) {

console.error("Error occurred generating helpcode")

}

6. Send Message into Zendesk Chat

function sendHelpCodeToChat(noibuHelpCode) {

if (noibuHelpCode.length > 0) {

var localHelpCodeString = "Automated helpcode: " + noibuHelpCode;

chatWidgetAPIGlobalFunction('chatWidget', 'chat:send', localHelpCodeString);

}

}

This posts the Help Code directly into the active chat session as a message, allowing your support team to copy and use it immediately.


How This Works in Practice

  1. User opens live chat

  2. Chat session starts

  3. Noibu Help Code is generated automatically

  4. Help Code is injected into chat as a message

  5. Support agent uses Help Code inside Noibu to investigate the session


Best Practices

  • Always implement timeout protection when requesting the Help Code

  • Store the Help Code temporarily in memory (e.g., window.noibuHelpCode)

  • Send the Help Code automatically — avoid relying on users to copy/paste

  • Confirm compatibility with your Zendesk Web Widget version


If you have questions about implementation or would like help validating your integration, please contact your Noibu Solutions Engineer.