gplcart/webhook

Allows to inform external resources about various system events by sending HTTP POST payloads

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

Type:gplcart-module

dev-master 2018-03-10 14:51 UTC

This package is not auto-updated.

Last update: 2024-12-21 21:20:14 UTC


README

Build Status Scrutinizer Code Quality

Web Hook is a GPL Cart module that allows to inform external resources about various system events by sending HTTP POST payloads

Features:

  • Configurable triggering hooks
  • Configurable payload URL
  • Data encryption

Requirements:

  • CURL

Installation

  1. Download and extract to system/modules manually or using composer composer require gplcart/webhook. IMPORTANT: If you downloaded the module manually, be sure that the name of extracted module folder doesn't contain a branch/version suffix, e.g -master. Rename if needed.
  2. Go to admin/module/list end enable the module
  3. Go to admin/module/settings/webhook and adjust settings

Receiving payloads

Example settings:

In webhook.php paste the following code

if(isset($_POST['sender']) && $_POST['sender'] === 'My cool site'){
	
	$json = $_POST['data'];
	
	if($_POST['encrypted']){
		$secret = hash("sha256", 'My secret key');
		$hash = substr(hash("sha256", 'My salt'), 0, 16);
		$json = openssl_decrypt($json, "AES-256-CBC", $secret, 0, $hash);
	}

	$payload = json_decode($json, true);
	print_r($payload);
}