Skip to main content

Complete Guide to Integrating Formidable Forms with SendSquared

This guide provides a comprehensive approach to integrating WordPress Formidable Forms with SendSquared's Lead With Contact API. This integration allows you to automatically create contacts and leads in your SendSquared CRM when visitors submit forms on your website.

Table of Contents

  1. Overview
  2. Prerequisites
  3. Implementation Checklist
  4. Gathering Required Information
  5. Implementation Steps
  6. Code Explanation
  7. Understanding Formidable Forms Data Structure
  8. Understanding the Lead With Contact API
  9. Customizing the Lead Data
  10. Troubleshooting
  11. Support Resources

Overview

The Formidable Forms-SendSquared integration allows you to:

  • Automatically create contacts in SendSquared from form submissions
  • Generate leads in SendSquared's CRM system
  • Track customer interest and follow up with potential clients
  • Streamline the lead capturing process from your WordPress website

Prerequisites

Before implementing this integration, ensure you have:

  • WordPress with Formidable Forms plugin installed and activated
  • Admin access to both WordPress and SendSquared
  • Basic knowledge of PHP or access to a developer
  • Access to edit your theme's functions.php file or ability to create a custom plugin

Implementation Checklist

Copy this checklist to your task management system to track your progress:

  • Formidable Forms: Identify your form ID
  • Formidable Forms: Identify your field IDs
  • Formidable Forms: Test your form submission
  • SendSquared: Obtain your API key
  • SendSquared: Determine the lead type ID to use
  • SendSquared: Determine the lead status ID to use
  • SendSquared: Identify the user ID for lead assignment
  • SendSquared: Determine the source ID (if applicable)
  • Test the integration after implementation

Gathering Required Information

Before implementing this integration, you'll need to gather information from both Formidable Forms and SendSquared:

From Formidable Forms:

  1. Form ID: Each Formidable Form has a unique ID:

    • Go to Formidable > Forms in your WordPress admin
    • Hover over your form and look for the ID in the URL or in the form listing
  2. Field IDs: Each field in Formidable Forms has a unique ID:

    • Go to Formidable > Forms in your WordPress admin
    • Edit your form
    • Click on a field and look for the "Field ID" in the field options panel
    • Note down the IDs for these fields:
      • Email field ID
      • First name field ID
      • Last name field ID
      • Phone field ID
      • Interest field ID
      • Message/notes field ID

From SendSquared:

  1. API Key: Go to Settings > API Keys in your SendSquared admin panel to obtain your API key
  2. Lead Type ID: Navigate to Settings > Lead Types and note the ID of the appropriate lead type
  3. Lead Status ID: Go to Settings > Lead Statuses and identify the status ID you want to use for new leads
  4. User ID: This is the ID of the agent who will be assigned these leads. You can find user IDs in the Users section
  5. Source ID: If you track lead sources in SendSquared, obtain the appropriate source ID from Settings > Sources

All of these IDs are required for the integration to work properly. If you're unsure about any of these values, contact SendSquared support for assistance in locating them in your account.

Implementation Steps

  1. Copy the code snippet below
  2. Paste it into your theme's functions.php file or in a custom plugin
  3. Update the form ID ($form_id != 5) with your actual Formidable Forms form ID
  4. Update all the field IDs in the code with your actual Formidable Forms field IDs:
    • Update $entry->metas['123'] with your email field ID
    • Update $entry->metas['124'] with your first name field ID
    • Update $entry->metas['125'] with your last name field ID
    • Update $entry->metas['126'] with your phone field ID
    • Update $entry->metas['127'] with your interest field ID
    • Update $entry->metas['128'] with your message field ID
  5. Update the SendSquared specific IDs that you gathered earlier:
    • lead_type_id
    • lead_status_id
    • user_id
    • source_id
  6. Replace your-api-key-here with your actual SendSquared API key
  7. Test your form submission to ensure leads are being created in SendSquared

Code Explanation

The following code integrates Formidable Forms with SendSquared's Lead With Contact API. When a form is submitted, it collects form data, constructs the necessary contact and lead information, and sends it to SendSquared.

<?php
add_action('frm_after_create_entry', 'send_formidable_data_to_sendsquared', 30, 2);

