ChatBot hooks

On this page

The ChatBot module's hooks start with qcld_wpbot_chat/. The function qcld_wpbot_chat() returns the running module. Every conversation, from the chat window and from other channels, goes through the same engine, so these hooks see all of them.

Conversations

HookTypeParametersWhat it is for
qcld_wpbot_chat/message_receivedactionMessage $messageA visitor message arrived
qcld_wpbot_chat/message_sentactionReply $reply, Message $messageThe bot answered
qcld_wpbot_chat/ai_failedactionReply $reply, Message $messageThe AI provider failed; visitors got the friendly message
qcld_wpbot_chat/session_savedaction$session_id, $wpbot_user_id, bool $is_newA chat session was saved
qcld_wpbot_chat/pipeline_stepsfilterStep[] $stepsThe answer steps in order: Simple Text Responses, Dialogflow, site search, knowledge base, AI, fallback. Add your own step object with id(), enabled() and handle( Message, Context ) returning a Reply or null

Message has text, session_id, name, language, channel (web, messenger, whatsapp, telegram …), history, page_url, page_title and extra. Reply has source (which step answered: str, search, ai, dialogflow, fallback or an extension's id), text, html, data and meta (provider, model, tokens).

Leads and forms

HookTypeParametersWhat it is for
qcld_wpbot_chat/lead_capturedactionarray $lead: name, email, phone, url (some sources add channel, consent)A lead was saved in the chat. AI Marketing listens to it too
qcld_mailing_list_subscription_successaction$name, $emailOlder hook for the same event, still fired
qcld_wpbot_chat/ai_form_savedaction$post_id, $title, array $fieldsAn AI Actions form entry was saved
qcld_wpbot_chat/action_ranaction$outcome, array $data, Message $messageAn AI Action ran
qcld_wpbot_chat/actionsfilterarray $actionsThe Actions the AI may run (id => { name, description, fields, steps, reply, … })

Example: send every lead to your CRM

add_action( 'qcld_wpbot_chat/lead_captured', function ( array $lead ) {
	if ( empty( $lead['email'] ) ) {
		return;
	}
	wp_remote_post( 'https://crm.example.com/api/leads', array(
		'timeout' => 10,
		'body'    => array(
			'email' => $lead['email'],
			'name'  => isset( $lead['name'] ) ? $lead['name'] : '',
			'page'  => isset( $lead['url'] ) ? $lead['url'] : '',
		),
	) );
} );

Knowledge gaps and Train

HookTypeParametersWhat it is for
qcld_wpbot_chat/knowledge_gapactionstring $question, string $reason, `Message\null $message`A question nobody answered. $reason: no_answer, not_sure, thumbs_down, handoff; the Help Center adds docs_search, not_helpful and ai_search. Fire it yourself to add a question to ChatBot → Train
qcld_wpbot_chat/gap_answeredaction$gap, string $answerThe owner answered a gap in Train
qcld_wpbot_chat/gap_write_articlefilterstring $url, $gapThe address that "Write article" opens for a gap
qcld_wpbot_chat/person_request_patternfilterstring $regexHow WPBot recognises a visitor asking for a person
qcld_wpbot_chat/not_sure_phrasesfilterstring[] $regexesPhrases that mark an AI answer as "not sure"

Answers and AI

HookTypeParametersWhat it is for
qcld_wpbot_chat/ai_contextfilterstring[] $parts, Message $messageExtra system text sent to the AI with a question, for example today's opening hours from your booking plugin
qcld_wpbot_chat/answer_scopefilterstring $scopebusiness_only, business_first or anything for one reply
qcld_wpbot_chat/answer_cachefilterbool $use, string $question, array $argsWhether an answer may come from or go into the answer cache. Never return true for answers that used personal data
qcld_wpbot_chat/citations_enabledfilterbool $onWhether knowledge-based replies list their sources
qcld_wpbot_chat/page_context_allowedfilterbool $ok, WP_Post $post, string[] $labelsWhether the AI may read the page the visitor is on (membership plugins can say no)
qcld_wpbot_chat/page_context_maxfilterint $chars, WP_Post $postHow much of the page text is sent
qcld_wpbot_chat/handoff_buttonsfilterarray $buttonsButtons offered when the bot is not sure
qcld_wpbot_chat/debug_allowedfilterbool $allowedWhether replies carry the admin debug details (default: administrators)

Example: add live facts to every AI question

add_filter( 'qcld_wpbot_chat/ai_context', function ( array $parts, $message ) {
	$parts[] = 'Today the shop is open from 9:00 to 17:00.';
	return $parts;
}, 10, 2 );

Access labels

qcld_wpbot_chat/visitor_labels (filter: string[] $labels, Message $message, WP_User|null $user) lists what the visitor may see in the knowledge base. Everyone has public; logged-in visitors also have logged_in and role:<role>. Add labels such as membership:gold or course:42 from your membership or LMS plugin; knowledge items with labels the visitor lacks are left out before the search. Messages from Messenger, WhatsApp or Telegram have no WordPress user and see public knowledge only. See Feed your own data to the chatbot's knowledge base.

Limits and security

HookTypeParametersWhat it is for
qcld_wpbot_chat/rate_limitfilter[ requests, seconds ], string $bucketLimits per bucket: ai (default 60 a day for guests), message, session, lead, feedback, report, token
qcld_wpbot_chat/rate_limit_textfilterstring $textText shown when the AI limit is reached
qcld_wpbot_chat/visitor_ipfilterstring $ipThe visitor IP used for limits; set it from a trusted proxy header if your site is behind one
qcld_wpbot_chat/allowed_hostsfilterstring[] $hostsDomains the chat's requests may come from. Add your other domains when one site answers on several (for example one domain per language)
HookTypeParametersWhat it is for
qcld_wpbot_chat/search_post_typesfilterstring[] $typesPost types the chatbot's site search covers
qcld_wpbot_chat/search_limitfilterint $limitResults per page
qcld_wpbot_chat/search_termsfilterstring[] $terms, string $keywordWords searched for (synonyms are added here)
qcld_wpbot_chat/faq_matchfilter`array\null $best, string $text, string $language`The FAQ entry that answers a question

Loading and caching

HookTypeParametersWhat it is for
qcld_wpbot_chat/lazy_widgetfilterbool $onReturn false to load the full chat with the page instead of on the first interaction
qcld_wpbot_chat/launcher_configfilterarray $configThe launcher's mode (interaction, idle, now), selectors and files
qcld_wpbot_chat/icon_delayfilterint $msDelay before the chat icon shows
qcld_wpbot_chat/prefetch_delayfilterint $msFetch the chat's files in the background after this delay (0 = off, the default)
qcld_wpbot_chat/purge_cache_on_savefilterbool $onReturn false to stop WPBot clearing your page and object caches after its settings are saved
qcld_wpbot_chat/cache_purgedactionstring[] $clearedCaches WPBot cleared after a save

The constant WPBOT_LAZY_WIDGET_DISABLE (set to true in wp-config.php) also turns the on-demand loading off.

Module Manager and Abilities

Availability

In every edition, including WPBot Free. WPBot Pro adds channels (Messenger, Instagram, WhatsApp, Telegram; Master), whose messages pass through the same hooks with their own channel value, and Pro Actions (store, REST and WordPress function steps; Professional and Master).

Got more questions?

Contact our ChatBot Support Heroes. They’ll provide you with all the information you need.

Contact us

Customer support is very responsive and professional. The script is awesome and with many features, including A.I. from Dialogflow. High quality.

Newpolaris

If have a 7 Stars won’t hesitate to rate that chatbot as a 7stars+++ Very helpful prompt team support Cannot find enough words express my happiness for purchasing that CHATBot Good Luck for you and your items

Ahsmartsolutions

© 2002- 2026 QuantumCloud

Black Friday! Use coupon code monster for a discount during checkout!

DISCOUNT!

X
Let's chat if you need any help finding the right product or need support.
FAQSend Us Email