Connect your NLP models to tagtog using webhooks

  • What is a webhook
  • How to connect your model to tagtog (or other services) using webhooks
  • How to test webhooks locally
  • How using webhooks will make the training of your model more accessible

First of all, what is a webhook?


  • Import new document: a notification is sent once a user uploads a document. Use this notification, for example, to annotate the document using your models and push the annotated document back.
  • Save a document: a notification is sent once a user saves a document. Use this notification, for example, to get the annotations done by your team and add them to your training data.

An example

  1. A non-technical user uploads a document to their project
  2. Our app receives a notification, annotates this document and, push it back
  3. The document is shown annotated to the non-technical user
# Create the virtual environment myenv
# Python 3.3+
$ python3 -m venv myenv

# Activate the virtualenv (OS X & Linux)
$ source myenv/bin/activate
$ pip install Flask
$ pip install -U pip setuptools wheel
$ pip install -U spacy
$ python3 -m spacy download en_core_web_sm
from flask import Flask
app = Flask(__name__)

def hello():
return "Hello, World!"

if __name__ == "__main__":
$ python3
  1. Get the document’s content using the document ID coming within the POST event notification.
  2. Annotate the text using the model and transform the spaCy annotations into the ann.json format.
  3. Push the annotated document back
$ ./ngrok http 5000
  1. Endpoint URL: write here the forwarding URL provided by ngrok
  2. Payload format: select tagtogID to send the document's ID as a result of an event. You can choose ann.json if you prefer to receive the annotations of the document instead of the ID.
  3. Trigger only if change originates in the GUI: yes, we want to send an event notification only when the user uses the web app (not the API).
  4. Authentication: in this example, we don't use any authentication mechanism, meaning our app doesn't require an authenticated request.
From the moment you save the webhook, an event notification is sent to the endpoint URL as a result of an event
Just import some text, and it gets automatically annotated

Other use cases

  • Document review: the end-user uploads a document (e.g., PDF), your model annotates the document, and push it back annotated, helping the user to complete the review.
  • Let your domain experts train your model: the end-user uploads text to tagtog, your model annotates the text, and push it annotated. The domain expert corrects the required annotations, and your model receives this feedback to train itself further.




The text annotation platform to train #NLP. Easy.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Getting Started with MySQL and Python

What does the interpreter actually do?

Step by Step: How to become MySQL replication functional without stopping master at Planeta Huerto

An Intro to Features

Let’s Build: A Consultancy Website — Part 31

Go from spreadsheet woes to powerful prose with this content calendar solution

Where to learn Java online

Days 19/20 — LinkedIn, Projects, and APIs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


The text annotation platform to train #NLP. Easy.

More from Medium

Detection and Normalization of Temporal Expressions in French Text (1) — Build a Dataset

Term Frequency & Inverse Document Frequency : TF-IDF in NLP

Laplace Smoothing

About Natural Language Processing — NLP