Run automation
Webhooks
Get a call to your server when a job finishes or a phone needs attention.
Set a webhook
A key can have a webhook URL; set it when you create the key. Events for the key's phones arrive as a POST with a JSON body {"event", "ts", "phone", "job" | "incident"}.
Events
| Event | When |
|---|---|
| job.finished | A start, stop, restart, install or group job finished. |
| health.problem | A phone's health check failed. |
| health.resolved | The problem cleared. |
Verify the signature
Each request carries X-Clousd-Signature: the hex HMAC-SHA256 of the raw body, keyed with the hex SHA-256 of your API key.
Python
import hashlib, hmac
def valid(body: bytes, signature: str, api_key: str) -> bool:
secret = hashlib.sha256(api_key.encode()).hexdigest().encode()
return hmac.compare_digest(hmac.new(secret, body, hashlib.sha256).hexdigest(), signature)Retries
Delivery is tried three times: at once, after 10 seconds and after 60 seconds, each with a 10 second timeout. Answer with any 2xx to confirm.