This plugin extends the possibilities of WP Webhooks Pro by initializing a new functionality called Code Trigger. A Code Trigger is a piece of code (created via webhooks) that runs every time WordPress is called.
This enables you to create a piece of code on your system that runs everytime someone interacts with your websites, calls an api or a webhook.
You will be able to setup code that is always available, even when your webhook is not making any calls at the moment. To top that, you are also able to manage these Code Triggers via webhooks.
Also, we added another security feature that checks your code for possible php errors before taking it live. This way, you won’t run into 500 errors anymore.
How to use it
- Upload the zip file to your WordPress site (Plugins > Add New > Upload)
- Activate the plugin
- Go to Settings > WP Webhooks Pro -> Settings
- Scroll down and activate the specified action and click Save
- Go to Recieve Data and start implementing the webhook
- Go to the Code Triggers tab and check the currently installed Code Triggers
Now just copy the specified webhook you want to use for that (The link with the long API key at the end) and head over to your webhook handler.
In this example, we will demonstrate the functionality using Zapier.
On Zapier you can create a new Zap,
Now you are prompted to choose a Zapier Webhook. Choose POST or Custom Request and click “Save and continue” (In this example we cover POST)
On the next page, you need to include an URL. Please include there your webhook URL from your websites “Recieve Data” page.
For the Payload type, you can choose between Form, XML or JSON. You can also use plain text or
In this example, we are going to use the Payload Type “Json“, as well as the webhook action “create_code_trigger”
After including the URL and checking the Payload Type, scroll down and set the following button to no: Unflatten
Now you can scroll up again and place your actions into the Data fields.
As an action, you can choose create_code_trigger. For this action, it is required to define the “slug” field, as well as the “code” field. The slug is a unique identifier for the code block you want to register. The code field includes the PHP code you want to run within your trigger. Please include it without start and ending tag ( No <?
Now you can click save and finish the setup! After you set up your Zap, don’t forget to activate it.
After the set up was complete, you will be able to create the code trigger on your website. As soon as it runs the first time, you will be able to see the piece of code that should run within your WordPress site under Settings -> WP Webhooks Pro -> Code Trigger
In case you want to deactivate a custom code trigger, you can call the code_trigger_status action. You will find more details about it within the defined action description.
It is also possible to delete a Code Trigger by using the following action: delete_code_trigger
You will find more details about it within the defined action description.