Integrate Soarenity Blue into your website or application using a secure, modern, and fully automated pipeline.
Questions? support@soarenity.ai
@app.route("/api/blue_v1", methods=["POST"])
def blue_v1_proxy():
"""
Secure proxy for Blue.
Browser → Your Server → Soarenity Blue (with your API key).
"""
from flask import request, jsonify
import requests, os
payload = request.get_json(force=True) or {}
api_key = os.environ.get("BLUE_KEY") # store this safely on your server
if not api_key:
return jsonify({"error": "Blue API key not configured on server"}), 500
try:
upstream = requests.post(
"https://blue.soarenity.ai/api/blue_v1",
headers={
"X-API-Key": api_key,
"Content-Type": "application/json"
},
json=payload,
timeout=30,
)
except Exception as ex:
return jsonify({"error": f"Upstream Blue error: {ex}"}), 502
return (
upstream.content,
upstream.status_code,
{"Content-Type": upstream.headers.get("Content-Type", "application/json")}
)BLUE_KEY=SOAR-XXXXX
<script>
window.SOARENITY_BLUE_ENDPOINT = "/api/blue_v1";
</script>
<script src="https://soarenity.ai/static/js/soarenity_blue_widget.js"></script>
/soarenity_action to perform custom actions.This endpoint runs on your server. Your frontend sends user messages here. Your backend securely forwards the request to Soarenity Blue.
Frontend Request:POST /api/blue_v1
Content-Type: application/json
{
"text": "Show me my orders",
"device_id": "USER_DEVICE_OR_SESSION_ID"
}device_id is a unique identifier for the user or session. Blue stores conversation memory tied to this value.
Response from Blue (forwarded by your server):{
"response": "Here are your recent orders...",
"audio_url": "/static/audio/blue_tts_xxxx.mp3",
"avatar_state": "talking",
"next_action": {
"method": "GET",
"endpoint": "/user/orders",
"params": {}
},
"pending_action": {
"action": "refund_order",
"parameters": {}
}
}
- If pending_action appears, the user must supply missing info.
- If next_action appears, execute it in your backend (or via /soarenity_action).
This endpoint lives on your server. Whenever Blue detects that an action must be executed, it sends the request here.
Action Payload:{"action": "action_name", "parameters": {}}Complete Example Implementation:
@app.route("/soarenity_action", methods=["POST"])
def soarenity_action():
import sys
print("\n--- /soarenity_action CALLED ---", file=sys.stderr)
try:
data = request.get_json(force=True)
except Exception as ex:
return jsonify({"error": "Failed to parse JSON", "detail": str(ex)}), 400
method = (data.get("method") or "GET").upper()
endpoint = data.get("endpoint") or "/"
params = data.get("params") or {}
if not isinstance(endpoint, str):
return jsonify({"error": "Invalid endpoint"}), 400
# Simple navigation
if method == "GET" and endpoint.startswith("/") and params == {}:
return jsonify({"navigate": endpoint})
if method == "GET" and endpoint.startswith("http"):
return jsonify({"navigate": endpoint})
if endpoint.startswith("/"):
endpoint = request.host_url.rstrip("/") + endpoint
try:
import requests
if method == "GET":
resp = requests.get(endpoint, params=params, timeout=12)
elif method == "POST":
resp = requests.post(endpoint, json=params, timeout=12)
elif method == "PUT":
resp = requests.put(endpoint, json=params, timeout=12)
elif method == "DELETE":
resp = requests.delete(endpoint, json=params, timeout=12)
elif method == "PATCH":
resp = requests.patch(endpoint, json=params, timeout=12)
else:
return jsonify({"error": f"Unsupported method: {method}"}), 400
try:
return jsonify(resp.json()), resp.status_code
except:
return jsonify({"raw_body": resp.text}), resp.status_code
except Exception as ex:
return jsonify({"error": str(ex)}), 500
pending_action.pending_action.avatar_state (idle or talking).pending_action, next_action, and your /soarenity_action automation.
blue_app.py,
gpt_service.py, blue_memory.py,
elevenlabs_service.py, and blue_knowledge.py)
are drop-in ready and do not require modification.
blue_action_listener.js (frontend helper) should be customized for your UI.
/api/blue_v1 proxy.
POST /api/blue_v1 <-- your server
Content-Type: application/json
{
"text": "How do I track my order?",
"device_id": "DEVICE_OR_SESSION_ID",
"pending_action": { ...optional... }
}
X-API-Key.X-API-Key when forwarding to Soarenity Blue.device_id scopes state, memory, and context.pending_action only when Blue requests clarification.audio_url will be present when Blue generates speech output.
It may point to a pre-recorded or dynamically generated MP3.
avatar_state.
BLUE_KEY./soarenity_action and any automation endpoints.For developer assistance, action troubleshooting, knowledgebase setup, or advanced automation workflows, email support@soarenity.ai.