Hazelchat
Start free

Add an AI chat agent to your Statamic site

Hazelchat answers your visitors from the pages and documents you approved, shows the sources under every answer and passes enquiries on to you. A free addon adds it to every page of your Statamic site: no template editing.

Version 1.0.0 for Statamic 5 and 6. The Free plan includes 50 answers a month on one website, with no card, and stays free.

How the Hazelchat addon works on Statamic Your content, answers, enquiries and billing stay in Hazelchat. You paste your installation code into the addon settings or your .env file. The addon reads only that code and one consent setting, sends nothing from Statamic to Hazelchat, and adds one script to the pages of your site, where visitors get answers with their sources. Hazelchat Content, answers, enquiries and billing Your installation code You paste it into the addon settings The Statamic addon The key One consent switch Reads no pages, users or forms. Sends nothing. Adds one script to every page of your site Your public pages A visitor's question Answer from your pages Sources (1)

Works with Statamic 5 and 6, including static caching and multi-site.

What you need

  • Statamic 5 (PHP 8.2 or later) or Statamic 6 (PHP 8.3 or later), installed with Composer.
  • Someone who can run Composer for the site. If your agency looks after it, send them the steps.
  • A Hazelchat account. The addon needs the hosted Hazelchat service; the Free plan includes 50 answers a month on one website, with no card.

Add Hazelchat to Statamic in five steps

  1. In Hazelchat

    Prepare your agent

    Add your content, check the details and try your agent. Under Website → Install on your website, add your website's domain.

  2. In Hazelchat

    Copy the installation code

    Copy the installation code. It holds your public widget key, which is not a password.

  3. In Statamic

    Install the addon

    Run composer require hazelchat/statamic-hazelchat. The addon is free and listed on the Statamic Marketplace. Installing it alone loads nothing on your site.

  4. In Statamic

    Paste the code

    Statamic 6: in the Control Panel open Tools → Addons → Hazelchat, paste the code into Installation code and save. Statamic 5: add HAZELCHAT_INSTALLATION_CODE= with your 64-character key to the site's .env file. If you use static caching, clear it (php please static:clear). If you pasted a Hazelchat script into a template before, remove it so the chat loads once.

  5. On your site

    Switch it on and test it

    Back in Hazelchat, click Publish and switch on (or Switch on if your published agent is unchanged). Hazelchat checks that the script is on your website before the agent goes live. Then open your website, ask a question in the chat, return to Hazelchat and click Yes, I saw this answer.

Send this to your agency

Copy this message, put your installation code where it says so, and send it to whoever looks after your site.

Please add the Hazelchat chat to our Statamic site:

1. composer require hazelchat/statamic-hazelchat
2. Statamic 6: Control Panel → Tools → Addons → Hazelchat, paste this
   into "Installation code" and save. Statamic 5: put its 64-character key
   in .env as HAZELCHAT_INSTALLATION_CODE.
   [our installation code from Hazelchat]
3. Clear the static cache if the site uses one.

Guide: https://hazelchat.co/integrations/statamic/

What the addon does

It adds one script to the pages of your site and nothing else. Your content, answers, enquiries and billing all stay in your Hazelchat workspace.

The addon adds https://app.hazelchat.co/widget.js, with your public key, just before </body> on the HTML pages of your site, including pages served from Statamic's static cache. It keeps only the key, never the pasted script. It has no database tables, adds no scheduled tasks and sends nothing from Statamic to Hazelchat. The Control Panel, live preview, redirects, JSON and other non-HTML responses never load the chat. If your site sets a CSP nonce through Laravel, the script carries it. Its settings are in English and German, and it is free software under the MIT licence.

Templates, .env and more sites

  • Only on some pages: set HAZELCHAT_AUTO_INJECT=false and put {{ hazelchat }} (Antlers) or <s:hazelchat /> (Blade) where the chat should load. A page with the tag is never given a second one.
  • Settings in .env: HAZELCHAT_INSTALLATION_CODE and HAZELCHAT_WAIT_FOR_CONSENT=true work on Statamic 5 and 6. On Statamic 6 a code saved in the Control Panel wins.
  • More sites: every site uses the same code by default. To give one site its own code, or none, add the attribute hazelchat to that site under Configure → Sites (or in resources/sites.yaml); an empty value turns the chat off there.

If the chat does not appear

  • Clear the static cache

    After you install, change the code or remove the addon, run php please static:clear.

  • Check the code

    Paste the whole installation code, or only its 64-character key. Anything else, such as an API key, shows nothing; the settings page says so.

  • Check the layout

    The chat goes before </body>. A layout without that tag gets nothing; use {{ hazelchat }} there.

  • Leave the script alone

    Exclude https://app.hazelchat.co/widget.js from script combining, rewriting or delayed loading. The script must keep its own address and key.

  • Content-Security-Policy

    If your site sends a policy, allow https://app.hazelchat.co in script-src, connect-src and frame-src.

  • A second domain

    The Free plan serves one website. A second site on another domain needs a plan with more websites.

Change or remove

New widget key

If you rotate the key in Hazelchat, paste the new code into the addon settings (or .env) and clear the static cache.

Pause the chat

Switch Hazelchat off in your workspace. It stops answering straight away, even on cached pages.

Remove it from the site

Run composer remove hazelchat/statamic-hazelchat and clear the static cache. Your Hazelchat account and plan are not affected.

Updates and changes

Update with composer update hazelchat/statamic-hazelchat; the Control Panel shows new versions under Tools → Updates.

1.0.0: adds the Hazelchat chat to the pages of your site from one installation code; the {{ hazelchat }} tag; a code per site; optional wait for your consent manager; English and German settings.

Hazelchat is an independent addon and is not affiliated with or endorsed by Statamic; the name is used here only to say which software the addon works with.

Let your Statamic site answer from its own pages.

Questions? Email hello@hazelchat.co. We answer within one business day. Not on Statamic? See all the ways to install Hazelchat.