MxChat 3.2.29 has 10 actions and 102 filters, read directly from its source code on Nov 18, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when MxChat fires an action
add_action( 'mxchat_similarity_results', function( $arg1, $bot_id ) {
// Your code runs here.
}, 10, 2 );
// Change a value MxChat is about to use
add_filter( 'mxchat_embedding_chunk_metadata', function( $chunk_metadata, $chunk_text, $arg3 ) {
// Change $chunk_metadata here.
return $chunk_metadata;
}, 10, 3 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
/** * This filter is documented in includes/class-mxchat-utils.php * (submit_chunked_content). */ apply_filters( 'mxchat_embedding_chunk_metadata', $chunk_metadata, $chunk_text, array( 'bot_id' => $bot_id, 'content_type' => $content_type, 'source_url' => $source_url, 'part_index' => $index, 'part_total' => $total, ) ); -
/** * The transcript rows about to become the model's conversation history (plan * 4a664e). An add-on that writes rows meant for humans — the Forms add-on's * wizard questions and answers, which the model already receives once through * its guidance context — can drop them here so they never reach the model * twice. Entries are the get_session_history() shape (id, role, content, * timestamp, agent_name), c... */ apply_filters( 'mxchat_ai_conversation_history', $history, $session_id ); -
/** * Allow developers to modify post data before processing into the knowledge * base, or to leave the post out by returning false (since 3.2.26). */ apply_filters( 'mxchat_before_process_post', $post, $bot_id ); -
/** * Override the resolved visitor address, e.g. for a host behind a trusted * proxy that is not Cloudflare. Return a valid IP. */ apply_filters( 'mxchat_client_ip', $ip, $remote ); -
/** * Reword or suppress the current date/time line sent with every request. */ apply_filters( 'mxchat_current_datetime_line', $line, $bot_id ); -
/** * plan 705b6c: ask an OpenAI-compatible server for usage on its last stream * chunk. A server that rejects the field fails the stream and the reply falls * back to the non-streaming request, which reads usage from the body. Return * false to leave the field out. */ apply_filters( 'mxchat_custom_stream_include_usage', true, $cfg['base_url'], $cfg['model'] ); -
/** * Filter the longest document, in estimated pages of about 2,500 characters, * that Document Upload and the media-library importer accept. Visitor chat * uploads keep their own setting. */ apply_filters( 'mxchat_document_import_max_pages', self::DOCUMENT_IMPORT_MAX_PAGES ); -
/** * Filter the error message a chat visitor sees. */ apply_filters( 'mxchat_error_response', $message, (string) $code, $context ); -
/** * Filter the roles a logged-in user is rate-limited by (plan eead8c). */ apply_filters( 'mxchat_filter_roles_rate_limit', $user_roles, $user, $bot_id ); -
/** * Filter the assembled final answer text on every response path — * non-streaming, function-calling, and streaming (applied to the full buffer * at completion, never per-chunk). */ apply_filters( 'mxchat_final_response_text', $text, array( 'session_id' => $session_id, 'bot_id' => $bot_id, 'streaming' => (bool) $is_streaming, ) ); -
/** * Filter the tool-budget sentence appended to the system content when tools * are offered. Return '' to send nothing (an owner who writes their own tool * policy). */ apply_filters( 'mxchat_function_calling_budget_notice', $notice, $budget ); -
/** * How many trailing messages a live-agent handoff carries. One filter for all * three destinations; Telegram passes 10 (its payload is chunked), Slack and * the webhook keep the default 5 (plan 1aeee3). */ apply_filters( 'mxchat_handoff_history_count', $count, $session_id ); -
/** * Whether the knowledge base reads this post's published page for its text. */ apply_filters( 'mxchat_index_use_rendered_page', $want, $post_id, $post ); -
/** * Filter the attachment MIME types offered by the WordPress Content importer. */ apply_filters( 'mxchat_kb_attachment_mime_types', array( 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'text/plain', 'text/markdown', ) ); -
/** * Filter how many days a lead (visitor name, email and consent record, with * the lead's conversations) is kept after its last activity. Return 0 to keep * leads forever. */ apply_filters( 'mxchat_lead_retention_days', $days, $setting ); -
/** * Answer a vector query from your own store instead of Pinecone. */ apply_filters( 'mxchat_pre_vector_query', null, $vector, $top_k, $context ); -
/** * Store, list or delete vectors in your own store instead of Pinecone. */ apply_filters( 'mxchat_pre_vector_store', null, $op, $payload, $context ); -
/** * Allow a site to retain a specific conversation (e.g. a legal hold). Default * true = erase. Retained sessions are reported, never silently kept. */ apply_filters( 'mxchat_privacy_erase_session', true, $sid, $email_address ); -
/** * Whether this chat turn must wait for the pre-chat form. Return false to let * a visitor chat without the form on file (a deliberate opt-out). */ apply_filters( 'mxchat_require_lead_before_chat', $required, $bot_id, $session_id ); -
/** * Decide whether a post goes into the knowledge base. Return false to leave it * out. */ apply_filters( 'mxchat_should_index_post', true, $post, (string) $context ); -
/** * Filter a streamed chat request before it is sent. */ apply_filters( 'mxchat_stream_request', array( 'url' => $url, 'headers' => $headers, 'body' => $body_array, ), $provider, $model, $bot_id ); -
/** * Filter the human-readable form of a visitor message before it is stored in * the transcript or relayed to a live agent. */ apply_filters( 'mxchat_transcript_user_message', $message, $session_id, $context ); -
/** * Days before a link-click row's user_ip is anonymized in place * (wp_privacy_anonymize_ip) and its user_agent cleared. 0 or negative disables * anonymization. */ apply_filters( 'mxchat_url_click_anonymize_days', self::CLICK_ANONYMIZE_DAYS ); -
/** * Days a link-click row is kept before deletion. 0 or negative disables the * delete sweep (rows are still anonymized below). */ apply_filters( 'mxchat_url_click_retention_days', self::CLICK_RETENTION_DAYS ); -
apply_filters( 'mxchat_get_bot_pinecone_config', array(), $bot_id ); -
apply_filters( 'mxchat_content_pro_feature', false, 'internal_linking' ); -
apply_filters( 'mxchat_get_bot_options', array(), $bot_id ); -
do_action( 'mxchat_similarity_results', $this->last_similarity_analysis['top_matches'], $bot_id ); -
do_action( 'mxchat_app_handoff_requested', $session_id, 'slack' ); -
do_action( 'mxchat_app_lead_captured', $session_id ); -
do_action( 'mxchat_app_message_saved', $session_id, $role, $message_id ); -
apply_filters( 'mxchat_available_callbacks', array() ); -
apply_filters( 'mxchat_get_bot_vectorstore_config', array( 'use_vectorstore' => (is_array($vectorstore_options) ? ($vectorstore_options['mxchat_use_openai_vectorstore'] ?? '0') : '0') === '1', 'vectorstore_ids' => is_array($vectorstore_options) ? ($vectorstore_options['mxchat_vectorstore_ids'] ?? '') : '', ), $bot_id ); -
apply_filters( 'mxchat_model_supports_tools', true, $model_id ); -
apply_filters( 'mxchat_pinecone_expected_dimension', 0, $selected_model ); -
apply_filters( 'mxchat_pinecone_query_body', $request_body, $bot_id ); -
do_action( 'mxchat_session_ended', $session_id, array('reason' => 'deleted') ); -
apply_filters( 'mxchat_transcript_retention_days', $days ); -
apply_filters( 'https_local_ssl_verify', false ); -
do_action( 'litespeed_purge_all' ); -
apply_filters( 'mxchat_acf_pdf_max_bytes', $default_max_bytes, $attachment_id, $pdf_path ); -
apply_filters( 'mxchat_acf_pdf_text_max_length', 50000 ); -
apply_filters( 'mxchat_app_preview', in_array($option, array('1', 1, true, 'yes', 'on'), true) ); -
apply_filters( 'mxchat_app_push_enabled', true ); -
apply_filters( 'mxchat_app_push_url', self::RELAY_URL ); -
apply_filters( 'mxchat_app_rate_limits', self::RATE_LIMITS ); -
apply_filters( 'mxchat_app_settings_sections', $sections ); -
apply_filters( 'mxchat_autofocus_after_reply', 'auto' ); -
apply_filters( 'mxchat_cache_purge_watched_options', $defaults ); -
apply_filters( 'mxchat_chat_toolbar_items', array(), $bot_id ); -
apply_filters( 'mxchat_chat_toolbar_items_allowed_html', $allowed ); -
apply_filters( 'mxchat_claude_max_tokens', $default, $model ); -
apply_filters( 'mxchat_content_generated_html', $result, $plan, $content_type ); -
apply_filters( 'mxchat_content_system_prompt', $system_prompt, $plan, $content_type, $template_mode ); -
apply_filters( 'mxchat_content_tool_edit', null, $full_content_for_ai, $edit_instruction, $current_title ); -
apply_filters( 'mxchat_content_user_message', $user_message, $plan, $content_type ); -
apply_filters( 'mxchat_default_vision_model', $model, $provider ); -
do_action( 'mxchat_enqueue_testing_tab_assets' ); -
apply_filters( 'mxchat_fc_keep_first_hop_text', true, $model ); -
apply_filters( 'mxchat_filter_message', $message, 'prompt', $session_id ); -
apply_filters( 'mxchat_function_call_max_depth', 5 ); -
apply_filters( 'mxchat_function_call_max_per_turn', 8 ); -
apply_filters( 'mxchat_function_calling_cautious_callbacks', array( 'mxchat_handle_add_to_cart_intent', 'mxchat_add_to_cart', 'mxchat_handle_checkout_intent', 'mxchat_checkout_redirect', 'mxchat_handle_order_history', 'mxchat_live_agent_handover', 'mxchat_telegram_live_agent_handover', 'mxchat_webhook_live_agent_handover', 'mxchat_handle_email_capture', 'mxchat_handle_form_collection', ) ); -
apply_filters( 'mxchat_function_calling_core_tools', array( 'mxchat_handle_search_request' => array( 'label' => __('Web Search', 'mxchat'), 'description' => __('Search the public web (via Brave Search) for current, real-time information to answer the user. Use when the answer may be recent or is not in the site content.', 'mxchat'), 'requires_key' => 'brave_api_key', 'setup_note' => __('Powered by Brave Search — requires a Brave Search API key.... ); -
apply_filters( 'mxchat_function_calling_excluded_callbacks', array( 'mxchat_handle_switch_to_chatbot_intent', ) ); -
apply_filters( 'mxchat_function_calling_extra_tools', array() ); -
apply_filters( 'mxchat_gemini_image_model', method_exists('MxChat_Model_Catalog', 'image_default_model') ? MxChat_Model_Catalog::image_default_model('gemini') : 'gemini-nano-banana-2.1' ); -
apply_filters( 'mxchat_gemini_safety_settings', $settings, $model ); -
apply_filters( 'mxchat_gemini_thinking_level', $level, $model ); -
apply_filters( 'mxchat_get_bot_vectorstore_sync_config', array(), $bot_id ); -
apply_filters( 'mxchat_handoff_card_sections', array(), $session_id, $destination ); -
apply_filters( 'mxchat_ingest_user_agent', $ua ); -
do_action( 'mxchat_migrate_saved_models', $map, $img ); -
apply_filters( 'mxchat_model_catalog_now', time() ); -
apply_filters( 'mxchat_models_in_use', $models ); -
apply_filters( 'mxchat_openai_image_model', $model ); -
apply_filters( 'mxchat_openai_prompt_cache_key', $key, (string) $bot_id, (string) $model ); -
apply_filters( 'mxchat_page_context_content', $page_context['content'], $page_context['url'], $page_context['title'] ); -
apply_filters( 'mxchat_page_context_max_chars', 8000 ); -
apply_filters( 'mxchat_pattern_resync_batch', 10, $pattern_id ); -
apply_filters( 'mxchat_pattern_resync_cap', 50, $pattern_id ); -
apply_filters( 'mxchat_pattern_resync_inline_max', 5, $pattern_id ); -
apply_filters( 'mxchat_pdf_max_download_bytes', 20 * MB_IN_BYTES ); -
apply_filters( 'mxchat_pdf_rtl_normalize', true, $text ); -
apply_filters( 'mxchat_perplexity_should_show_logo', true ); -
apply_filters( 'mxchat_pinecone_bots_on_host', array(), $host ); -
apply_filters( 'mxchat_pinecone_is_document_host', $is, $host ); -
apply_filters( 'mxchat_pinecone_migrate_step_seconds', self::MIGRATE_STEP_SECONDS ); -
apply_filters( 'mxchat_pre_process_message', $message, $user_id, $session_id ); -
apply_filters( 'mxchat_prepare_context', $context_content, $session_id ); -
apply_filters( 'mxchat_process_pdf_advanced', false, $pdf_source, $max_pages, $this->session_id ); -
apply_filters( 'mxchat_product_index_prices', $prices, $product ); -
apply_filters( 'mxchat_product_price_lines', $lines, $product, $prices ); -
do_action( 'mxchat_purge_page_caches' ); -
apply_filters( 'mxchat_rate_limit_max_visitor_counters', 5000, $safe_bot_id ); -
apply_filters( 'mxchat_rating_rate_limit', 30 ); -
apply_filters( 'mxchat_reference_inline_cap', 200000 ); -
apply_filters( 'mxchat_reference_shortcodes', array('html_block' => 'id') ); -
apply_filters( 'mxchat_retrieval_query', $message, $session_id, $bot_id ); -
apply_filters( 'mxchat_satisfaction_rating_enabled', ($options['satisfaction_rating_enabled'] ?? 'off') === 'on' ); -
do_action( "mxchat_seo_optimize_{$field}", $post_id, $post, $focus_kw ); -
apply_filters( 'mxchat_session_retention_days', self::DEFAULT_RETENTION_DAYS ); -
apply_filters( 'mxchat_should_load_assets', $should, array( 'display_bot' => $display_bot, 'has_shortcode' => $has_shortcode, 'post_id' => get_the_ID(), ) ); -
apply_filters( 'mxchat_system_instructions', $instructions, $bot_id, $session_id ); -
apply_filters( 'mxchat_transcript_retention_batch_cap', 5000 ); -
apply_filters( 'mxchat_transcripts_capability', 'mxchat_view_transcripts' ); -
apply_filters( 'mxchat_valid_urls', $valid_urls, $session_id, $bot_id ); -
apply_filters( 'mxchat_webhook_handoff_allow_private_hosts', false ); -
apply_filters( 'mxchat_webhook_handoff_payload', $payload, $session_id, $user_id ); -
apply_filters( 'mxchat_xai_image_model', $default ); -
apply_filters( 'mxchat_xai_query_model', 'grok-4.20-0309-non-reasoning', $site_model ); -
apply_filters( 'the_content', $content );
Generated from MxChat's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Done for you
Rather have it built for you?
Tell us what should change and we’ll write and test the code using these hooks.
Custom hook snippet
from $49
A small, update-safe change built on the plugin’s own hooks.
- Code written against the plugin’s actions and filters
- Tested on a staging copy of your site
- Install instructions included
Typical turnaround: 2–3 business days
Choose thisPlugin customisation
from $149
New features or changed behaviour, without editing the plugin’s files.
- Built as a companion plugin, so updates never wipe it
- Exact quote before we start
- Tested on staging, then deployed
Typical turnaround: 3–7 business days
Choose thisNot sure which fits? Describe what you need and we’ll suggest the simplest option.
Can't find the right hook?
We can build the customisation for you. Describe what you need: