APIs & Integrations
Integration Examples
End-to-end walkthroughs connecting Optra to common enterprise systems.
These examples walk through complete integration scenarios — from authentication through to handling real-time data in your own systems.
ServiceNow — Auto-create Incidents from Alerts
When an Optra rule triggers (e.g. a device goes offline), automatically create a ServiceNow incident:
- Create an Optra webhook subscribed to the
rule.triggeredevent. - Point the webhook URL at a lightweight middleware or serverless function.
- The function maps the Optra payload to the ServiceNow Incidents API and POSTs the incident.
// Middleware (Node.js / Express)
app.post('/optra-webhook', (req, res) => {
const { event, device } = req.body;
if (event === 'rule.triggered') {
await serviceNow.incidents.create({
short_description: `Optra alert: ${device.name}`,
category: 'Hardware',
cmdb_ci: device.serial,
});
}
res.sendStatus(200);
});
Azure Event Hubs — Stream Telemetry
Forward all telemetry to Azure Event Hubs for downstream analytics pipelines:
- Create an Optra webhook subscribed to
telemetry.threshold. - In your handler, publish the payload to an Event Hub using the Azure SDK.
- Consume events downstream with Azure Stream Analytics or Databricks.
from azure.eventhub import EventHubProducerClient, EventData
import json
producer = EventHubProducerClient.from_connection_string(
os.environ["EVENT_HUB_CONN_STR"],
eventhub_name="optra-telemetry"
)
def handle_webhook(payload):
batch = producer.create_batch()
batch.add(EventData(json.dumps(payload)))
producer.send_batch(batch)
Salesforce — Sync Device Fleet as Assets
Keep Salesforce Asset records up to date with the Optra device registry:
- On a schedule (or via
device.registeredwebhook), fetch new devices fromGET /devices. - Upsert a Salesforce Asset record using the device serial as the external ID.
- Update the Asset
Statusfield based ondevice.statuschanges.
Slack — Send Alert Notifications
Post a Slack message to a channel whenever a critical rule fires:
// Using Slack's Incoming Webhooks
async function notify(device, rule) {
await fetch(process.env.SLACK_WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: `⚠️ *${rule.name}* triggered on *${device.name}* (${device.serial})`,
}),
});
}