Skip to main content

Provide Search Data

Want to make it easier for agents to add products to a call? Read on.

To simplify the process of adding products for the agents, integration can be extended with the option to provide search data. Agents will be able to search for products in a flexible way with better support to find the best fit product.

When an agent types in a search term, the embed instance (BambuserOneToOneEmbed) will emit a provide-search-data event. By adding a listener for this event you can provide all necessary search details for the matching products to the search term the agent entered.


trigger of provide-search-data event

• When an agent types in a search term


When agent clicks on a product, provide-product-data event will get triggered.


// Inside onBambuserOneToOneReady method!
oneToOneEmbed.on('provide-search-data', (searchRequest, searchResponse) => {

// searchRequest.term contains the text that agent is searching for.
// is the current page of results to be return if using
// pagination (see below).
// searchResponse() tells the player the search result

const { term, page } = searchRequest;

.then(res => res.json())
.then(yourSearchResponse => {
searchResponse(response => {

// If something is wrong with the search request,
// send a message to the sales-rep by throwing an error
if (!validSearch(yourSearchResponse)) throw new Error("Your error here");

return response.products(p => {
const results = => {
return p()
.name('White T-Shirt')
.sku('TSHIRT') // Can be string or number
.price(price => price
return p()
.price(price => price
.original(prod.price.original || null)
return results;

// Set the currency used here using the standard ISO 4217
// three letter code.

// If you would like to paginate search results also provide
// total number of pages, total number of matches and
// the current page.
.pagination(p => p