Creating a new app, is it best to use the API or the prefabs etc?

Original Discord Post by tyke_18 | 2024-08-31 18:08:38

Hi :slightly_smiling_face:

I’m creating a new app using the Convai SDK. I had a quite well developed app using Inworld that had a little success on Patreon but I have not been accepted for their new licensing system. What I’m wondering is, has anyone got an opinion on the best way to use Convai, as in use the Convai prefabs for the player and NPC, or use the API?

With Inworld, as I was new to Unity and rusty in C#, I opted to use the easier method of creating characters with their Studio and prefabs. I used the API later as I learnt things. With my new Convai project the option is there to use the API right from the start, to instantiate new NPC’s etc. Is this recommended i.e. does it have advantages? I’ll stick with the easier method if not and use the API only when needed, like to update NPC details such as their backstory etc.

Another couple of question if I may please? I’ve briefly read the docs on the subject of Session ID’s, is this relevant only if instantiating characters via the API? Are Session ID’s handled automatically if not using the API?

And when updating character details with the API, I assume the updates only apply to current user, it doesn’t change the character for everyone?

Reply by k3kalinix | 2024-09-01 22:16:19

Hello <@708608540763357234> :wave:t2:,
I don’t fully understand your question about prefab.

When you enter the Session ID as -1, it is automatically set with the InitializeSessionID method and you can see it in the memory section in the Playground.

When you update the character (backstory voice etc.) all users using this character are affected.

Replying to k3kalinix’s Message

Reply by k3kalinix | 2024-09-01 22:16:19
Hello <@708608540763357234> :wave:t2:,
I don’t fully understand your question about prefab.

When you enter the Session ID as -1, it is automatically set with the InitializeSessionID method and you can see it in the memory section in the Playground.

When you update the character (backstory voice etc.) all users using this character are affected.

Reply by tyke_18 | 2024-09-01 23:01:59

Hi <@1023671043287699568> yeh sorry I don’t think I worded it too well. What I mean is for example, I can add a Convai NPC to a project by creating a character within my dashboard, then dragging in the Convai Essentials prefab to the hierarchy in Unity and fill in the character ID etc, or I could use the Core API like this : import requests
import json

url = “https://api.convai.com/character/create

payload = json.dumps({
“charName”: “Raymond”,
“voiceType”: “MALE”,
“backstory”: “Raymond Reddington is a main character in the NBC series The Blacklist. Reddington is a criminal mastermind, making it to #4 and later to #1 on the FBI’s Ten Most Wanted Fugitives, who suddenly turns himself in after 20+ years of evading the FBI.”
})
headers = {
‘CONVAI-API-KEY’: ‘’,
‘Content-Type’: ‘application/json’
}

response = requests.request(“POST”, url, headers=headers, data=payload)

print(response.text)

I’m just wondering is 1 way better than the other?

Reply by k3kalinix | 2024-09-01 23:04:00

The API creates characters just like in the dashboard.

Reply by k3kalinix | 2024-09-01 23:04:55

As long as your scene remains the same, you can use the new character by simply changing the Character ID and resetting the session id.

Reply by tyke_18 | 2024-09-01 23:10:54

By update, I meant doing it like this in the API :

import requests
import json

url = “https://api.convai.com/character/update

…etc

Would that update the character locally for the user of the app, or would it affect the character in general, so all users of the app?

Reply by k3kalinix | 2024-09-01 23:11:10

General

Reply by k3kalinix | 2024-09-01 23:11:38

Like updating in the dashboard.

Replying to k3kalinix’s Message

Reply by k3kalinix | 2024-09-01 23:11:10
General

Reply by tyke_18 | 2024-09-01 23:12:18

Is there any way to just update it locally? Be amazing if there was.

Reply by k3kalinix | 2024-09-01 23:12:53

Unfortunately no.

Replying to k3kalinix’s Message

Reply by k3kalinix | 2024-09-01 23:12:53
Unfortunately no.

Reply by tyke_18 | 2024-09-01 23:13:57

Ok, I’d like to make that as a feature request please, or do u know if it’s something already being considered?

Reply by tyke_18 | 2024-09-01 23:14:47

How do I make a feature request for this? It basically means the user can customize the character how they want.

Reply by k3kalinix | 2024-09-01 23:18:31

As far as I can see, you’re planning something big. So please discuss with our sales team and mention the requirements.

Reply by k3kalinix | 2024-09-01 23:19:00

Embedded Content:
Let’s chat! - Convai Team
Sign up for a friendly conversation where we can discuss your use case and answer your questions. We’d love to explore how Convai can help you achieve your goals.
Link: Calendly - Convai Team

Replying to k3kalinix’s Message

Reply by k3kalinix | 2024-09-01 23:18:31
As far as I can see, you’re planning something big. So please discuss with our sales team and mention the requirements.

Reply by tyke_18 | 2024-09-01 23:20:52

Ok will do, I already joined up today for the year on the Pro plan I think it was, the 1 that’s usually $99 monthly but is $49 if paying a year at once. I will contact sales. Loving it so far :+1: thank you for assistance here today.

Reply by k3kalinix | 2024-09-01 23:21:54

I guess also you sent a mail right?

Replying to k3kalinix’s Message

Reply by k3kalinix | 2024-09-01 23:21:54
I guess also you sent a mail right?

Reply by tyke_18 | 2024-09-01 23:22:54

Nope, I guess I should do, and I will do tomorrow for sure when I’m back at my PC :+1:

Reply by k3kalinix | 2024-09-01 23:23:32

Okay,
As I said, schedule a meeting and explain about your project and its requirements.

Replying to tyke_18’s Message

Reply by tyke_18 | 2024-09-01 23:20:52
Ok will do, I already joined up today for the year on the Pro plan I think it was, the 1 that’s usually $99 monthly but is $49 if paying a year at once. I will contact sales. Loving it so far :+1: thank you for assistance here today.

Reply by k3kalinix | 2024-09-01 23:23:57

I saw a support mail about it.

Reply by k3kalinix | 2024-09-01 23:24:40

I thought it was you.