Skip to main content

Contact Form 7

Contact Form 7 is a forms plugin for WordPress. It does not send webhooks by itself, but the free plugin CF7 to Webhook sends every entry of a form to an address. Pointed at the Flows address, it starts your flows: a request from the site gets an answer in Viber or SMS within seconds.

Written from CF7 to Webhook documentation

This page is written from the public documentation and the code of CF7 to Webhook and has not been checked on a live account yet.

What you need​

  • Contact Form 7 and the plugin CF7 to Webhook, both free. CF7 to Webhook is a third-party plugin, not by the author of Contact Form 7; it has more than 30,000 installations.
  • One address per form. A form can send to several addresses, one per line.

Step 1. Create a connection​

  1. Open Flows → Connections, press Connect a system and choose Contact Form 7.
  2. Press Copy address. It looks like https://events.alphasms.net/hooks/<TOKEN> — keep it secret.

Step 2. Set up the form​

  1. In WordPress open Plugins → Add Plugin, find "CF7 to Webhook", press Install Now and then Activate.
  2. Open Contact → Contact Forms and the form. In a WordPress admin in Ukrainian or Russian this menu is called Contact Form 7.
  3. Add a phone field to the template of the form: [tel* your-phone]. The standard form of Contact Form 7 has no phone; name the field your-phone.
  4. On the Webhook tab tick Send to Webhook and paste the address from the cabinet into Webhook URL.
  5. Special Mail Tags — optionally [_post_title] and [_url]: the page the form was sent from.
  6. In Advanced settings set Method to POST and leave Headers and Body as they are: by default the body is the fields of the form in JSON.
  7. Save the form.
  • A phone field with the name the tag generator gives, such as tel-123, or with phone in its name is found too. For any other name, rename the field to your-phone or add the option webhook:your-phone to its tag.
  • AlphaFlow recognises the request by the fields your-name and your-email of the standard form: keep their names.

A body of your own​

Instead of the default body you can write the event in the AlphaFlow format into Body. AlphaFlow then takes it as it is, and nothing has to be recognised. [your-phone] and the other tags are replaced with the values of the fields; the quotes are yours to put:

{
"event": "form_submitted",
"contact": { "phone": "[your-phone]", "email": "[your-email]" },
"traits": { "first_name": "[your-name]" },
"properties": { "form": "Contacts", "subject": "[your-subject]" },
"context": { "source": "contact_form_7" }
}

Change Contacts to the name of your form. If Body is not valid JSON, the plugin sends it as plain text.

Step 3. Send a test​

Send the form on the site with your own phone number. The event appears in Flows → Connections → Event journal within seconds, and the connection shows Recognised: Contact Form 7. The plugin can also send its errors by email.

Events​

Contact Form 7AlphaFlow eventProperties
A form entryform_submittedsubject, page, page_url
  • subject is the field your-subject. page and page_url — the title and the address of the page — come only if you added [_post_title] and [_url] in Special Mail Tags.
  • For a "leave a request" form the event can be switched to lead_submitted in the connection.

The contact is found by the phone field (your-phone, tel-… or a name with phone) and by your-email; the name comes from your-name. Without a phone field the event reaches the contact by the email only. The time of the event is the time it was received. The names of the events are the ones the ready-made templates expect — see Recommended events.

Good to know​

  • The plugin sends one request when the form is sent, waits up to 30 seconds and does not repeat it.
  • The default body has no id of the entry: identical entries within 10 minutes become one event, a later one is recorded again.
  • The request is not signed. You can add a header of your own in Headers, but the secret in the address is enough.
  • The address always answers 200. Above the daily event limit the event is refused in AlphaFlow with quota_exceeded and shown in the journal; the webhook of the form stays on.

CF7 to Webhook documentation​