- You need to have a valid client secret and client id to access the OpTech API. These are available here OpTech API
- Once you have these add to your environment:
OPTECH_CLIENT_ID=xxxxxxxxxx
OPTECH_CLIENT_SECRET=xxxxxxxxxxxOur API is available at https://api.optech.ai/ingest and you can use it to respond to data requests from the OpTech platform.
To allow this you'll need to configure a single endpoint on a server you own. This endpoint will be used to receive data requests from the OpTech platform. There is no requirement on
path format, but the request will always be a POST request with a JSON body as follows.
{
// the unique url to return the data to - only valid for 10 minutes after the request / and relevant if using an async flow
"link": "https://api.optech.ai/ingest/<id>",
// data requests from the OpTech platform
"key": "value",
"inputs": {
"key1": "value1",
"key2": "value2"
}
}The request will also have the following headers:
x-optech-signature: <signature> // verify the request is from OpTech
content-type: application/json // the content type of the requestYou should respond to this request with a JSON object containing the data you wish to send back to the OpTech platform. The format of this response should be as follows:
{
"data": {
"key": "value",
"key2": "value2"
}
}You can respond immediately with a body response and 200 or you can respond with a 202 status code and respond later. If you respond later you should respond
within 10 seconds for low latency experiences like chat or within 10 minutes for email.
If responding async you will need to include the following headers in your response.
x-optech-signature: <signature> // a signature generated using OPTECH_CLIENT_SECRET from the `body` of your response.
content-type: application/json // the content type of the request
authorization: Basic OPTECH_CLIENT_ID // client idSee the example implementation for a simple example of how to integrate with the OpTech API.
Add the following to your .env file:
OPTECH_CLIENT_ID=xxxxxxxxxx
OPTECH_CLIENT_SECRET=xxxxxxxxxxxThen run the following commands:
npm install
npm run dev