I denne artikel:
Background
ScriptIQ provides a JSON API from which transcriptions can be retrieved, instead of receiving them via email etc.
This article explains how to use the API and what to consider when implementing it in your systems.
Authorization
Dstny will create an API token, which must be used when making requests to the API.
The token must be included in an api-x-key header. See the example below.
Base URL:
https://dstny-scriptiq-app-ca-prod.orangebeach-92d3afd1.westeurope.azurecontainerapps.io
Endpoint and Parameters
The endpoint used to fetch transcriptions is: /external/transcriptions
To fetch transcriptions, you must specify a start and end time in the format YYYY-MM-DDTHH:MM:SS (for example: 2025-01-02T03:04:05).
These timestamps are supplied in the query string and are named:
fromDatetimetoDatetime
API Response Content
The API responds with transcriptions within the given time period. The response is an object, with a nested object for each transcription. It contains a text element with the transcription itself, as well as an object with data related to the call:
{
"customer_xyz-1234567-user.name": {
"text": "\u2022 **Participants from Dstny:** Not specified\n\n\u2022 **Summary:** \nThe conversation mainly covered several topics: \n- Activating SIM cards \n- New employee \n- General conversation about the weather",
"recording_data": {
"RecordId": 1234567,
"Call_date": "2025-01-02T00:00:00",
"Call_time": 58366,
"Dest_cli": "",
"Caller_cli": "+4512345678",
"Duration": 379,
"Direction": "O",
"Call_tag": "",
"Extension": "user.name",
"Username": "User Name",
"LookupResult": 0,
"Lookup": 0,
"LookupFlag": 0,
"isEval": 0,
"TenantId": 95,
"StatusId": 1,
"IsBuffer": 0,
"IsPause": false,
"onDemand": false,
"DC_Id": null,
"customerId": "customer_xyz",
"employeeId": "user.name",
"shouldCharge": true
}
},
[...]
}
The content of text is based on the template configured in ScriptIQ, so the formatting may differ significantly from the example above.
recording_data contains details about the call itself, such as:
- Call_date: Date of the call
- Call_time: Time of the call (in minutes)
- Duration: Call duration (in seconds)
- Extension: Username of the user the transcription belongs to
-
Direction: Call direction (
I= inbound,O= outbound,Y= internal inbound,Z= internal outbound)
Eksempel (cURL):
Assuming the API key is abcdef123456789:
# curl -X POST -H "api-x-key: abcdef123456789" "https://dstny-scriptiq-app-ca-prod.orangebeach-92d3afd1.westeurope.azurecontainerapps.io/external/transcriptions?fromDatetime=2025-01-01T00:00:00&toDatetime=2025-01-01T23:59:59"
Example (Python 3 + requests)
Assuming the API key is abcdef123456789:
import json
import requests
API_TOKEN: str = "abcdef123456789" # Provided by Dstny
BASE_URL: str = "https://dstny-scriptiq-app-ca-prod.orangebeach-92d3afd1.westeurope.azurecontainerapps.io"
url: str = f"{BASE_URL}/external/transcriptions"
response: requests.Response = requests.post(
url,
headers={
"api-x-key": API_TOKEN
},
params={
"fromDatetime": "2025-01-02T00:00:00",
"toDatetime": "2025-01-02T23:59:59",
}
)
response.raise_for_status()
print(json.dumps(response.json(), indent=4))
Comments
0 comments
Please sign in to leave a comment.