Matching GPT user to database records

Hi,

My GPT will be used by various users. I need to record when a user interacts with the GPT. But how will I know which user used it, so that I can match it to the users in my database? Is there some sort of mechanism where we could ask for email & password, or can we somehow get GPT user_id from OpenAI API?

Thank you,
Mutlu

I’d get the users username from your db from when they signed up and pass that to your back end in your req.body and then id pass that ID to the bot and have it give back JSON where one of the parameters is that ID, and then id pass that response from the API to the front end, voila

Example: the users username is ${user}

You are X bot. You do X

…respond in JSON without deviation
[
User: ${user}
Response:
]

Pass this JSON back to your front end or DB^

Sorry for the crap syntax I’m on my phone at an airport

OpenAI will send a conversation_id in the header when it makes an action call as well as the gpt_id. There is an empheremal_user_id but that changes. They do not want you tracking users across OpenAI.

1 Like

You can add Oauth2 authentication to your app and once the user does sign in, the user id is sent along with each request to your server

thanks, but it’s not exactly my app, it’s the custom GPT I created inside ChatGPT. Would Oauth2 work in this scenario (not an expert in this area)?

Thanks, good idea. But please note that it’s a custom GPT inside chatGPT, not my app. So the user logs in into chatGPT, and then uses my custom GPT. And I’d like to be able to understand how many questions s/he asks to this custom GPT. I’ll utilize Actions, which allows to call external APIs. All I need is to somehow call those external APIs (which I created) with some sort of ID so that I can match them to the relevant user on my end.

Extremely helpful, thanks! Will give it a try. But it would be very helpful if Actions could also require some sort of login mechanism for the user so that we can have more control over the actions of the user.

Here’s an interesting idea from chatGPT (I love AI): Another approach is to require users to input their ID (assigned by your app) at the beginning of their interaction with Custom GPT. This method relies on user cooperation and accuracy.

Yes, you can add Ouath2 in any Custom GPT and collect user emails

For those who are looking for a similar solution: I used user input idea. User enters their username, and then I pass it to the API using instructions (simply talk to AI to configure it that way).