# WordPress plugin

Put your SendBeam forms on a WordPress site, add a pop-up, collect opt-ins at registration or checkout, and send the site's own email from your verified domain.

The SendBeam plugin connects one WordPress site to one SendBeam workspace. It puts your forms on the
site, runs pop-ups with their own targeting, collects opt-ins from the things people already do on a
WordPress site, and can carry the site's own email.

## What the plugin does

- **Forms** — a *SendBeam Form* block and the `[sendbeam_form]` and
  `[sendbeam_contact]` shortcodes. Any form, on any number of pages.
- **Pop-ups** — as many as you like, each with its own form, targeting and trigger.
- **Audience** — an opt-in tick box on account registration, comment forms and
  WooCommerce checkout.
- **Site email** — everything WordPress sends with `wp_mail()` goes out through
  your verified sending domain instead of the server's own mailer.

Forms render from their hosted page on sendbeam.io, so a change you make in SendBeam appears on the site
straight away and your theme's CSS never fights the form's. They still take your site's colours — see
[Forms on a page](https://sendbeam.io/docs/wordpress/forms).

## Install it

Install **SendBeam** from Plugins → Add New, or upload the release zip from
[the repository](https://github.com/sendbeam-io/sendbeam-wordpress). It needs
WordPress 6.1 or later and PHP 7.4 or later. Activating it adds **Settings → SendBeam** and
nothing else; no tables are created and no files are written.

## Connect it

1. In SendBeam, go to [Settings → API keys](https://sendbeam.io/settings/api-keys) and make a key for this site.
  Give each site its own key so you can revoke one without disturbing the others.
2. In WordPress, go to **Settings → SendBeam** and paste it into **Connect**.
3. The header shows **Connected** when the key works. If it says the key is rejected, it is
  the wrong key or the wrong workspace; if it says the key cannot read your forms, the key is right and
  is missing a permission — see below.

You can define `SENDBEAM_API_KEY` in `wp-config.php` instead, and the plugin will use
that and never write a key to the database. Useful where the database is shared with staging.

## Which permissions each feature needs

Only what you use. Placing a form or a pop-up needs no key at all.

- **Forms (read)** — lets the settings page and the block list your forms so you pick one by
  name instead of pasting an ID. Without it you can still type IDs by hand.
- **Lists (read)** — the Audience tab and its subscriber counts.
- **Contacts (read and write)** and **Lists (write)** — only for the opt-in box
  on registration, comments or checkout.
- **Send site email** (`transactional:send`) — only for Site email.

## What it sends us

Worth knowing before you switch things on, and the same list is in the plugin's readme.

- **Showing a form** — the visitor's browser loads it from sendbeam.io. The URL carries the
  appearance you chose, which is your settings, not anything about the visitor. Your server makes no
  request.
- **A submission** — what the visitor typed on that form.
- **The settings screens** — while an administrator has them open, your server asks us for
  your forms, lists and counts, using your key. Cached for five minutes. Nothing happens on front-end page
  loads.
- **An opt-in** — only when someone ticks the box: their address, name and which of the
  three places they were in.
- **Site email** — each message your site sends, so we can deliver it.

---
Source: https://sendbeam.io/docs/wordpress
