Hooks

Hooks are scrips which are triggered by HTTP requests. When your hook is active, any HTTP request sent to https://hooks.abstra.cloud/DOMAIN/HOOK-PATH will trigger the execution of the script.

How to get the request

To access the request data you have to use our builtin utils function get_request:

Function signature

def get_request(**kwargs):

Keyword Arguments

local_file (string)
fallback file location for testing locally

Returns

(parsed json or string)body parsed according to content-type header(dict)query(dict)headers

How to send the response

To send the response you have to use on of our builtin utils functions send_response or send_json:

Function signature

def send_response(**kwargs):

Keyword Arguments

body (string)
plain text response body
status_code (number)
http response status code
headers (dict)
headers to be sent back
local_file (string)
fallback file location for testing locally

Function signature

def send_json(**kwargs):

Keyword Arguments

data (any serializable value)
data to be serialized and sent back
status_code (number)
http response status code
headers (dict)
headers to be sent back, in addition to content-type: application/json
local_file (string)
fallback file location for testing locally