What is Avochato?
Avochato is a communication platform designed for teams in sales, support, healthcare, and operations. It offers a shared inbox and dedicated phone numbers, enabling teams to send and receive text messages and calls with customers in real-time. By centralizing communication into a collaborative workspace, Avochato enhances both internal team coordination and external customer engagement, making client communication seamless, responsive, and efficient.
Contact Form 7 used for?
Contact Form 7 is a popular WordPress plugin that allows you to easily add contact forms to your website. It provides a simple way for your visitors or clients to get in touch with you directly through your site. Beyond basic communication, it’s also a great tool for collecting leads and email addresses, helping you grow your email list and stay connected with potential customers.
Contact form 7 extension for Avochato
We’ve previously done extensive work integrating Contact Form 7 with Avochato using PHP, leading to the development of our custom Contact Form 7 extension for Avochato. So, we thought—why not share some of our working and well-prepared code examples with you? This integration allows you to automatically send form submissions from your website directly to Avochato, enabling real-time communication and better lead management.
In this post we will use PHP and cURL to connect Contact Form 7 with Acochato.
// Request Method to use in the script
function apifixer_remoteDATA($url, $data = false){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
//If receives Data than POST else GET
if ($data){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0
(compatible; MSIE 8.0; Windows NT 6.0)");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json'));
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_NOBODY, false);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 50);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
// Trigger the script on CONTACT FORM 7 Mail Sent
add_action('wpcf7_mail_sent', 'apifixer_avochato', 10, 1);
function apifixer_avochato($contact_form){
$data = array();
// Add your Avochato credentials below
$data['auth_id'] = 'your Auth ID';
$data['auth_secret'] = 'Your Auth Secret';
//Change your contact form 7 id here
$_contact_form_7_id = '1951';
//to get form id when form is posted
$form_id = $contact_form->id();
//to get posted data in associative array
$submission = WPVF7_Submission::get_instance();
$posted_data = $submission->get_posted_data();
//urls to link avochato
$url_contacts = "https://www.avochato.com/v1/contacts"; //url to add contact
in avochato
$url_messages = "https://www.avochato.com/v1/messages"; //url to send message
using avochato
//matches the contact form id with posted form id
if ($form_id == $_contact_form_7_id){
//you can write your message to be sent using Avochato
$posted_data['message'] = 'Hey ' . $posted_data['your-name'] . ',
Thanks for contacting apifixer.com Your wholesale quote for
'.$posted_data['qty'] . ' ' . $posted_data['towel'] . '
will be coming to you shortly!';
$data['phone'] = $posted_data['your-phone'];
//Send Text Message using Avocahto
if ($data['phone']){
apifixer_remoteDATA($url_messages, json_encode($data));
}
$data['name'] = $posted_data['your-name'];
$data['email'] = $posted_data['your-email'];
$data['company'] = $posted_data['your-company'];
$data['towel'] = $posted_data['towel'];
$data['quantity'] = $posted_data['qty'];
$data['delivery'] = $posted_data['delivery'];
//Add a Contact in Avocahto
apifixer_remoteDATA($url_contacts, json_encode($data));
}
}
Explanation:
This code provides a complete integration between Contact Form 7 and the Avochato communication platform by using WordPress hooks and the Avochato API. The custom function apifixer_remoteDATA() is a utility that abstracts the logic for sending API requests via cURL. It dynamically switches between GET and POST methods depending on whether data is passed to it, and it’s configured with common headers and cURL options to support JSON data transmission securely and efficiently.
The second part of the script uses the wpcf7_mail_sent action hook to trigger custom functionality after a Contact Form 7 submission. It checks whether the form ID matches a specific form (ID 1951 in this case). When matched, it pulls the submitted data using WPCF7_Submission::get_instance() and prepares two API requests to Avochato:
- Sending a personalized SMS message to the user using the
messagesendpoint. The message thanks the user and confirms receipt of their wholesale quote inquiry. - Adding or updating a contact in the Avochato contact list using the
contactsendpoint, which includes their name, email, phone number, company name, product details, quantity, and delivery date.
This integration ensures that leads or inquiries submitted via Contact Form 7 are immediately acknowledged through SMS, while also syncing their contact details into Avochato’s CRM system. It’s highly useful for businesses looking to streamline communication, improve response times, and manage customer interactions in one unified workflow.
With minimal modification (such as updating form ID, Avochato credentials, and field names), this code can be customized to work with other forms and use cases where instant messaging and contact syncing are required.
In conclusion, this integration bridges Contact Form 7 with Avochato, allowing automatic contact creation and real-time message sending whenever a form is submitted on your website. It’s a powerful way to enhance customer engagement, streamline communication, and ensure no lead goes unanswered. If you’d like help setting this up or want a custom plugin for your own use case, feel free to reach out.




















