Install guides · WordPress

WordPress chatbot

Add a chatbot to your WordPress site

There is no Alma plugin for WordPress, and you do not need one. You add Alma with its embed code, a short script from your Alma dashboard, placed by a header and footer plugin, your theme, or a Custom HTML block. This guide covers WordPress.com and self-hosted WordPress (the free software from WordPress.org, on your own hosting).

Where the code goes
The Footer box of a header and footer plugin, or your theme
Plan needed
WordPress.com: Personal or higher. Self-hosted: none
Only some pages
A Custom HTML block on each page

First, which WordPress do you have?

On WordPress.com, it depends on your plan. WordPress.com's guide to adding code to headers lists the Personal, Premium, Business and Commerce plans, and its Custom HTML guide says script tags need a paid plan with hosting features activated, which installing one plugin does.

On self-hosted WordPress, it depends on your role. WordPress keeps JavaScript in pages only for users with the unfiltered_html capability: on a single site, administrators and editors, and on a multisite network, only super admins.

Add Alma to every page with a header and footer plugin

WordPress.com documents this route for site-wide scripts, using the free Insert Headers and Footers plugin by WPCode, which is also in the WordPress.org plugin directory for self-hosted sites.

  1. In Alma, open your bot's Settings page, find the Embed Code section and click Copy Code.
  2. In WordPress, install and activate Insert Headers and Footers by WPCode. On a self-hosted site, go to Plugins > Add New, search for it, click Install Now and then Activate. On WordPress.com, use the Plugins page in your site's dashboard.
  3. Go to Code Snippets > Header & Footer.
  4. Paste the embed code into the Footer box rather than the Header box, since Alma's code belongs at the end of the page, just before the closing </body> tag.
  5. Click Save Changes.
The embed code as your bot's Settings page shows it. Your copy has your bot's ID where this one says YOUR-BOT-ID.
<script>
  (function(w,d,s,o,f,js,fjs){
    w['AlmaChat']=o;w[o]=w[o]||function(){(w[o].q=w[o].q||[]).push(arguments)};
    js=d.createElement(s),fjs=d.getElementsByTagName(s)[0];
    js.id=o;js.src=f;js.async=1;fjs.parentNode.insertBefore(js,fjs);
  }(window,document,'script','alma','https://www.helloalma.chat/widget/widget.js'));
  alma('init', 'YOUR-BOT-ID');
</script>

Build the chatbot first, then paste it in.

Start the 14-day trial, choose one of the templates, write your welcome message, and copy your embed code into WordPress with the steps above.

Or paste it into your theme

In a classic theme (one built from PHP template files), the footer.php template generates the end of every page, and the closing </body> tag is usually there, just after wp_footer(). Paste the embed code on the line above </body>, in a child theme so the parent theme can update without losing your change. If you are not sure what kind of theme you have, use the plugin.

Show the chat on only some pages

Alma has no setting that limits the chat to certain pages; it appears wherever the embed code is. To show it on a few pages, leave the plugin's Footer box empty and add the code to each of those pages with a Custom HTML block:

  1. Open the page in the block editor.
  2. Click the block inserter (the + button) and choose Custom HTML. Typing /html in a new paragraph does the same.
  3. Click Edit HTML, paste the embed code, and click Update.
  4. Update or publish the page.

Use one route or the other, not both. A page that contains the code twice loads the chat twice.

Check that it is working

Open your site in a private or incognito window, as a visitor would. A round chat button should sit in the bottom right corner, or bottom left if you chose that under Widget Position in Alma. Click it, and the chat opens with your welcome message.

If nothing appears, check that the whole embed code is there, from <script> to </script>; that your Alma trial or plan is active, since the chat stops appearing when a trial ends without one; and, if you use a caching plugin, that you cleared its cache. In your browser's developer tools, the Console tab shows "Alma Chat initialized" when the chat loads, or "Failed to initialize Alma Chat" when it cannot.

What Alma does on a WordPress site

Alma runs alongside WordPress, not inside it: it does not read your posts, create WordPress users, or touch WooCommerce. It asks visitors the questions you build into it and emails each new lead to the address you set for lead alerts, so an inquiry that arrives at night is waiting in your inbox with the details collected. On the Growth plan ($79 a month) and up, Zapier can pass leads to other apps, and the Agency plan ($199 a month) adds webhooks (automatic messages from one app to another).

WordPress's own documentation

If a step above no longer matches what you see, WordPress's own pages have the current version:

WordPress questions

WordPress chatbot FAQ

Is there an Alma WordPress plugin?

No. You add Alma with the embed code from your bot's Settings page, using a general plugin such as Insert Headers and Footers by WPCode, your theme, or a Custom HTML block.

Can I add Alma on the free WordPress.com plan?

No. WordPress.com's documentation says adding code to your site's header or footer needs the Personal, Premium, Business or Commerce plan, and that script tags in a Custom HTML block need a paid plan with hosting features activated.

Why did the code disappear when I saved the page?

WordPress removes script tags saved by users without the unfiltered_html capability, which on a self-hosted site means anyone but an administrator or editor (only super admins on multisite). On WordPress.com, it happens on the free plan or before hosting features are active.

Does Alma work with WooCommerce?

It appears on WooCommerce store pages like any other page, as a chat window. Alma has no WooCommerce integration, so it cannot see carts, orders or stock levels.

Other platforms

Start the trial

Put Alma on your WordPress site.

The trial lasts 14 days with the Starter plan's limits: 1 chatbot and up to 1,000 subscribers. Build your chatbot, paste the embed code where this guide shows, and the next visitor with a question can get an answer while you are busy with something else.

Trial
14 days
Plans
From $29 a month
Install
One embed code