Support » Plugin: WP Webhooks » Sending data on Custom Post Type Update

  • We want to send following data using webhook when a custom post type is updated. Is it possible with this version? With Pro?

    {
    “email”: “post type custom field”,
    “phone”: “+123456789”,
    “post_author”: 123,
    “ID”: 123,
    “post_name”: “post_name value”,
    “post_type”: “post_type value”,
    “post_status”: “post_status value”
    }

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ironikus

    (@ironikus)

    Hey @chiragagarwal – thank you a lot for your message.
    I’m not sure where exactly you store the email and the phone number, but in case these are meta values or taxonomies, yes, you can send all of this information over as well with the free version.

    The only thing you should check is if you need the exact structure of the payload as given in your example. For this one, you need some kind of data mapping, but if you use Zapier, Integromat or anything else, you won’t run into any issues with the payload we send over in the first place. 🙂

    Thanks for quick reply @ironikus

    Both this info are available as Meta values, however, the meta key is different on WP custom post from what the receiving system is expecting in the payload.

    The payload should include “email” and “phone” as data, and other fields are customizable.

    Can you guide on how we can achieve with your plugin?

    Here’s a screenshot for reference: https://ibb.co/dWDQB8P

    Plugin Author Ironikus

    (@ironikus)

    Hey @chiragagarwal – thank you for your answer.

    I got your point. To make this work, you have a couple of possibilities. I will explain the, down below so you can choose what suits you the best.

    1. Using a third-party service like Zapier/Integromat
    These apps allow you to map the data as you need it for your endpoint. We offer custom apps for these two services specifically, so feel free to use them as well. The disadvantage of this option: These services are limited in their free version.

    2. Use the Data Mapping feature of our Pro version
    Our Pro version offers a feature that allows you to manipulate the payload data (JSON) we send out for every trigger. This way, you can make the mapping directly within our plugin.
    Here are some links for further details on that:

    3. (Advanced): Use the WordPress filter hook
    We offer a custom filter hook that allows you to manipulate any data we are going to send out. This way, you can create the mapping very simply within PHP with some few lines of code. Here is the definition of the filter:
    $data = apply_filters( 'wpwhpro/admin/webhooks/webhook_data', $data, $response, $webhook, $args, $authentication_data );

    4. (Advanced) Use the “Send Data On Custom Action” trigger
    This trigger allows you to send your very own data (in your very own format) to your given webhook URL’s. This allows you full flexibility over whatever you send. The disadvantage is that you need to write your own function that fires the trigger whenever a custom post type is updated.

    We also have a web-view of our plugin available that helps you to share the details about our plugin easier: https://wp-webhooks.com/

    If you have further questions, feel free to ask at any time.

    • This reply was modified 2 months, 2 weeks ago by Ironikus.
    chiragagarwal

    (@chiragagarwal)

    Thanks @ironikus for the ideas – finally bought the Pro version yesterday and I was able to set up Data Mapping Templates and get this working.

    However, one thing I haven’t been able to understand is why 2 or 3 requests are fired when the post is updated, instead of just firing 1 time.

    Can you suggest a way to investigate this? Not sure where to start.

    Plugin Author Ironikus

    (@ironikus)

    Hey @chiragagarwal – thank you a lot for your message, as well as for supporting our plugin! 🙂
    The issue you describe usually happens if a third-party plugin re-saves the post within their own code.
    That’s why you usually see multiple webhook calls from one post.
    If you want to avoid that, we have one logic in place that helps you with it.
    Within the settings of the webhook URL, you added to the trigger, you will find a setting that lets you fire the webhook only once on a post-status change. If you set it to the post status you want to fire it on, the webhook will only fire once.
    I hope this makes sense so far.
    If you have further questions regarding that, feel free to let me know.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.