Python examples

Here is calling API example :

#register global web hook for All operations

url = api_url+"/wep/webhooks"

payload = {'method':'POST',

headers = {
    "api-version": "1.0",
    "x-api-version": "1.0",
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer "+token

response =, json=payload, headers=headers, verify=False)

data = response.json()
id = str(data["id"])

url = api_url+"/wep/webhooks/"+id+"/test"

headers = {
    "api-version": "1.0",
    "x-api-version": "1.0",
    "authorization": "Bearer "+token

response = requests.get(url, headers=headers, verify=False)


Here is example of receiving and validating webhooks (Python3/Flask)

from flask import Flask, request, abort  
import hmac  
import hashlib  
import base64

app = Flask(**name**)

WORKLIO_WEBHOOK_SECRET = '...returned from API call...'

def _verify_webhook(data, hmac_header):  
        digest ="utf-8"), data, hashlib.sha256).hexdigest()
    return hmac.compare_digest(digest, hmac_header)
@app.route('/', methods=['POST'])  
def hello_world():  
    print('Received Webhook...')
data = # NOT request.get_data() !!!!!
hmac_header = request.headers.get('WEP-Sign')
verified = _verify_webhook(data, hmac_header)

if not verified:
    return 'Integrity of request compromised...', 401

print('Verified request...')

if **name** == '**main**':