⚡️ Webhooks

You can push data to Tingbot using webhooks.

Here is an example that displays SMS messages using If This Then That. See our tutorial video to see how to set up IFTTT with webhooks.

import tingbot
from tingbot import *

screen.fill(color='black')
screen.text('Waiting...')

@webhook('demo_sms')
def on_webhook(data):
    screen.fill(color='black')
    screen.text(data, color='green')

tingbot.run()
@webhook(webhook_name…)

This decorator calls the marked function when a HTTP POST request is made to the URL http://webhook.tingbot.com/webhook_name. To avoid choosing the same name as somebody else, you can add a random string of characters to the end.

The POST data of the URL is available to the marked function as the data parameter. The data is limited to 1kb, and the last value that was POSTed is remembered by the server, so you can feed in relatively slow data sources.

You can use webhooks to push data to Tingbot, or to notify Tingbot of an update that happened elsewhere on the internet.

Hint

IFTTT is a great place to start for ideas for webhooks. Slack also has native support for webhooks!