Freshdesk – Simple WordPress Integration


Freshdesk is one of the most popular systems that simplify the process of providing technical assistance and increase the level of customer satisfaction. They allows you to create dynamic forms anywhere you want. However, in a situation where we need something more personalized it may turn out that it does not provide all the required functionalities.

That was the case of one of our clients – the AskHenry company providing the highest quality assistance and concierge services.

While implementing the project of their new website, we had to integrate Freshdesk, which they use on a daily basis with a two-step form located on the subpage of the B2B website.

Contact Form

To create a two-step contact form, we used the Contact Form 7 plugin with the additionial Multi-Steps functionality. We use Freshdesk API v2 for integration. Notification to the system should be sent when all the fields in the form are filled in correctly and the submit button is clicked.

Therefore, we must use the action wpcf7_mail_sent() that fires only when sending the form and add the Freshdesk ticket sending code. To all data sent in the form, we can get through the following function.

The data will be stored in the variable called posted_data. The data provided by the user can be found in the appropriate fields of the table, for example, we can get to the e-mail address sent to the field named email address, in this way:

Sending a ticket

In the next step, we need to create a JSON table which we will send to Freshdesk later:

We will use cURL to connect to the Freshdesk server – make sure in the first place that it is available on your server.

Testing our code

When testing our code, it is worth adding a part responsible for writing out the answers returned by the Freshdesk server.

When testing the code on localhost without an SSL certificate, remember to set the CURLOPT_SSL_VERIFYPEER accordingly.

Feel free to ask questions in the comments! We will try to answer all the comments as soon as possible.

Sign up for our newsletter

Join our mailing list and don't miss any posts and news from the tech world!