Integrations
Call a Lookio assistant from n8n, Make, Zapier or any tool that sends HTTP requests, with an API key, one request, and the answer with its sources.
Any tool that sends HTTP requests can ask a Lookio assistant. You need an API key, the id of the assistant, and one POST request.
Before you start
Create an API key
In the app, open Developer tools, then Create key. Choose the Ask questions preset. Copy the key: Lookio shows it once. See API keys.
Copy the assistant's id
Open the assistant. Its id, such as ast_kw9tvh2ze2ar, is at the top of its sheet. The API button gives the whole request.
The request
| Value | |
|---|---|
| Method | POST |
| URL | https://api.lookio.app/v1/assistants/ASSISTANT_ID/query |
| Header | Authorization: Bearer sk_live_… |
| Header | Content-Type: application/json |
| Body | {"question": "…", "end_user": "…"} |
The answer is in data.answer, the passages in data.citations and the price in data.credit_cost. Use end_user to name the person who asks, for example the customer id of a ticket. You then find their conversations in Logs.
In your tool
Add an HTTP Request node.
- Method:
POST. URL: the URL above. - Authentication: Generic credential, Header Auth. Name
Authorization, valueBearer sk_live_…. - Send Body: on, JSON, with:
{
"question": "{{ $json.subject }}\n\n{{ $json.body }}",
"end_user": "{{ $json.customer_id }}"
}The next node reads {{ $json.data.answer }}.
Add an HTTP module, Make a request.
- URL: the URL above. Method:
POST. - Headers:
AuthorizationwithBearer sk_live_…. - Body type: Raw, Content type JSON, and the body with your question.
- Turn on Parse response. The next modules read
data.answeranddata.citations.
Add a Webhooks by Zapier action, Custom Request.
- Method:
POST. URL: the URL above. - Data: the JSON body with your question.
- Headers:
AuthorizationwithBearer sk_live_…, andContent-Typewithapplication/json.
The next steps read data__answer.
curl https://api.lookio.app/v1/assistants/ASSISTANT_ID/query \
-H "Authorization: Bearer $LOOKIO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: ticket-4821" \
-d '{"question": "Can I change my plan mid-month?", "end_user": "cus_1042"}'Good practice
Send an Idempotency-Key
Automation tools retry after a timeout. Send an Idempotency-Key made from the event, such as the ticket id. Then a retry is not charged twice. See Conventions.
Give the request time
An answer takes a few seconds, more in Deep mode. Set the HTTP timeout of your tool to 60 seconds or more.
Keep a thread with conversation_id
For a follow-up in the same ticket, send the previous answer’s conversation_id. Lookio reads the history itself. See Conversations and end users.
Forward your agents' thumbs
If a person reviews the draft, send their thumbs up or down to Lookio. It shows in Logs, next to the answer. See Feedback on answers.
Limit the key
Give the automation its own key, with the Ask questions preset and only the assistants it needs. You can then revoke it alone.