Habitica provides "webhooks" for certain actions that can occur in your account (for example, when you complete a task or when someone posts a message in a Guild that you belong to). A webhook will be triggered when such actions occur and it will send information about the action to a script or other tool on another website.

You can specify which scripts should receive information from Habitica's webhooks by logging in to Habitica's website and going to User Icon > Settings > API.

Specifying an incorrect URL can cause errors or slowness in Habitica so it's best to not use this feature if you are unsure how webhooks work.

More information is available in the Webhooks section of Habitica's API Documentation. If you need help with developing a script that responds to a webhook, ask for advice from other developers in the Aspiring Comrades guild.

If you wish to gain recognition for your webhook development, please see Guidance for Comrades for more information.


Python Flask ExampleEdit

The following script uses Python Flask to implement handling for webhooks. The URL that you enter into Habitica's website should look like: http://<your_ip>:<your_port>/taskevent

Flask listens on port 5000 by default, but you can specify a different port where indicated by <your_port>

If your script is hosted behind a firewall you may need to use port forwarding or allow access to the port through the firewall.

from flask import Flask, request
app = Flask(__name__)
  # URI for receiving inbound webhook request
@app.route('/taskevent', methods=['POST'])
def webhook():
    # Request contains data as shown at
     # .json converts request to Python dictionary
    print(request.json)  # type: dict
    return '', 200 # Return 200 code to the sending webserver
if __name__ == "__main__":'', port='<your_port>')

Third-Party Tools for WebhooksEdit

Currently, Habitica's own interface for creating and editing webhooks is limited, however Habitica's API provides more control, which means that third-party tools can be used to help you set up webhooks, such as the one listed below. The Extensions, Add-Ons, and Customizations page may list others. As with any third-party tool, you should carefully assess whether they are suitable for you to use. Habitica's staff do not support the tools directly or vouch for them.

Community content is available under CC-BY-SA unless otherwise noted.