guide
- Get started
- Label Studio features
- Billing & Usage
- Release notes
Security and Privacy
- Secure Label Studio
Install and Upgrade
- Install and upgrade Label Studio
- Database setup
- Start Label Studio
- Troubleshooting
Deploy and Install Enterprise
- Install Label Studio Enterprise
- Set up persistent storage
- Set up an ingress controller
- Install with Docker
- Deploy on Kubernetes
- Install on airgapped server
- Install on Amazon EKS
- Available Helm values
Manage Users
- Set up user accounts
- Manage access
- Set up authentication
Import Data
- Import data
- Import pre-annotations
- Cloud storage setup
Labeling and Projects
- Project setup
- Manage data
- Set up your labeling interface
- Label and annotate data
Manage Annotations
- Review annotations
- Annotation statistics
- Custom agreement metric
- Export annotations
Machine Learning Setup
- Machine learning integration
- Write your own ML backend
- ML Examples and Tutorials
- Active learning loop
- Troubleshoot machine learning
Integrations
- Webhook Setup
- Webhooks Event Reference
- Custom Webhooks
- Python SDK Tutorial
- Backend API
Advanced Development
- Frontend library
- Frontend reference
- Update scripts and API calls
Create custom events for webhooks in Label Studio
If you want to trigger custom events for webhooks in Label Studio, you can extend the webhook event model.
Create a custom webhook event
To create a custom webhook event, add your own action to the WebhookActions
model.
For example:
class WebhookAction(models.Model):
...
SOMETHING_HAPPENED = 'SOMETHING_HAPPENED'
...
ACTIONS = {
SOMETHING_HAPPENED: {
'name': _('Something happened'),
'description': _("A thing happened. We wanted to let you know."),
'key': 'something',
},
...
...
After declaring the action and the associated properties and payload details in the WebhookAction
class, call the event action in the code where it occurs. For example:
...python
result = do_something()
emit_webhooks(organization, WebhookAction.SOMETHING_HAPPENED, {'something': [result]})
...
You can retrieve the organization details using Organization.objects.first()
.
Call event actions with Python functions
There are several functions you can use to call event actions. Refer to the following table:
Python function | When to use | Additional details |
---|---|---|
get_active_webhooks() |
Get all active webhooks. | |
run_webhook() |
Run one webhook and pass some payload. | |
emit_webhooks() |
Send requests for all webhooks for an action. | |
emit_webhooks_for_instances() |
Send serialized instances with webhook requests. | You must declare a serializer in the WebhookAction.ACTIONS model. |
Call event actions with decorators in API source code
You can use decorators with the CRUD REST methods to send event actions to webhooks. You can use the following:
Decorator syntax | When to use | Details |
---|---|---|
@api_webhook() |
POST /PUT /PATCH requests |
Expects a response with an id and uses the .get_object() function after the request to send that information. |
@api_webhook_for_delete() |
DELETE |
Sends only the id field after a successfully delete operation. |
Couldn't find what you were looking for? Please let us know on
Slack
If you found an error, you can file an issue on GitHub!

If you found an error, you can file an issue on GitHub!