Community
How to automatically download event video when Samsara webhook is triggered
Hi community
Iβm building an internal automation where our Django server receives Samsara event webhooks (e.g., harsh braking, distracted driving, etc.). The webhook payload includes a video link for the event.
π What I want:
As soon as the webhook hits my Django API, I need to automatically download the video from Samsara (so we can later send it to our Telegram bot and archive it).
Currently:
- I have set up the webhook endpoint in Django.
- I can receive the JSON payload successfully when an event happens.
- The payload has something like "incidentUrl": "https://cloud.samsara.com/o/7002595/fleet/workflows/incidents/...".
Problems / Questions:
What is the correct way to authenticate and download the video file once I get the URL from the webhook? Do I need to call another Samsara API first?
Is there a recommended workflow for downloading videos (e.g., should I queue the download in Celery to avoid blocking the webhook response)?
How long are these event videos stored/available on Samsaraβs servers? Do I need to download them immediately?
Any Python/Django code examples for securely downloading videos from Samsara API would be really helpful.
Basically, my pipeline should be:
Webhook β Django β fetch video β save locally β forward to Telegram group.
Has anyone here implemented this before, or can share best practices / pitfalls?
Thanks! π