This manual will demonstrate you on how to set up a direct connection between the Payments status changed trigger (to send data) and your chosen service (to receive the data of this trigger).
To get started, we will walk you through each step from the beginning to the end so that you can make sure your endpoint will work as expected.
Required plugins/services
In order to use this webhook trigger, you need to make sure you installed and activated the following plugins, or have a valid account with the services:
1. Setup WP Webhooks
To get started with WP Webhooks, simply download the latest version from your account dashboard and install/activate it on your WordPress website. If you want to lean more about the installation process of the plugin itself, please check out this manual.
2. Integrate the trigger with your service
In order to send data via the Payments status changed trigger, you need to provide a webhook URL from your chosen service so that it can receive dat sent by WP Webhooks.
In case you are interested to learn more about how to set up a webhook URL with services such as Integromat, Pabbly, or Zapier, please take a look at the following help files.
- Please head over to your WordPress dashboard > Settings > WP Webhooks > Send Data and add the webhook URL that was provided by your service to the Payments status changed trigger by clicking the "Add Webhook URL" button.
- To add the webhook URL, you are also promted to enter a name. This name will be used as an identifier of that specific URL. Best practice is to set it to the purpose of the webhook URL.
What we have accomplished so far: At this stage, your external service is already able to receive data from the Payments status changed trigger whenever it fires. By default, it will send a POST request along with the Content-Type: application/json, however, you can customize that within the settings.
3. Set up Data Mapping (Optional)
While this connection can aleady transer data from the Payments status changed trigger the webhook URL of your chosen service, your service might require a specific layout/setup of the data that is sent.
To solve that, we offer a feature called Data Mapping. This allows you to automatically alter the outgoing data from WP Webhooks to map its values to the required data structure of your service.
This feature allows you to do various mapping possibilities, create new values and manipulate existing ones. To show you this feature in a practical way, down below is a short manual on how you can set up the data mapping template:
Set up a Data Mapping template
- Go to your WordPress dashboard > Settings > WP Webhooks > Data Mapping and add a new Data Mapping template.
- Within it, you can add your mapping data that adjusts the data sent by WP Webhooks to the data structure required by your service.
- Lastly, you need to connect the Data Mapping template to the webhook URL you added within the Payments status changed trigger. To do that, please head over to your WordPress dashboard > Settings > WP Webhooks > Send Data and open the Setting of the added webhook URL. There you will find a setting called Add data mapping template - simply select your your Data Mapping template from the dropdown and save it.
- That's it. Now all data sent from WP Webhooks will be validated and mapped by the data mapping template. To learn more about it, please check out our documentation for Data Mapping templates.
Configure the Data Mapping template (Optional)
Now it is up to you what data you want to send in wich way via the Payments status changed trigger.
To provide you a quick example with various mapping possibilities, please take a look at the next steps.
- Go to your WordPress dashboard > Settings > WP Webhooks > Data Mapping and open the data mapping template you created in the previous step.
- Once you add a new row, you can add a new key at the left of it. This key will then be added to the data structure in case it does not exist yet.
- On the right you can add keys to map the existing data based on the data that was sent by the WP Webhooks trigger. To learn more about the mapping, please check out this helpfiles.
- To give you a better example of its possibilities, you will find a data mapping template export that you can simply copy and import it into your newly created data mapping template. This will add various data mapping entries to show you how it works.
{"template_settings":{"wpwhpro_data_mapping_whitelist_payload":"none"},"template_data":[{"new_key":"msg","singles":["{\"settings\":{\"wpwhpro_data_mapping_value_type\":\"data_value\",\"wpwhpro_data_mapping_convert_data\":\"none\",\"wpwhpro_data_mapping_decode_data\":\"none\",\"wpwhpro_data_mapping_fallback_value\":\"\"},\"value\":\"Some new message text.\"}"]},{"new_key":"sport_key","singles":["{\"settings\":{\"wpwhpro_data_mapping_value_type\":\"key_mapping\",\"wpwhpro_data_mapping_convert_data\":\"none\",\"wpwhpro_data_mapping_decode_data\":\"none\",\"wpwhpro_data_mapping_fallback_value\":\"\"},\"value\":\"custom_data\"}"]},{"new_key":"test_1","singles":["{\"settings\":{\"wpwhpro_data_mapping_value_type\":\"data_value\",\"wpwhpro_data_mapping_convert_data\":\"none\",\"wpwhpro_data_mapping_decode_data\":\"none\",\"wpwhpro_data_mapping_fallback_value\":\"\"},\"value\":\"Hello World\"}"]},{"new_key":"combine_both","singles":["{\"settings\":{\"wpwhpro_data_mapping_value_type\":\"data_value\",\"wpwhpro_data_mapping_convert_data\":\"none\",\"wpwhpro_data_mapping_decode_data\":\"none\",\"wpwhpro_data_mapping_fallback_value\":\"\"},\"value\":\"\\\"{:test_1:}\\\" is now combined with \\\"{:sport_key:}\\\"\"}"]},{"new_key":"number","singles":["{\"settings\":{\"wpwhpro_data_mapping_value_type\":\"data_value\",\"wpwhpro_data_mapping_convert_data\":\"integer\",\"wpwhpro_data_mapping_decode_data\":\"none\",\"wpwhpro_data_mapping_fallback_value\":\"\"},\"value\":\"1\"}"]},{"new_key":"json_to_array","singles":["{\"settings\":{\"wpwhpro_data_mapping_value_type\":\"data_value\",\"wpwhpro_data_mapping_convert_data\":\"none\",\"wpwhpro_data_mapping_decode_data\":\"json_decode\",\"wpwhpro_data_mapping_fallback_value\":\"\"},\"value\":\"{\\\"demo_data\\\": \\\"Demo Value\\\", \\\"more_data\\\": \\\"Another Value\\\"}\"}"]}]}
- After the import, you can try the data mapping template with the Preview Template feature that's availablel within the Data Mapping template. Simply add a demo JSON (as provided down below) and click the "Apply for outgoing data" button. This will simulate how the response looks like when the data from the JSON below would have been sent by the Payments status changed trigger
{
"success": true,
"msg": "Some Demo Message",
"custom_data": "Sport"
}
- Lastly, you only need to map the values sent by the Payments status changed trigger to the data structure required by your service.
If you are unsure about the format the data is sent from Payments status changed trigger, you have various options to check it:- One possibility is to check the "Outgoing data" tab of a single webhook trigger within WordPress dashboard > Settings > WP Webhooks > Send Data
- As we provide a static payload within the "Outgoing Data" tab, yours might differ, depending on custom values and other plugins. To check on those custom values, you can also use our Log feature. Once the trigger fires to the webhook URL of your service, you will see an entry within the logs, including the individual data.
- You can also send the data to a different webhook URL such as the one generated by https://webhook.site/. Simply add the webhook URL created by webhook.site to the Payments status changed trigger within WP Webhooks.
4. Summary
If you followed the steps above, you successfully set up your webhook connection and connected the data mapping template. This is everything you need to automatically send data from the Payments status changed trigger to your chosen service.
In case you want to learn more about this setup and others, please visit our documentation.