Custom post survey

This is small example how you can integrate custom post survey into Live Helper Chat.

Extensions

Extension should listen to this event

$dispatcher->listen('widgetrestapi.initchat',array($this, 'initReactChat'));

Function can look like

public function initReactChat($params) {
$params['output']['chat_ui']['survey_id'] = 'any your internal id';
$params['output']['chat_ui']['survey_url'] = 'https://example.com/survey.html';
}

How do I inform Live Helper Chat that survey has been completed?

You should call this javascript function. Once this happens Live Helper Chat will know that survey has been completed and will close widget for the visitor. You can have some kinda of setTimeout before calling this function.

parent.postMessage("lhc_chat_closed_explicit","*"); // I would prefer this one
// OR use the one you like more :) There is no real difference in the core.
parent.postMessage("lhc_survey_completed","*");
Last updated on by Remigijus Kiminas