ConnectorWebhooks


Webhooks.

- This class is used to create, edit, delete, display company webhooks.
- To attach webhook to some event, processes are used; similar how it is for all the usual processes.
Please, refer to WorldsoftBusinessSoftware\BackendCore\Wbs\Process\Logic class
- All processes are triggered after event with WorldsoftBusinessSoftware\BackendCore\Wbs\Process@scheduleAllProcesses method
- Task is scheduled and executed in queue with WorldsoftBusinessSoftware\BackendCore\Wbs\Queues\TaskQueue@run
- Webhook method is triggered if process is set up: WorldsoftBusinessSoftware\BackendCore\Wbs\Company\Webhook@send

- Related data is sent to webhook url (POST).
Data is sent as "json" or "form" (based on webhook setting)

- Additional header is added to request: "X-Wbs-Signature".

This header contains hashed message, which can help to verify sent data.
Format of the header: "sha1=HASH"
HASH is sha1 hash of body and secret key (secret key from webhook setting)
(please, refer to WorldsoftBusinessSoftware\BackendCore\Wbs\Company\Webhook@getDefaultConf)

Using received data and secret key, it is possible to verify that data was not altered, example:

$received_data = json_encode(app('request')->all());
$secret_key = '1234567890'; // Webhook secret key
$hash_string = 'sha1=' . sha1($received_data . $secret_key);

if(Request::header('X-Wbs-Signature') === $hash_string) {
// ok
}

Functions
getall
all
get
add
set
delete
changelog
search
getComments
getComment
addComment
updateComment
deleteComment
getTableStructureData