John Heenan Posted April 27, 2024 Report Posted April 27, 2024 (edited) Blesta: 5.10beta1 PHP: 8.2.17 OS: Debian (stable, bookworm) Attached is a zip file of a plugin called webhhook_incoming_example, link webhooks_incoming_example.zip, that can be used to demonstrate an incoming webhook. Problem is the webhook only works ONCE after the webooks cache has been deleted, such as with command: rm cache/?/plugins/webhooks/* After calling once the cache is recreated and just an empty answer is returned, while the cache exists. This suggets there is a Webhooks cache bug. Whatever is recorded and read back from the cache is not reconstructed to its original pre saved form. If an oncoming GET webhook has been setup with callback 'webhooksexampleadd', then the following URI path can be used to add two integers a and b with values 1 and 2: /admin/plugin/webhooks/trigger/index/webhooksexampleadd?a=1&b=2 The answer after cache is deleted is returned as {"__return__":{"a":1,"b":2,"c":"a (1) + b (2) = c (3)"},"a":1,"b":2} The answer, until cache is deleted again is [ ] There is more information with images in topic at Edited April 27, 2024 by John Heenan clarity Quote
John Heenan Posted April 27, 2024 Author Report Posted April 27, 2024 The name of the event to form an incoming callback for in Webhooks is WebhooksIncomingExample.add The cache has to be deleted twice: once to even view the event to register the callback, a second time to successfuly obtain a result (with repeat deletion). More informration in topic linked to in above post. Quote
John Heenan Posted April 28, 2024 Author Report Posted April 28, 2024 Both GET and POST for incoming webhooks works. POSTJSON for incoming webhook does not work without alteration of source code as the incoming JSON parameters are passed as a class object, not an array. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.