New — Sohay now answers WooCommerce product, policy & cart questions. See how →

Hooks and filters — where to start

57 filters and 15 actions, grouped by what they change, with the handful most sites actually use.

Sohay publishes 57 filters and 15 actions. This is the map; the individual articles cover the ones worth knowing in detail.

Two forms, both supported

Every hook name is available as a constant on the Sohaychat_Hooks class as well as a string literal:

use Bengal_StudioSohaychatSohaychat_Hooks;

add_filter( Sohaychat_Hooks::FILTER_SHOULD_RENDER_WIDGET, function ( bool $enabled ): bool {
    return $enabled && is_singular( 'product' );
} );

The constant is recommended for new code — a future rename surfaces as a static-analysis error rather than a silently dead filter. The literal form is fully supported and will not break; the string values are public API and do not change between releases.

What the groups cover

Group What it changes
Widget rendering Whether and where the launcher appears
Providers Which provider answers, and how it is called
Models & spend Allowed models, daily token ceilings
Branding / UI Admin links, widget presentation
Rate limits Per-visitor request limits, proxy awareness
Knowledge base URL bases, article length, search caching
Streaming The SSE response
REST payload caps Request and response size limits
Retention How long deleted data survives
Capabilities Who can reach what
Diagnostics & cron Logging and scheduled work
Human handoff Polling cadence, availability
Tools registry Registering and intercepting tools

The ones most sites use

Six cover the overwhelming majority of real customisations:

  • sohaychat_should_render_widget — per-request gate on the widget. See Hiding the widget on specific pages.
  • sohaychat_tools — the tool list for the request. Remove an entry and the chatbot is never told it exists. See Turning individual shopping tools off.
  • sohaychat_allowed_openai_models / sohaychat_allowed_google_models — a hard ceiling on which models can be called, which no admin-screen mistake can undo.
  • sohaychat_usage_tracker_options — daily token caps in code rather than in the admin.
  • sohaychat_rate_limit_options — per-visitor limits, including the proxy-awareness setting.
  • sohaychat_default_ai_provider — which provider answers when nothing is saved.

One that does nothing

sohaychat_integrations is reserved and never fires. Subscribing to it has no effect.

It was declared for a concept that never materialised — integrations turned out to be ordinary entries in the service list, which sohaychat_services already covers. The constant is kept because removing public API would fatal any code referencing it. To disable the WooCommerce integration entirely, remove its bootstrap from sohaychat_services.

Where to go next

Customising Sohay with code for worked examples, and The tools registry for the extension surface with the most in it.

Mithun B.
Mithun B.

More articles by Mithun B..

View all posts

Give your website an assistant that answers from your content

Grounded answers, a team inbox, and store-aware tools — free on WordPress.org.

Add Sohay — Free

Free plugin · You bring your OpenAI key · Works with any theme