Enable/Disable Narrative Graph for your character.
Headers
Request Body
{"STATUS":"Successful"}
{"ERROR":"Invalid API key provided."}
Here are some sample codes to demonstrate the request format for the endpoint -->
import requestsimport jsonurl ="https://api.convai.com/character/toggle-is-narrative-driven"headers ={'CONVAI-API-KEY':'<Your-API-Key>','Content-Type':'application/json'}# Create a dictionary for the JSON payloadpayload ={"character_id":"<Your-Character-Id>","is_narrative_driven":True}# Convert the payload to JSONjson_payload = json.dumps(payload)response = requests.post(url, headers=headers, data=json_payload)print(response.text)
Here are some sample codes to demonstrate the request format for the endpoint -->
import requestsimport jsonurl ="https://api.convai.com/character/narrative/create-section"headers ={'CONVAI-API-KEY':'<Your-API-Key>','Content-Type':'application/json'}# Create a dictionary for the JSON payloadpayload ={"character_id":"<Your-Character-Id>","objective":"Section Objective","section_name":"SectionName","updated_character_data":{},"behavior_tree_code":"","bt_constants":""}# Convert the payload to JSONjson_payload = json.dumps(payload)response = requests.post(url, headers=headers, data=json_payload)print(response.text)
Edit section for your Character. You would send all the fields that you want to update for a section updated_character_data json. Following are the valid key.
"section_name"
"objective"
"decisions": This is a list of json. Each entry in the list should have following format.
{
"criteria":"Decision Criteria",
"next_section_id":"ID of the section to transition"
}
Headers
Request Body
{"section_id":"<New-Section-Id>"}
{"ERROR":"Invalid API key provided."}
Here are some sample codes to demonstrate the request format for the endpoint -->
import requestsimport jsonurl ="https://api.convai.com/character/narrative/edit-section"headers ={'CONVAI-API-KEY':'<Your-API-Key>','Content-Type':'application/json'}# Create a dictionary for the JSON payloadpayload ={"character_id":"<Your-Character-Id>","section_id":"<Section-Id->","updated_data":{"decisions":[{"criteria":"User agrees to take tour.","next_section_id":"b9d7f568-7d06-11ef-be6a-42010a7be011"} ],"objective":"Offer user tour of a Museum.","section_name":"Welcome Section"}}# Convert the payload to JSONjson_payload = json.dumps(payload)response = requests.post(url, headers=headers, data=json_payload)print(response.text)