Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Create a webhook

res = po_client.request("post", "/api/webhooks", **{

"app_id": 4, # 4 is fine

"event": "product.update", # product.update/product.create/product.delete/customer.create/customer.delete/customer.update/transaction.closed

"action": {

"action": "request",

"method": "post",

"integration_setting_id": 123124, # use any unique value for now - used to identify which webhook belongs to what addon

"timeout": 5000,

"url": "http://localhost:6544/events",

"data": { # skip it if you don't need to receive anything except product od

# - optional

"custom_field": "product.update"

},

"headers": { # skip it if you don't need any special headers in the url

"custom_header": "123"

}

}

}, use_json=True)

Response:

{'action': {'action': 'request',

'data': {'custom_field': 'product.update'},

'headers': {'custom_header': '123'},

'integration_setting_id': 123124,

'method': 'post',

'timeout': 5000,

'url': 'http://localhost:6544/events'},

'app': {'id': 4, 'name': 'Cash Register'},

'app_id': 4,

'event': 'product.update',

'id': 158}

  • No labels