Skip to content

This script has essential implementations that helps the bot function.


Enables webhook with the platform/service (like Dialogflow or Facebook Messenger). The request data is fetched (in JSON) and used by other functions. The GET method does not have any use but rather redirects users that navigate to url+"/webhook".

>>> import requests
>>>"webhook/", headers={wb_arg_name: webhook_token})
<Response [200]>

>>> requests.get(app_url+"webhook/").url


Registers users to the application by verifying login credentials and adding them in the database. In-registration users are distinguished using a reg_id attribute in their data.

>>> import requests
                  data={"uni_id": "random_id", "uni_pw": "random_pass"}).url

user_gateway(request_data, uid)

Acts as a gateway for all messages before understanding intents and user attributes by enabling login-integrity and fetching data from the database.

>>> user_gateway({"queryText": "hi there"}, "1234567890")
APP: 1234567890 logging in again.
Hey there!
Parameters Returns
request_data: the POST request dictionary
uid: the unique sender ID of the user
str: the response
None: if response is not handled by app