Fabrik & Webhook

sunnyjey

Active Member
I am trying to fetch and process the inbound data from the third party App & create new row in Fabrik List. But no idea to do it. Would be grateful if someone guides me to achieve it.

I guess first we have to create mywebsite.com/webhook.php & place third part code like:

PHP:
const WEBHOOK_SECRET = 'webhook secret key';
function verifySignature ($body, $signature) {
    $digest = hash_hmac('sha1', $rawPost, WEBHOOK_SECRET);
    return $signature !== $digest ;
}
if (!verifySignature(file_get_contents('php://input'), $_SERVER['HTTP_MY_APP_SIGNATURE'])) {
    // verification failed
}
// verification success

I really dont know how to proceed further & integrate Fabrik to process inbound data.
 
If you only need the data you can write directly to the database table.

If you want Fabrik form functionality you can turn "Spoof check" off in form settings
http://fabrikar.com/forums/index.php?wiki/forms/#form-processing
In this case copy the list and set very restrict access settings.
You can add a php form plugin onload for checking e.g. an additional secret in your params (if not set echo some error and exit)
You can add a php form plugin onAfter to echo some result (e.g. a JSON with data)

Then you can call the form via POST, something like
Code:
        $url = 'https://your-domain/index.php?option=com_fabrik&task=form.process&formid=9';

        $postarray =    array(
                 'table___element1' => $fname,
   ...
                'postPassw' => 'yourSecret'
            );

        $postdata = http_build_query($postarray);
            $opts = array('http' =>
            array(
                'method'  => 'POST',
                'header'  => array(
                    'Content-type: application/x-www-form-urlencoded;charset=utf-8',
                    ),
                'content' => $postdata
                )
        );
        $context  = stream_context_create($opts);

        $result = file_get_contents($url, false, $context);

It's up to you to ensure correct user authentication, session handling etc.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top