The Solve API provides programmatic access to our Solve product functionality, allowing customers to build their own bots, automate workflows, and enhance their help center search capabilities. For more information, see Solve API Developer Reference.
You will need an API key to use the Solve API, which can be found at Solve > Configuration > API.
For demonstration purposes, we have created an intent called Troubleshooting Entry Point in the API channel. You can trigger this intent using the following example (don't forget to use the API key as the Bearer Token):
POST https://app.forethought.ai/solve/api/v1/conversation
Body:
{
"context_variables": {},
"is_preview": false,
"query": "I am seeing an error",
"stream": false
}
Once you have triggered the intent, you can use another API to create a pre-signed URL for AWS S3. For example, to upload an image file named “windows_error.png”, you can use the following API:
POST https://app.forethought.ai/solve/api/v1/conversation/{conversation_id}/upload-file
Body:
{
"file_name": "windows_error.png",
"should_generate_download_link": true
}
Example response:
{
"presigned_post": {
"url": "https://forethought-us-west-2-production-solve-conversations.s3.amazonaws.com/",
"fields": {
"key": "728/3d9d7c96-06b9-4de9-a221-36003dda47ad/windows_error.png",
"AWSAccessKeyId": "ASIARL4HYSAXCTZN3UPQ",
"x-amz-security-token": "IQoJb3JpZ2luX2VjEPL",
"policy": "eyJleHBpcmF0",
"signature": "rleR51Pjqu1DUtsof6OwbIX+zTs="
}
},
"temp_file_download_link": "https://forethought-us-west-2-production-solve-conversations.s3.amazonaws.com/728/3d9d7c96-06b9-4de9-a221-36003dda47ad/windows_error.png"
}
Now we can use this info to upload the image to Forethought’s AWS s3:
Another example is here: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html
Finally, you can send the temp_file_download_link back to the Solve API to continue the workflow execution. If you have more than one attachment to upload, you will need to repeat the file upload steps and collect all the temporary file download links.
PUT https://app.forethought.ai/solve/api/v1/conversation/{conversation_id}