myparcelnl / woocommerce

MyParcel plug-in for WooCommerce
https://developer.myparcel.nl/nl/documentatie/10.woocommerce.html
MIT License
14 stars 21 forks source link

As a client I want to be able to use a webhook when an order delivery is confirmed. #676

Open DarkAllMan opened 3 years ago

DarkAllMan commented 3 years ago

Is your feature request related to a problem? Nope

Describe the solution you'd like When an order delivery is confirmed, I would like to call a custom function. For example: When an order is delivered, I would like to call the Kiyoh API to send a review request.

Describe alternatives you've considered Current alternative is just to send Kiyoh invites after 4 days of sending the order

Talked about this with Tim Blom on WWV fair.

EdieLemoine commented 3 years ago

Hi @DarkAllMan,

if I understand you correctly, this might work:

You can do this by adding a "Status change" webhook in the general settings in your backoffice. In your callback code, you can check if status is 7 or 13. This will only occur once the order has been delivered.

Info on the webhook payload: https://myparcelnl.github.io/api/#11_B Backoffice settings: https://backoffice.myparcel.nl/settings

Let me know if this works for you. For further support, you can join our Slack channel through the link at the top of the API documentation.

fietserwin commented 1 year ago

Even though tis request is already a bit older, I would like to chime in and reactivate it.

Though adding my own webhook could be a possible solution, I was thinking that "just" adding an action to the webhook handling code of your plugin would be much easier and conceptually cleaner. It leaves handling the intricacies of the webhooks - like setting up endpoints, error handling, etc - to the MyParcel plugin, which it already does, while the custom code can concentrate on handling/using the MyParcel and WooCommerce data for the specific feature it wants to implement

In my case, our joint customer wants, upon the first scan of the package, to send their own e-mail combining your track and trace code and our invoice and it only wants to set the WooCommerce order status to completed on your status delivered.

So, I would like to ask if there's any chance that you will add some actions and/or filters to specific places in your code, or would accept a merge request for it?