Take a taste here: https://iamai.page/
Full docs here: https://iamai.page/#/docs
Let’s start with the request. A request takes these properties:
question (required): string
The question to be answered. It should be a string type.
consent (required): boolean
The user’s consent on how to handle their privacy. This will prevent questions like “Where am I?” or “How’s the weather today” from being answered as it will not allow the bot to get the location of the user.
ip (optional): string
I’ve set this one as optional as you can forward the user’s IP in the headers as well. See here how. However you can attach the user’s IP in the body of the request. The API will first look in the body to see if you have forwarded any IPs and if nothing is found it will look in the headers for an IP.
A response will have these properties:
A string number between 0 and 1 (the closer to 1 the better) which signifies how confident is the bot about interpreting the question correctly.
This will be mostly null for now. It provides hints (instructions) about how to ask questions and how to format them in order to get a better answer or just anything else the API want’s to instruct. eg: Prompting the user to allow the bot to use their location, in case of a failed answer it will suggest other options etc.
A tag which describes the meaning of the question. Usually one or two words long. It can be userful in case you want to handle some answers differently than others in the frontend client.
An object which holds two properties: text andurl .
*text *: This is the main answer of the bot.
*url *: Will mostly be empty. It holds external URL’s to other sites eg: in case of recipes it will give you a resource for more info etc.
Status code of the response.
This will let you know if the bot got your question and managed to process it succesfully. It should be true even when the bot doesn’t understands a question.
This endpoint takes no arguments. It’s useful to check the server’s situation in case there are maintenance tasks or other downtime reasons.