To integrate the ZNICRM WebLead API with Google Forms, follow these steps:
Step 1: Generate Your ZNICRM API Key
- Log in to your ZNICRM dashboard.
- Navigate to Settings.
- In the left menu, select Developers → API Key. How To Generate API Key For CRM
- Click the “Add Key” button to generate a new API key.
- Copy and securely store the generated API key.
Step 2: Create and Link Your Google Form
- Create your Google Form with the necessary fields (e.g., Name, Email, Phone).
- Click on the Responses tab.
- Click the “Link to Sheets” icon to create a linked Google Sheet that will store form responses.
Set Up Google Apps Script
- Open the linked Google Sheet.
- Click on Extensions → Apps Script.
- Delete any existing code in the script editor and replace it with the following:
function onFormSubmit(e) {
var responses = e.values;
// Adjust indices based on your form's structure
var leadName = responses[1]; // Assuming 'Name' is the second column
var leadEmail = responses[2]; // Assuming 'Email' is the third column
var leadPhone = responses[3]; // Assuming 'Phone' is the fourth column
var apiKey = 'YOUR_API_KEY'; // Replace with your actual API key
var departmentId = ''; // Optional: Replace with your department ID if applicable
var leadQuery = 'Form submission from Google Forms';
var leadConversionPage = 'Google Form';
var leadIP = ''; // Optional: You can capture the IP if available
var params = {
apikey: apiKey,
leadName: leadName,
leadEmail: leadEmail,
leadPhone: leadPhone,
department: departmentId,
leadQuery: leadQuery,
leadConversionPage: leadConversionPage,
leadIP: leadIP
};
var queryString = Object.keys(params)
.map(function(key) {
return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
})
.join('&');
var url = 'https://api.intueri.io/weblead.php?' + queryString;
try {
var response = UrlFetchApp.fetch(url);
Logger.log('Response: ' + response.getContentText());
} catch (error) {
Logger.log('Error: ' + error);
}
}
Note: Adjust the responses
indices to match the order of your form fields. The first element (responses[0]
) is the timestamp.
Step 4: Set Up a Trigger for Form Submissions
- In the Apps Script editor, click on the Triggers icon (clock symbol) in the left sidebar.
- Click “+ Add Trigger”.
- Set the following:
- Choose which function to run:
onFormSubmit
- Choose which deployment should run:
Head
- Select event source:
From spreadsheet
- Select event type:
On form submit
- Choose which function to run:
- Click Save and authorize the script when prompted.
Test the Integration
- Submit a test entry through your Google Form.
- Check your ZNICRM dashboard to verify that the lead has been created.
- In the Apps Script editor, view the Logs (via View → Logs) to see the response from the API.
Additional Notes
- Mandatory Fields: Ensure that either
leadPhone
orleadEmail
is provided, as at least one is required by the API. - Rate Limiting: The API allows up to 60 requests per minute.
- Error Handling: Consider enhancing the script with additional error handling and notifications as needed.
- Full API documentation is available at https://hd.znicrm.com/art/weblead-api