Skip to main content

Make No Code Dashboards from WebHooks

What is a WebHook?

A Webhook in Instadeq is a unique URL that maps to a channel, when an external system does an HTTP POST request to that URL the data in the request body will appear in the associated channel.

With WebHooks you can automatically update dashboards by sending new data to a URL using an HTTP client library in your language of choice, you can even send data from the terminal using a tool like curl or wget.

How to Send Data to Instadeq Using WebHooks

Send a file from the shell with wget

If you want to send a file called sales.json from the current directory to instadeq:

# replace $HOOK_URL below with the corresponding instadeq hook URL
wget -q -O- $HOOK_URL --post-file sales.json

Send a file from the shell with curl

If you want to send a file called sales.json from the current directory to instadeq:

# replace $HOOK_URL below with the corresponding instadeq hook URL
curl $HOOK_URL --data-binary @sales.json

Send data from Python 3 using the urllib module from the standard library

Import urllib:

import urllib
def send(url, body):
    "HTTP POST url body"
    req = urllib.request.Request(url, data=body)
    return urllib.request.urlopen(req)

Note that body must already be encoded, if you are sending json use json.dumps, a simple example:

With Python Data Structures

import json

url = "<webhook-url-here>"
body = json.dumps([{"type": "price", "value": 42}]).encode('utf-8')

send(url, body)

With Pandas Data Frames

If you have a Pandas DataFrame:

body = pandas_data_frame.to_json(orient="records").encode('utf-8')

From Google Colab or Jupyter Notebooks

Send data from deno using the fetch function from the standard library

fetch(url, {method: 'POST', body});

Send data from nushell using the post command

If you want to send a file called sales.json from the current directory to instadeq:

# replace $url below with the corresponding instadeq hook URL
post $url (cat sales.json)

Resources