Hooks

Hooks: Hosted Notifal AI

4 min read

These hooks cover the Notifal AI client module (app/Modules/Ai/) added in Notifal 3.0.0. They apply to hosted generation from Noti chat in the HTML Builder and the OnPage notification wizard.

Hosted AI credentials stay on the WordPress server. Browser scripts never receive gateway credentials. Prefer WordPress filters and actions over replacing core controllers.

Index: Hook Reference Hub.

User-facing connection steps: Connecting Your Notifal AI Account.

Account lifecycle (actions)

HookParametersDescription
notifal/ai/account_connectedarray $publicInstallationFired after this site successfully connects to Notifal AI
notifal/ai/account_disconnectednoneFired after the local AI connection is cleared
notifal/ai/site_profile_savedarray $profileFired after the site industry / business profile is saved

Public config and gateway (filters)

HookParametersDescription
notifal/ai/gateway_base_urlstring $urlHosted AI service base URL (advanced environments only)
notifal/ai/disclosure_versionstring $versionDisclosure text version shown during account connection
notifal/ai/public_configarray $configSafe admin JavaScript config (window.NotifalAi) for connection UI state
notifal/ai/readiness_cache_ttlint $ttlCache lifetime in seconds for hosted generation readiness
notifal/ai/industry_optionsarray $optionsSelectable industry cards for hosted wizards (slug, label, icon)
notifal/ai/gateway_request_argsarray $args, string $url, string $routeOutbound HTTP args for hosted AI requests
notifal/ai/servicesarray $servicesDI container service map for the AI module (ServiceProvider)

Safe public config keys (3.0.0+)

KeyDescription
connection.connectedWhether this site is linked to Notifal AI
skip_connect_stepWhen true, hosted UI omits the Connect step
license.activeWhether Notifal Pro is active on this site
license.auto_connectWhen true, Pro may link the site automatically from the active license

Do not put secrets, tokens, or private option names into notifal/ai/public_config.

Generation pipeline (filters)

HookParametersDescription
notifal/ai/generation_request_bodyarray $body, string $feature, array $intentAdjust the outbound generation request before it is sent
notifal/ai/generation_capabilitiesarray $capabilitiesFeature flags and limits returned to admin UI
notifal/ai/generation_active_pluginsstring[] $active_pluginsActive plugin display names included for shortcode guidance
notifal/ai/generated_html_sanitizedstring $content, array $warningsFinal HTML after server-side sanitization
notifal/ai/feedback_categoriesstring[] $categoriesAllowlisted feedback category slugs for needs-improvement details

Supported $feature values (3.0.0)

FeatureUsed by
html_templateHTML Builder Noti chat (create or edit the current canvas)
onpage_notificationOnPage list wizard (disabled draft import)
formStandalone Form CPT create/edit

Legacy html_template_edit maps to html_template and should not be used in new code.

OnPage prompt config (filters)

These filters shape layout, use case, and example data for the OnPage Generate with AI wizard:

HookParametersDescription
notifal/onpage/ai_prompt/configarray $configLayout, use case, and example data for the OnPage AI wizard JavaScript
notifal/onpage/ai_prompt/export_samplearray $sampleSample export shape used by generation and import validation

See also Hooks: Notifications and Eligibility.

HTML Builder prompt (filters)

HookParametersDescription
notifal/template/html_builder/ai_prompt_examplesarray $examplesCurated example patterns for Noti and OnPage briefs
notifal/template/html_builder/widgetsarray $widgetsWidget palette and AI snippet structures (see cookbook)
notifal/template/html_builder/runtime_configarray $configExtra runtime config merged into the HTML Builder admin boot payload

See Hooks: Templates and Rendering and Cookbook: Register a Custom HTML Builder Widget.

Conventions

TopicDetail
Boot timingAI services register through the Ai module ServiceProvider during normal Notifal boot
Extending generationPrefer notifal/ai/generation_request_body over replacing core controllers
SanitizationAlways run custom HTML through existing sanitizers; use notifal/ai/generated_html_sanitized for post-processing only
SecurityKeep hosted AI credentials on the server. Never expose them to browser scripts

Hooks series

  1. Hook Reference Hub
  2. Hooks: Lifecycle and Bootstrap
  3. Hooks: Notifications and Eligibility
  4. Hooks: Templates and Rendering
  5. Hooks: Tags and Dynamic Data
  6. Hooks: Display Rules and Content Source
  7. Hooks: Analytics and Tracking
  8. Hooks: Admin UI Extension
  9. Hooks: Pro Integration Bridge
  10. Hooks: Hosted Notifal AI (you are here)
  11. Hooks: Forms