tingbot / tingbot-python

🔩 Python APIs to write apps for Tingbot
Other
18 stars 9 forks source link

Update webhook class to accept second 'hook_domain' variable #52

Closed gfargo closed 1 year ago

gfargo commented 7 years ago

Goals:

Extend the existing webhook class to accept a second hook_domain variable. This update will allow apps to target and consume content from external webhook servers.

The new variable hook_domain is defaulted to webhook.tingbot.com if it doesn't exist in the webook call.

e.g. all existing apps that use webhooks should be unaffected by this change.

Implementation:

Pass either a Domain or IP as the second parameter to @webhook class constructor

webhook_name = "slackerbot"
webhook_domain = "webhook.custom-domain.com"

######
# Webhook Custom Domain Setup
######
@webhook( webhook_name, webhook_domain )
def on_webhook( data ):
    # do stuff with data!
    return
joerick commented 7 years ago

Hey GFargo! The API for this addition implies that webhooks at multiple servers can be used symultaneously, but internally there's just one connection. Could this be changed to either a module server hostname variable (to be set at the start of a Tingbot app) or actual support for multiple servers internally?