Skip to content
  • Why WPGetAPI?
  • Examples
  • Pricing
  • Plugins
    • PRO Plugin
    • API to Posts Plugin
    • OAuth 2.0 Plugin
  • Docs
  • Support
    • Frequently Asked Questions
    • Feature Request
    • Support Ticket
  • account_circle
PRO Plugin
Howdy! How can we help you?
  • Introduction

    • Quick Start
    • Frequently Asked Questions
    • Will this work with my API?
    • Understanding API docs
    • Step by Step Example
  • Setup

    • Setup Page
    • Endpoint Page
    • Parameters - Query String
    • Parameters - Headers
    • Parameters - Body POST
    • Shortcode
    • Template Tag
    • Gutenberg Block
  • Connecting your API

    • API Key in Headers
    • API Key in Query String
    • Authentication & Authorization
  • Output API Data

    • Format API to HTML
    • Format API to HTML Table
    • Format API to Image Gallery
    • Format JSON Data
  • Integrations

    • Send form data to API
    • WPForms to API
    • Gravity Forms to API
    • Contact Form 7 to API
    • WooCommerce to API
    • WooCommerce API Product Sync
    • wpDataTables to API
    • Connect WordPress to OpenAI
    • Connect RapidAPI to WordPress
    • Connect Zoho CRM to WordPress
    • Page Builders (Elementor, DIVI)
    • Formidable Forms to API
    • Elementor Form to API
    • JetFormBuilder to API
    • Fluent Forms to API
    • WS Form to API
    • Ninja Tables to API
    • Easy Digital Downloads(EDD) API Product Sync
    • Ultimate Member Forms to API
  • Tips & Tricks

    • Filters & Action Hooks
    • Code Snippets Plugin
    • Troubleshooting
    • Code Snippets
  • PRO Plugin

    • Installation
    • Actions
    • Tokens
    • Caching
    • Nested data
    • Chaining API calls
    • Dynamic Variables
    • Format API to HTML
    • Call API on user registration
    • Using AJAX to trigger API call
    • Base64 Encoding
    • Licensing
    • Filters & Action Hooks
  • OAuth 2.0 Plugin

    • Installation
    • How it works
    • Grant Type - Client Credentials
    • Grant Type - Authorization Code
    • Licensing
  • API to Posts Plugin

    • Installation
    • Getting Started
    • Multiple Endpoints
    • Mapping Fields
    • Filters & Action Hooks
    • Pagination
This uses the OAuth 2.0 Authorization plugin to connect to Zoho CRM and also the Pro plugin to send form data to Zoho.

In a previous article, we explained how to set up a Zoho application and how to configure your WordPress website to communicate with Zoho CRM through the use of our OAuth 2.0 Authorization plugin. This article will delve a little deeper into setting up endpoints for the Zoho API and actually sending data to your Zoho CRM as well as receiving and displaying data from Zoho.

Specifically we will look at capturing a new lead with a WordPress forms plugin and sending the lead direct to the Zoho CRM. This is perfect for a newsletter signup or even a contact form with an ‘opt-in to marketing emails’ checkbox setup. This can also be adapted to be used with any other Zoho API endpoint.

Requirements

  • A Zoho CRM account
  • Free WPGetAPI plugin
  • A free forms plugin such as Gravity Forms, Contact Form 7 or WPForms
  • Premium plugins – Pro plugin & OAuth 2.0 plugin
  • Your website connected to Zoho CRM as shown in this article.

Capturing form data to send to Zoho CRM API

To capture the form data, we will use a forms plugin (Gravity Forms in this case) and then send this data to the Zoho API which then creates a new Lead within the Zoho CRM.

Step 1: Setup the endpoint

The first step is to set up our new_lead endpoint (Zoho docs for this endpoint are here). The endpoint should look something like what we have in the image below. The values for the fields should be as follows:

  • Unique ID – new_lead
  • Endpoint – /Leads
  • Method – POST
  • Results Format – PHP array data
  • Encode Body – JSON encode

(not that our Base URL is a .com.au address as we are based in Australia. Check your Base URL, depending on your location here)

WordPress capture leads and send to Zoho CRM

Step 2: Setup the form

We now need to setup our form – as mentioned we will use Gravity Forms for this, but you can also use Contact Form 7, WPForms or any other forms plugin that allows you to run code upon form submission.

We are just keeping it simple and using First Name, Last Name and Email for our new leads. Once your form is built, click on the Embed button to add it to your page or your desired location.

Gravity Forms to Zoho CRM lead capture form

Step 3: Send the form entries to Zoho’s API

We have our endpoint setup and our form setup on our website, now we need to add a snippet of code that will capture the data from the form and then send this to the Zoho API. The snippet needs to go into your themes functions.php file or you can also use a code snippets plugin to add the code.


function wpgetapi_send_lead_to_zoho( $confirmation, $form, $entry, $ajax ) {
 	
	// gets the data that is entered from the user
	$first_name = rgar( $entry, '1.3' );
	$last_name = rgar( $entry, '1.6' );
	$email = rgar( $entry, '3' );
	
	$lead_data = array(
		'data' => array( 
			array(
				'First_Name' => $last_name, 
				'Last_Name' => $last_name, 
				'Email' => $email,
			)
		),
		'trigger' => array(),
	);

	// call our zoho 'new_lead' endpoint
	$result = wpgetapi_endpoint( 'zoho', 'new_lead', 
		array( 
			'debug' => false, 
			'body_variables' => $lead_data
		)
	);

	// output our message to the user
	$confirmation = '';
	$confirmation .= ''; 
        $confirmation .= 'This data can be formatted anyway you like.'; 
        $confirmation .= json_encode( $result ); 
        
        return $confirmation; 
    } 
    add_filter( 'gform_confirmation_8', 'wpgetapi_send_lead_to_zoho', 10, 4 );

Testing the results

Below is the live form linked to our test Zoho account. You can add some dummy data to the form to see the results.

Name(Required)

 

On this page
contact_support

Still not sure?

APIs can be daunting and sometimes downright confusing.

But we are here to help! Our support is amazing and we can assist you with any setup required and ensure your API integrations are a success!

Ask Us Anything

Connect your WordPress website to external APIs without writing a single line of code. Send data from WordPress to your API or display data from your API within WordPress.

Support

  • Documentation
  • Support Ticket
  • Refund Policy
  • Contact Us
  • About Us
  • Affiliates

Articles

  • Quick Start Guide
  • WooCommerce Orders to API
  • WooCommerce API Products Sync
  • Contact Form 7 to API
  • WPForms to API
  • Gravity Forms to API
  • WordPress to RapidAPI

WordPress API Plugins

  • Free WPGetAPI Plugin
  • PRO Plugin
  • API to Posts Plugin Plugin
  • OAuth 2.0 Authorization Plugin

© 2025 WPGetAPI. All Rights Reserved.

"*" indicates required fields

Name*
This field is for validation purposes and should be left unchanged.