#Is this the right way to call variables in the new GPT Turbo API

4 messages · Page 1 of 1 (latest)

timber trench
#

The code creating them is:

if (!req.session.details) {
req.session.details = req.body.Body.toLowerCase();
twiml.message('Is there anything I should know about you? The more I know, the better I can serve you.');
res.type('text/xml').send(twiml.toString());
return;
}

But half the time to bot says he does not know the users name / additional info provided.

livid bronze
#

It is, try it if it works

timber trench
# livid bronze It is, try it if it works

Seems to half work, hes claiming my name is Sebastian

if (!req.session.init) {
req.session.init = true;
twiml.message('Nice to meet you, what is your name?');
res.type('text/xml').send(twiml.toString());
return;
}

if (!req.session.name) {
req.session.name = req.body.Body;
}

I coded name a bit differently or it saved my name as 'Hi' or the first message i sent

half hatch
#

Hi. Have you tried putting your name in the user role? In the messages array object you can put your name next to the role, maybe a little something like this:

messages: [
  {"role": "user", "name": req.session.name, "content": req.body.Body}
]