Narrative Design API

The page list all the APIs needed to interact Narrative Design

Toggle Narrative Design

POST https://api.convai.com/character/toggle-is-narrative-driven

Enable/Disable the Narrative Graph for your character.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

is_narrative_driven

Bool

Set it to true or false, to enable disable Narrative Graph.

{"STATUS": "Successful"}

Here are some sample codes to demonstrate the request format for the endpoint -->

import requests
import json

url = "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 payload
payload = { 
    "character_id": "<Your-Character-Id>",
    "is_narrative_driven": True
}

# Convert the payload to JSON
json_payload = json.dumps(payload)

response = requests.post(url, headers=headers, data=json_payload)

print(response.text)

Create Section

POST https://api.convai.com/character/narrative/create-section

Create new section for your Character.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

objective

String

Section Objective

section_name

String

Name of the Section.

updated_character_data

Json

*Ignore* Field is not used.

behavior_tree_code

String

*Ignore* Field is not used.

bt_constants

String

*Ignore* Field is not used.

Here are some sample codes to demonstrate the request format for the endpoint -->

Edit Section

POST https://api.convai.com/character/narrative/edit-section

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.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

updated_character_data

Json

Contains fields that are updated.

section_id

String

Id of the section to update.

Here are some sample codes to demonstrate the request format for the endpoint -->

Get Section

POST https://api.convai.com/character/narrative/get-section

Get details for a particular narrative section of your Character.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

section_id

String

Id of the section to fetch.

Here are some sample codes to demonstrate the request format for the endpoint -->

List Sections

POST https://api.convai.com/character/narrative/list-sections

List details of all narrative sections for a given character.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

Here are some sample codes to demonstrate the request format for the endpoint -->

Delete Section

POST https://api.convai.com/character/narrative/delete-section

Delete a narrative section of your Character.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

section_id

String

Id of the section to delete.

Here are some sample codes to demonstrate the request format for the endpoint -->

Create Trigger

POST https://api.convai.com/character/narrative/create-trigger

Create a new Trigger for your Character.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

trigger_name

String

Name of the trigger. Must be unique for a character.

trigger_message

String

Message for the trigger. Commonly tell the event for which the Trigger is invoked. E.g. User entered the scene.

desgination_section

String

Destination section-id for this trigger. Do not pass this field if you don't want to connect Trigger to any section.

Here are some sample codes to demonstrate the request format for the endpoint -->

Update Trigger

POST https://api.convai.com/character/narrative/update-trigger

Edit a Trigger. You would send all the fields that you want to update for a trigger via updated_data json. Following are the valid key.

  • "trigger_name": New trigger name. Must be unique.

  • "trigger_message": New trigger message.

  • "destination_section": New destination section-id for the trigger.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

updated_data

Json

Contains fields that are updated.

trigger_id

String

Id of the trigger to update.

Here are some sample codes to demonstrate the request format for the endpoint -->

Delete Trigger

POST https://api.convai.com/character/narrative/delete-trigger

Delete an existing Trigger.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

trigger_id

String

Id of the trigger to delete.

Here are some sample codes to demonstrate the request format for the endpoint -->

Get Trigger

POST https://api.convai.com/character/narrative/get-trigger

Fetch details of an existing Trigger.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

trigger_id

String

Id of the trigger to fetch.

Here are some sample codes to demonstrate the request format for the endpoint -->

List Triggers

POST https://api.convai.com/character/narrative/list-triggers

List all the triggers for a Character.

Headers

Name
Type
Description

CONVAI-API-KEY*

String

The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.

Request Body

Name
Type
Description

character_id

String

Id of your character.

Here are some sample codes to demonstrate the request format for the endpoint -->

Last updated

Was this helpful?