Overview
The Plugin API Trigger in Groundhogg provides a way for developers to create custom triggers within a flow, enabling advanced automation by integrating custom code. This trigger is designed for users with coding knowledge who need to initiate flows based on bespoke events not covered by standard triggers.

Extension Required!
The Plugin API Trigger is available with the Advanced Features addon. It can be purchased separately or as part of the Agency, Pro or Plus Plans.
When to Use
Use the Plugin API Trigger when you need to trigger a flow based on a custom event defined in your WordPress site’s code, such as a specific user action, a third-party plugin event, or a custom database update. It’s ideal for tailored automation scenarios that require integration with external systems or unique business logic.
How It Works
The Plugin API Trigger works by allowing developers to define a custom event with a unique “Call Name” and implement it using Groundhogg’s API in the site’s code (typically in the theme’s functions.php file). When the custom event is triggered, the flow detects it and executes the configured actions. The trigger supports tracking conversion metrics for flow reporting.

Setup Instructions
- Access the Flow Builder: Navigate to Groundhogg > Flows and create or edit a flow.
- Add the Trigger: Drag the “Plugin API Trigger” from the Triggers panel into the flow canvas on the left.
- Configure Settings:
- Call Name: Enter a unique name for the custom event (e.g., custom_user_action).
- Copy the Code: Hover over the trigger to copy the generated PHP code snippet provided by Groundhogg.
- Implement the Code: Paste the copied code into your theme’s functions.php file or a custom plugin, modifying it as needed to trigger the event at the desired moment.
- Save the Trigger: Click “Save” to confirm the settings.
- Add Actions: Connect subsequent actions to the trigger to define what happens when the custom event occurs.
- Test the Flow: Trigger the custom event in your code to ensure the flow activates correctly.
Example Use Case
An e-commerce site uses Groundhogg to automate customer follow-ups. A developer creates a Plugin API Trigger with the Call Name abandoned_cart. They add code to the site’s functions.php file to trigger this event when a user leaves the checkout page without completing a purchase. When the event fires, the flow sends a reminder email with a discount code, encouraging the user to return and complete their order. This custom automation helps recover lost sales efficiently.
FAQs / Troubleshooting
Q: Why isn’t my Plugin API Trigger working?
A: Verify that the Call Name in the trigger matches the one used in your code. Ensure the code is correctly implemented in functions.php or a plugin and that the event is being triggered. Test by manually calling the event in a controlled environment.
Q: Can non-developers use this trigger?
A: This trigger requires coding knowledge to implement the custom event. Non-developers should consult a developer or use standard triggers instead.
Q: How do I track conversions with this trigger?
A: Enable conversion tracking in the trigger settings. The flow report will log when the custom event is triggered, providing metrics on flow performance.
Q: Can I use this trigger with third-party plugins?
A: Yes, if the third-party plugin allows custom code execution (e.g., via hooks), you can integrate it with the Plugin API Trigger by triggering the custom event in response to plugin actions.
Was this helpful?
Let us know if this document answered your question. That’s the only way we can improve.