function send_formidable_data_to_sendsquared($entry_id, $form_id)
{
// Only run this for a specific form ID - update with your form ID
if ($form_id != 5) {
return;
}

// Get the entry data
$entry = FrmEntry::getOne($entry_id, true);

// Update these field IDs with your actual Formidable Forms field IDs
$email = isset($entry->metas['123']) ? $entry->metas['123'] : ''; // Update with your email field ID
$first_name = isset($entry->metas['124']) ? $entry->metas['124'] : ''; // Update with your first name field ID
$last_name = isset($entry->metas['125']) ? $entry->metas['125'] : ''; // Update with your last name field ID
$phone = isset($entry->metas['126']) ? $entry->metas['126'] : ''; // Update with your phone field ID
$interest_in = isset($entry->metas['127']) ? $entry->metas['127'] : ''; // Update with your interest field ID
$other_items = isset($entry->metas['128']) ? $entry->metas['128'] : ''; // Update with your message field ID

// This constructs the subject line using the interest field
$subject = 'Interested in ' . $interest_in;
$now = new DateTime();
$formatted_now = $now->format(DateTime::ATOM);

// Contact data structure
$contactData = array(
'email' => $email,
'first_name' => $first_name,
'last_name' => $last_name,
'mobile_phone' => $phone, // must be in E.164 format (+1XXXXXXXXXX)
);

// Lead data structure
$leadData = array(
// Update these IDs with your actual SendSquared IDs
'lead_type_id' => 116, // Update with your lead type ID
'lead_status_id' => 504, // Update with your lead status ID
'subject' => $subject,
'interest_start_at' => $formatted_now,
'interest_end_at' => $formatted_now,
'quantity_1' => 1, // Number of adults - customize as needed
'quantity_2' => 0, // Number of children - customize as needed
'notes' => array($other_items),
'user_id' => 1446, // Update with your agent user ID
'source_id' => 0, // Update with your source ID if needed
);

// Prepare request data
$requestData = json_encode(array(
'contact' => $contactData,
'lead' => $leadData,
));

// Send data to the SendSquared API
$response = wp_remote_post('https://api.sendsquared.com/v1/leads/lead-with-contact', array(
'method' => 'POST',
'headers' => array(
'Content-Type' => 'application/json',
// Update with your actual API key
'x-api-key' => 'your-api-key-here',
),
'body' => $requestData,
));

// Error handling
if (is_wp_error($response) || wp_remote_retrieve_response_code($response) != 200) {
$response_code = wp_remote_retrieve_response_code($response);
$response_body = wp_remote_retrieve_body($response);
error_log("Error submitting lead to SendSquared (Code: {$response_code}): " . $response_body);
}
}

Understanding Formidable Forms Data Structure

The integration uses the frm_after_create_entry hook which is triggered after a form entry is created. This hook provides two parameters:

  1. $entry_id - The ID of the newly created entry
  2. $form_id - The ID of the form that was submitted

To access the submitted data, we use FrmEntry::getOne($entry_id, true) which returns the entry object with all its meta data. The entry object has a metas property which is an associative array where the keys are the field IDs and the values are the submitted field values.

// Example entry object structure
$entry = {
'id' => 789,
'item_key' => 'abc123',
'name' => 'Entry Title',
'ip' => '192.168.1.1',
'metas' => [
'123' => 'user@example.com',
'124' => 'John',
'125' => 'Doe',
'126' => '+12345678900',
'127' => 'Property Management',
'128' => 'I would like more information about your services.'
]
}

In the integration code, we access these values directly using the field IDs.

Understanding the Lead With Contact API

The SendSquared Lead With Contact API creates both a contact record and a lead record in a single API call, linking them together automatically. This is useful when:

  • You want to capture new leads from your website
  • You need to track interest in specific properties or services
  • You want to automate the lead capture process

Customizing the Lead Data

You can customize various aspects of the lead data to fit your specific needs:

// Example of additional lead customization
$leadData = array(
'lead_type_id' => 116,
'lead_status_id' => 504,
'subject' => $subject,
'interest_start_at' => $formatted_now,
'interest_end_at' => $formatted_now,
'quantity_1' => isset($entry->metas['129']) ? intval($entry->metas['129']) : 1, // Adults field ID
'quantity_2' => isset($entry->metas['130']) ? intval($entry->metas['130']) : 0, // Children field ID
'notes' => array(
"Interest: " . $interest_in,
"Budget: " . (isset($entry->metas['131']) ? $entry->metas['131'] : ''), // Budget field ID
"Additional notes: " . $other_items
),
'user_id' => 1446, // The agent who will handle this lead
'source_id' => 123, // Your website source ID
);

Troubleshooting

If your integration isn't working properly, check these common issues:

  1. Field ID Mismatch: Verify that your Formidable Forms form ID and field IDs match exactly what you've specified in the code
  2. API Credentials: Confirm that your SendSquared API key is correct
  3. Error Logs: Check your WordPress error logs for any API errors
  4. Response Codes: Pay attention to response codes from the SendSquared API:
    • 422 Error: This means validation failed. The response body will contain details about what is missing or incorrect in your request. Check field formats (especially the phone number which must be in E.164 format) and required fields.
  5. Network Issues: Ensure that WordPress can make outgoing HTTP requests (some hosting providers block these)
  6. API Accessibility: Verify that the SendSquared API endpoint is accessible from your server

