OpenAI is a leading organization driving advancements in chatbot technology, revolutionizing natural language processing capabilities and redefining how we interact with AI-powered systems.
Welcome to the OpenAI documentation for Dimension! Integrating Dimension into your OpenAI application is quick and easy.
Obtain OpenAI API Key
- Visit the OpenAI API platform's website and log in to your account.
- Navigate to the "API keys" section in your account settings.
- Click on the "New API Key" button to create a new key.
- Provide a name for your API key to help you identify it later.
- Once created, the new API key will be displayed.
- Copy this key and store it securely.
- Use this API key in your application's Authorization header as Bearer YOUR_API_KEY to authenticate your API requests.
Accessing Data from OpenAI Endpoints
We will focus on two endpoints under their reporting API:
Retrieve message
Endpoint: https://api.openai.com/v1/threads/{thread_id}/messages/{message_id}
Example GET request:
curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v1"
Retrieve thread
Endpoint: https://api.openai.com/v1/threads/{thread_id}
Example GET request:
curl https://api.openai.com/v1/threads/thread_abc123 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v1"
POST responses to Dimension
When your bot receives a message, post the data to the following endpoint:
https://tracker.dimensionlabs.io/track?platform=universal&v=10.1.1-rest&type=incoming&apiKey=API_KEY_HERE
Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE
with your api key.
You must send the data with the following fields:
- text – string – (required)
- userId – string – (required) – should be the SAME userId for both incoming and outgoing messages this is NOT the bot’s user ID
To review all optional fields see our API reference.
The data to POST should pass the following data:
{
"text": "Hi, bot",
"userId": "+14155551234",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
}
Sample cURL
curl -X POST -H "Content-Type: application/json"
-d '{"text":"Hi, bot","userId":"+14155551234","platformJson":{"whateverJson":"any JSON specific to your platform can be stored here"}}'
'https://tracker.dimensionlabs.io/track?platform=sms&v=11.1.0-rest&type=incoming&apiKey=API_KEY'
Notice, you must replace the placeholder API_KEY_HERE
above with your api key.