Skip to main content

Make No Code Dashboards from WebHooks

💭 Would you like to go over this topic with an instadeq specialist?

📅 Book a Call Free of Charge

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.

If you are sending JSON data and want to display it as a table directly you must send it in one of the Supported JSON Table Formats.

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
import urllib.request
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

let url = '<webhook-url-here>';
let body = JSON.stringify([{type: "price", value: 42}]);
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)

Send data from R Dataframes using the httr

library(httr)

body <- '[{
  "name" : "CA",
  "value": 10
}, {
  "name" : "NY",
  "value": 15
}]'

#send data to Instadeq
r <- POST('<webhook-url-here>', body = body, encode = "json")

#Response Status must be 200
print(r)

For more examples, check Create Dashboards using R

💭 Would you like to go over this topic with an instadeq specialist?

📅 Book a Call Free of Charge

Resources