At WP Desk we use tools that greatly improve our customer service and help us save on support time. Two of my personal favorites are Gravity Forms and Help Scout. In this tutorial I will show you how to programmatically trigger Gravity Forms email notification if Help Scout add-on fails to create a conversation in Help Scout.
Tools that we use
- Gravity Forms
- Gravity Forms Help Scout Add-On
- Help Scout
- User fills in and send the support form on our website.
- Entry is created in Gravity Forms database.
- Conversation is created in Help Scout via add-on.
This workflow works great if everything is fine with the Help Scout API and authentication. However there are some occasions when the API does not work and conversations are not created in Help Scout. There were several situations in which we discovered the problem only after a few hours.
If there are some problems we can create the conversation manually from Gravity Forms entry page, however this is time consuming, so we wanted to have an automatic solution.
So we added a fallback to our workflow:
- If there is a problem with Help Scout API, the email notification is triggered programmatically by the code that you can find below.
- Additionally an email is sent to admin informing him about API error.
Programmatically trigger Gravity Forms notification
How to add this notification
When you add this code in your functions.php file, go to Gravity Forms form notifications and create a notification. Select Help Scout Conversation Error as a notification event: