All About the "Webhooks" Feature
All About the "Webhooks" Feature
Introduction
SimplyPrint Webhooks is a powerful tool that enhances the interactivity and integration capabilities of our platform. This feature allows users to receive real-time notifications about events occurring within SimplyPrint, making it easier to synchronize data and automate responses in external systems.
Disclaimer: This is an advanced feature.
What are Webhooks?
Webhooks are user-defined HTTP callbacks, which are triggered by specific events in SimplyPrint. When one of these events occurs, SimplyPrint sends an HTTP POST request to a URL specified by the user. This allows for seamless integration with external services and custom applications, enabling real-time data sharing and automated actions.
Setting Up a Webhook
Setting up a webhook is straightforward:
Go to Settings > Webhooks
Click "Create webhook"
Fill out the information.
Test the webhook by triggering a test event.
Types of Events You Can Subscribe To
You can set up webhooks for a variety of events, including:
- Print Job statuses: Get notified when print jobs are started, finished, paused, resumed and more.
- Printer information changes: Get notified when a printer's material, nozzle size, custom tags and more are updated.
- Print Farm-wide events: Get notified when AutoPrint is enabled, disabled, and more.
- More to come!
Secret token
The secret token is an optional token that can be set by the user when creating a new webhook.
You choose the value, and it is important to keep it secure, such that malicious actors cannot impersonate SimplyPrint.
If a secret token is set, we send this token with each webhook payload such that you can verify that the HTTP request originates from SimplyPrint.
The secret token is sent in the X-SP-Token header.
Payload format
Webhooks are sent as JSON data, with the following format:
Field | Type | Desc |
---|---|---|
webhook_id | int | The id of triggered webhook |
event | string | The event that was triggered |
timestamp | int | Unix timestamp |
data | object | Data attached to event |
An example of a webhook payload can be seen here:
{
"webhook_id": 123,
"event": "job.started",
"timestamp": 1702659274,
"data": {
"job": {
"id": 123456,
"uid": "73a90bde-829e-4b7f-ab2b-7be475633144",
"panel_url": "https://simplyprint.io/panel/jobs/73a90bde-829e-4b7f-ab2b-7be475633144",
"started": 1702659274,
"ended": null
},
"user": {
"id": 1234,
"first_name": "John",
"last_name": "Doe"
}
}
}
Use Cases and Integration Ideas
- Automated Reporting: Integrate with your reporting tools to generate real-time reports on print jobs.
- Data Synchronization: Keep your inventory or project management tools in sync with your print jobs.
- Triggering of external bed clearing hardware on print job end.
Updated on: 06/03/2024
Thank you!