To debug Formidable Forms submissions, you can add this code temporarily to see the structure of your form entries:

add_action('frm_after_create_entry', 'debug_formidable_forms_submission', 30, 2);
function debug_formidable_forms_submission($entry_id, $form_id) {
$entry = FrmEntry::getOne($entry_id, true);
error_log('Formidable Forms Submission - Entry ID: ' . $entry_id);
error_log('Formidable Forms Submission - Form ID: ' . $form_id);
error_log('Formidable Forms Submission - Entry Data: ' . print_r($entry, true));
}

Support Resources

For additional support, contact SendSquared support at:

For Formidable Forms support, refer to their documentation at:

Frequently Asked Questions

How do I test the Formidable Forms integration without affecting live data?

To test safely:

  1. Create a test lead type and status in SendSquared for development
  2. Use test IDs in your integration code during development
  3. Submit test entries with obvious test names (e.g., "Test User Test")
  4. Enable WordPress debug logging to monitor API responses
  5. Use a staging/development WordPress environment when possible
  6. Check the WordPress error log for any issues
  7. Switch to production credentials only after thorough testing

What happens if the SendSquared API is temporarily down?

The Formidable Forms integration includes error handling that will:

  • Log errors to your WordPress error log without breaking the form submission
  • Allow the form to still submit normally to Formidable Forms database
  • Not display errors to your site visitors
  • Store the form data in Formidable Forms for manual processing if needed
  • You can implement retry logic or queuing systems for failed API calls

Can I integrate multiple Formidable Forms with different SendSquared configurations?

Yes! You can modify the integration code to handle multiple forms with different settings:

function send_formidable_data_to_sendsquared($entry_id, $form_id) {
// Route different forms to different configurations
switch($form_id) {
case 5: // Contact form
$lead_type_id = 116;
$lead_status_id = 504;
$user_id = 1446;
$source_id = 1;
break;
case 6: // Property inquiry form
$lead_type_id = 120;
$lead_status_id = 500;
$user_id = 1450;
$source_id = 2;
break;
default:
return; // Don't process other forms
}
// Rest of integration code...
}

How do I handle form validation errors from the SendSquared API?

The integration includes error logging, but you can enhance it for better debugging:

if (is_wp_error($response) || wp_remote_retrieve_response_code($response) != 200) {
$response_code = wp_remote_retrieve_response_code($response);
$response_body = wp_remote_retrieve_body($response);

// Log detailed error information
error_log("SendSquared API Error - Form ID: {$form_id}, Entry ID: {$entry_id}");
error_log("Response Code: {$response_code}");
error_log("Response Body: {$response_body}");

// Handle specific error types
if ($response_code == 422) {
error_log("Validation failed - check phone format and required fields");
} elseif ($response_code == 401) {
error_log("Authentication failed - check API key");
}
}

What data formats are required for SendSquared Lead API fields?

  • Email: Valid email format (validated by Formidable Forms)
  • Phone: Must be in E.164 format (+1XXXXXXXXXX for US numbers)
  • Names: String values, can handle Unicode characters
  • Dates: ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) - automatically handled by DateTime::ATOM
  • IDs: Integer values (lead_type_id, lead_status_id, user_id, source_id)
  • Notes: Array of strings
  • Quantities: Integer values

Is the Formidable Forms integration GDPR compliant?

The integration respects GDPR requirements:

  • Only processes data after explicit form submission by the user
  • Doesn't store additional data beyond Formidable Forms' standard handling
  • Transmits data securely via HTTPS to SendSquared
  • You should add GDPR consent fields to your Formidable Forms as needed
  • Consider adding privacy policy links and consent checkboxes
  • Formidable Forms has built-in GDPR compliance features you can enable

Can I update existing contacts instead of creating duplicates?

Yes, the SendSquared Lead with Contact API handles this automatically:

  • If a contact with the same email already exists, it updates the contact information
  • A new lead is created and linked to the existing or updated contact
  • This prevents duplicate contacts while tracking multiple lead interactions
  • Email serves as the unique identifier for contact matching

What are the API rate limits for SendSquared?

SendSquared API limits:

  • 1000 requests per hour per API key
  • 10 concurrent requests maximum
  • For high-volume forms, consider implementing:
    • Request queuing for peak times
    • Exponential backoff for failed requests
    • Contact SendSquared support for higher limits if needed
  • The integration handles rate limiting gracefully through error logging