Create a contact form with Chat Funnels (+)

Want to use Joinchat as a conversational contact form? In this guide, we’ll show you step-by-step how to do it using Chat Funnels (+): a system for building conversational flows that collect data in a much more natural way than traditional forms.

form versus chat

What is Chat Funnels (+)?

With Chat Funnels (+), you can design custom conversations where the assistant guides the user step by step to collect information such as their name, email, or message. All in a friendly, conversational, and frictionless way.

This lets you replace classic forms with a smoother experience where users feel like they’re talking to a real person. Perfect for:

  • Contact forms
  • Quote requests
  • Qualified lead capture
  • Product or service inquiries

Example: Conversational Contact Form

Here’s a simple example of how to create a small Chat Funnel that acts as a form and, in the end, sends the collected data by email.


Step 1: Create the flow in Chat Funnels (+)

We’ll create a simple Chat Funnel with 6 steps:

  1. A first step with the welcome message.
  2. Three “Input”-type steps to collect name, email, and subject data.
    These fields can then be used anywhere in the Funnel with {{field_name}}.
  3. An “Action / Webhook” step.

    Here we configure the endpoint using {wp_admin_ajax}, which sends the data to our own wp-admin/admin-ajax.php, the method as POST, and the format as Form.

    We also added an extra field "action" with the value "joinchat_contact". This action will be used in Step 2 in the WordPress hooks.
  4. A final step with a thank-you message.
image

Chat Funnels are saved internally in YAML format, making it very easy to copy and edit them (just be careful not to break the structure). Here’s the code from our example (you just need to copy and paste it into a new Chat Funnel):

- step: 0
 name: Saludo
 content: 👋 ¡Hola! Bienvenido a *{SITE}*.
 options:
 - option: 0
 type: goto
 text: ''
 value: 1
- step: 1
 input: text
 name: name
 content: ¿Cómo te llamas?
 options:
 - option: 0
 type: goto
 text: ''
 value: 2
- step: 2
 input: email
 name: email
 content: |-
 ¡Encantado, {{name}}!
 ===
 ¿Cuál es tu correo electrónico?
 options:
 - option: 0
 type: goto
 text: ''
 value: 3
- step: 3
 input: text
 name: subject
 content: |-
 ¡Gracias!
 ===
 ¿Cuál es el motivo de tu consulta?
 options:
 - option: 0
 type: goto
 text: ''
 value: 4
- step: 4
 name: Send to admin-ajax.php / action "joinchat_contact"
 content: '["all","action:joinchat_contact"]["all"]'
 options:
 - option: 0
 type: goto
 text: ''
 value: 5
 action: webhook
 endpoint:
 - ''
 - POST
 - form
- step: 5
 name: Fin
 content: |-
 ¡Genial, {{name}}! Ya lo tenemos todo.
 ===
 Nos pondremos en contacto contigo lo antes posible.
 ===
 *¡Que tengas un excelente día!*
 options: []

Step 2: Create a PHP snippet to capture the data and send the email

In your functions.php file or a custom plugin (we like using the Code Snippets plugin), add this code to receive the data and send the email.

Actions follow the format do_action( “wp_ajax_{$action}” ) and do_action( “wp_ajax_nopriv_{$action}” ). We’ll use the "joinchat_contact" action we defined earlier.

add_action('wp_ajax_joinchat_contact', 'joinchat_send_email_via_ajax');
add_action('wp_ajax_nopriv_joinchat_contact', 'joinchat_send_email_via_ajax');

function joinchat_send_email_via_ajax() {
 // Check for required parameters
 if (!isset($_POST['name'], $_POST['email'], $_POST['subject'])) {
 wp_send_json_error(['message' => 'Missing parameters']);
 wp_die();
 }

 // Sanitize input data
 $name = sanitize_text_field($_POST['name']);
 $email = sanitize_email($_POST['email']);
 $subject = sanitize_textarea_field($_POST['subject']);

 // Validate email
 if (!is_email($email)) {
 wp_send_json_error(['message' => 'Invalid email address']);
 wp_die();
 }

 // Prepare email
 $to = get_option('admin_email'); // Send to the site admin email
 $subject = 'New Message from ' . $name;
 $body = "Name: $name\nEmail: $email\nMessage:\n$subject";
 $headers = ['Content-Type: text/plain; charset=UTF-8'];

 // Send email
 if (wp_mail($to, $subject, $body, $headers)) {
 wp_send_json_success(['message' => 'Email sent successfully']);
 } else {
 wp_send_json_error(['message' => 'Failed to send email']);
 }

 wp_die();
}


The result?

A conversational form tailored to your business, 100% integrated with WordPress, and offering a much smoother experience for your users.

With Chat Funnels (+), you can automate repetitive tasks and collect valuable information through conversation—without overwhelming visitors with traditional forms.

🍪 We use cookies to personalize and enhance your experience on our site. Visit our Privacy Policy to learn more.

BY USING OUR SITE, YOU AGREE TO OUR USE OF COOKIES.

Open WhatsApp
1
Knock knock
Scan the code