Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - General
Unanswered

How to get user name and ID from HTML

(0) ShareShare
ReportReport
Posted on by 2

I need to get the user name and user ID in the HTML code of my website.

The user is logged in already so I want the user's first name for the bot to use and the user ID so I can fetch info in a mysql DB.

So in the beginning conversation I will start with Greeting and use the first name.

Other topics will take the ID and I guess use a Flow to get the data.

 

I have added this code in the html:

<script>
 var user_id = "52";
 var user_first_name = "david";

 

and 

 

name: "startConversation",
 type: "event",
 value: {
 "user_id": "" + user_id + "",
 "user_first_name" : user_first_name

 

So I want to start with a Greeting that would say - "Hi David" by getting user_first_name

I will later use the user_id, but for now I want to get the user_first_name from the html code on the page the bot resides on and use it in the Conversation Start Topic.

So how do I get that in there as a variable?

I am use the newest bot version.

Thanks for you help

 

-Dave

 

 

 

 

  • digital6 Profile Picture
    2 on at
    Re: How to get user name and ID from HTML

    I want the bot to get the variables in the html code.  How do I get them in the topic?

     

  • fernandosilva Profile Picture
    Super User 2024 Season 1 on at
    Re: How to get user name and ID from HTML

    Hi @digital6 ,

     

    On the new canvas there is a topic called Sign in already in place.

    2023-08-16 13.23.58 web.powerva.microsoft.com 304f932c43ac.png

    Cheers,

    Fernando

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Copilot Studio - General

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 23

#2
Pablo Roldan Profile Picture

Pablo Roldan 16

#3
stampcoin Profile Picture

stampcoin 10

Overall leaderboard