Login to NPC Builder app #
Access NPC Builder web app by entering this link: https://app.npcbuilder.com.
Navigate to developers section #
Click on developers section icon at the navigation bar.
Generate auth token #
Click the generate bearer token button and copy the result. Save it for later!
Obtain game and world IDs #
Find in the tree below the game and the world IDs where your character is located in.
Build your API request #
With the previous details you can build the body of your API request as follows:
{
"character_name":"Name",
"game_id":"ID",
"world_id":"ID",
"messages":[
{"role":"user",
"content":"Message"}
]
}
JSONNOTE: Remember that in order to keep the context of the whole conversation, it is important to add all interactions, you should add all messages to the list as shown below.
The “role” parameter can take the following values (it is case sensitive):
-user: represents the user who is interacting with the NPC.
-assistant: represents the NPC
{
"character_name":"Name",
"game_id":"ID",
"world_id":"ID",
"messages":[
{"role":"user",
"content":"Message"},
{"role":"assistant",
"content":"Message"},
{"role":"user",
"content":"Message"}
]
}
Send the API request #
Send your API request with a POST method to our endpoint. Remember to use Bearer Authorization passing the token obtained in “Generate auth token” step, and the body built on “Build your API Request” step
POST https://app.npcbuilder.com/api/interactions
Retrieve response #
You will receive directly the response of the character to your list of messages, formatted as a string.
{
"response": "Hello, how are you today?"
}