Generate a HelpCode and pass it into Live Chat

Last updated: September 14, 2026

This guide outlines how to:

  1. Generate a Noibu HelpCode™ using the Noibu SDK

  2. Automatically pass that HelpCode™ 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 HelpCode™

Before sending anything to chat, you must generate a HelpCode™ using the Noibu SDK.

Please review the full HelpCode™ documentation here - HelpCode™ Overview

In short, the HelpCode™ 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 HelpCode™ to Live Chat

Once generated, the HelpCode™ 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 HelpCode™

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

3. Request the HelpCode™ (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 HelpCode™ request does not hang indefinitely

  • Errors and timeouts are handled cleanly

4. Save and Send the HelpCode™ 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 HelpCode™ 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 HelpCode™ is generated automatically

  4. HelpCode™ is injected into chat as a message

  5. Support agent uses HelpCode™ inside Noibu to investigate the session


Best Practices

  • Always implement timeout protection when requesting the HelpCode™

  • Store the HelpCode™ temporarily in memory (e.g., window.noibuHelpCode)

  • Send the HelpCode™ 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.