Using Contact Metrics

Add a contact to orq API calls to report metrics

Prerequisites

Before you can track Contact metrics, you must create a Contact profile. See Creating a Contact.


Using Contact metrics

To track Contact metrics effectively, you have two primary options:

  1. API Direct Usage:
    When using the API directly, you can attach the contact ID through the request headers.
  2. SDK Implementation:
    We strongly recommend using our SDKs, as they provide a more streamlined approach to tracking contact metrics.
curl 'https://api.orq.ai/v2/deployments/invoke' \
-H 'Authorization: Bearer {apiKey}' \
-H 'X-ORQ-CONTACT-ID: <external_id>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
   "key": "<deployment_key>",
   "context": {
      "environments": []
   }
}' \
--compressed
import { Orq } from "@orq-ai/node";

const client = new Orq({
  apiKey: 'orq-api-key',
  environment: 'production',
  // Optionally initiate the contactId for the session
  contactId: '<contactId>'
});
import os
from orq_ai_sdk import Orq

client = Orq(
    api_key=os.environ.get("ORQ_API_KEY", "__API_KEY__"), 
    environment="production",
    contact_id="<contact_id>"
)

📘

Developers, please see the API Reference for further explanation.