Jump to content

For 5.10beta1, Webhooks cache must not exist for incoming webhook to work


Recommended Posts

Posted (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 by John Heenan
clarity
Posted

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.

Posted

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.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...