/
πŸ““
Tutorial
Search
Try Notion
πŸ““
Tutorial
πŸ’‘
This tutorial assumes you have an X-API-KEY
Setup
export ENDPOINT="staging.meetkai.cloud" export YOUR_API_KEY="_____"
Bash
Create an end user
When you have a new user that you want to interact with the MeetKai cloud on behalf of the first step is to sign them up as an end user.
curl -X 'POST' \ 'https://$ENDPOINT/api/auth/alpha/create_end_user' \ -H 'accept: application/json' \ -H 'X-API-Key: $YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "user_uid": "tutorial_unique_id_1" }'
Bash
This will respond with something that looks like this:
{ "user_id": "pOY1EyvTx.....", "id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI..........", "refresh_token": "AGEhc0D9u_oQpwYqNMjAB3tU9DhN............." }
Bash
user_id is the corresponding internal UUID for this user in meetkai
id_token is a JWT
refresh_token can be used to refresh the JWT when it expires
A few key points:
If you call create_end_user multiple times with the same user_uid, you will get back the same localId object and a new idToken, the refresh token may or may not change.
Do NOT call the create_end_user endpoint multiple times for the same user unless you lose the refresh token, if your JWT is expired you should use the refresh endpoint like so:
curl -X 'POST' \ 'https://$ENDPOINT/api/auth/alpha/refresh_end_user' \ -H 'accept: application/json' \ -H 'X-API-Key: $YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "refresh_token": "AGEhc0D9u_oQpwYqNMjAB3tU9DhN............." }'
Bash
In return you will get a fresh JWT and refresh_token (if it has changed)
{ "refresh_token": "...", "id_token": ".....", "user_id": "pOY1E...." }
Bash
Making Conversational Requests
For a deeper explanation in how the Oscar api can be used you can check out the overview:
Sample requests
curl -X 'POST' \ 'http://$ENDPOINT/api/oscar/alpha/message_batch?reset_first=false' \ -H 'accept: application/json' \ -H 'user-location: 33.987776,-118.441071' \ -H 'user-region: US' \ -H 'user-language: en' \ -H 'kai-voice: Indonesian' \ -H 'Authorization: Bearer eyJhbGciOiJSUzI1N........' \ -H 'X-API-Key: $YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "transcripts": [{"transcript": "find me a movie"}], "source": "text", }'
Bash
This is a STATEFUL API, so further requests are assumed to continue the conversation, if you want to have a new message reset the conversation use reset_first=true as a query parameter. Alternatively, you may manually call clear by posting to the /clear endpoint