Skip to main content
Version: 3.2.x

Overview

Optave provides two primary methods of integration: REST APIs and WebSocket connections. Both interfaces support the full range of Messages and Superpowers, allowing you to choose the best communication pattern for your needs.

WebSocket API

The WebSocket interface offers:

  • Real-time bidirectional communication
  • Lower latency for continuous interactions
  • Efficient handling of message streams
  • Reduced overhead for multiple requests

REST API

Our REST API is ideal for:

  • Simple request-response patterns
  • Stateless interactions
  • Systems with intermittent connectivity
  • Firewall-restricted environments

Authentication

Sending messages, either via the REST API or the WebSocket API, requires an authentication token.

This token can be obtained by calling the authentication endpoint with your Client ID and Client Secret.

Your base URL

Replace {{tenant}} and {{tld}} with the values provided in your Optave onboarding credentials.

curl
--request POST
--url https://{{tenant}}.oco.optave.{{tld}}/auth/oauth2/token?client_id=your-client-id-here&client_secret=your-client-secret-here \
--header "Content-Type": "application/x-www-form-urlencoded"

A token will be returned in a JSON object:

{
"access_token": "your-access-token-here"
}

This token can then be included in an Authorization header while sending messages:

curl
--request POST
--url https://{{tenant}}.oco.optave.{{tld}}/message/adjust \
--header "Authorization: Bearer your-access-token-here" \
--header "Content-Type: application/json" \
-d '{ payload-here }'
Not using the SDK?

If you are sending WebSocket messages directly without the Optave JavaScript SDK, include "sdkVersion": "none" in the headers of your WebSocket message envelope:

{
"action": "message",
"headers": {
"sdkVersion": "none"
},
"payload": {
"session": { "..." : "..." },
"request": { "..." : "..." }
}
}