Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - General
Unanswered

Get external variables

(0) ShareShare
ReportReport
Posted on by 36

Is there a way to get variables from the website where I publish the bot? That is, the client is already logged in on the website and suddenly starts using the bot, so as not to have to ask him for his name again, for example, since he is already logged in, is there a way to collect that data?

Categories:
  • ElenaAA Profile Picture
    36 on at
    Re: Get external variables

    How do I configure the question node? because I have already tried many ways and there is no way for me to skip the question, it always comes up.And it doesn't go to the next message until something is written.

    I put screenshots of the configuration of the question node and the variable.

    ElenaAA_0-1710457082073.png

    ElenaAA_1-1710457136717.pngElenaAA_2-1710457192702.png

     

     

  • Javiavan Profile Picture
    30 on at
    Re: Get external variables

    Thank you very much, Adilei, I'm going to try it

  • adilei Profile Picture
    on at
    Re: Get external variables

    The question node itself will assign the value, and the user will not have to write anything - as the question is embedded in "Conversation Start". It's fine if the question isn't empty because it won't be shown. In short, try the solution I posted here, it works, I promise 🙂

  • adilei Profile Picture
    on at
    Re: Get external variables

    For everyone on this thread, here is the complete solution:

     

    1. Add a question node to your Conversation Start topic that will populate a global variable. Allow setting the variable from external sources.

     

     

    kind: AdaptiveDialog
    beginDialog:
     kind: OnConversationStart
     id: main
     actions:
     - kind: Question
     id: question_ZOc4Os
     interruptionPolicy:
     allowInterruption: true
    
     variable: init:Global.myParam
     prompt: external variable
     entity: StringPrebuiltEntity
    
     - kind: SendActivity
     id: sendActivity_Yfykys
     activity: "Your value for myParam is: {Global.myParam}"

     

     

    2. When embedding the copilot in your website, append a parameter with the same name as your global variable to the copilot URL.

     

    For example:

     

     

    https://web.powerva.microsoft.com/environments/env_id/bots/bot_id/webchat?__version__=2&myParam=myValue

     

     

    When the conversation starts, the question will be skipped, and the variable will be populated from the URL parameter:

     

    adilei_1-1710449831698.png

     

     

  • ElenaAA Profile Picture
    36 on at
    Re: Get external variables

    The question is omitted, okay. But the client will have to write something to retrieve the variable, right? And at some point I will have to make that assignment of the Clientid variable of the url with the Global Clientid variable created, right?

    I have also tried what you mentioned and it won't let me create a blank question.

    ElenaAA_1-1710449549165.png

     

  • adilei Profile Picture
    on at
    Re: Get external variables

    The question node is just a way to capture an incoming value. When the conversation starts, the question will be skipped and won't be presented to the user.

  • Javiavan Profile Picture
    30 on at
    Re: Get external variables

    I have the same problem as you, ElenaAA. I've been researching for several days and I've looked at Microsoft's documentation twice. If at any time you manage to solve it, please share

  • ElenaAA Profile Picture
    36 on at
    Re: Get external variables

    But then if I ask it as a question, why do I send the variable through the url to the bot? What I supposedly want is that when the client opens the bot without asking anything, he directly sends a variable to the bot and with this variable, with internal processes, the bot responds one thing or another. For example, I don't want to ask the client again what his name is if he has already logged in to the website.

  • adilei Profile Picture
    on at
    Re: Get external variables

    I guess it's not that clear in the docs - you need a question node in order to "capture" the incoming value:

     

     

    adilei_1-1710429789302.png

     

  • ElenaAA Profile Picture
    36 on at
    Re: Get external variables

    Thanks for your reply. I have been testing and as I understand, in the call to the bot from the web I have to pass the parameter, for example, after the code I had, I put "&ClientID=5". Then in copilot I have to create the variable and put it with the same name as Global and that it can receive external data, but it asks me to assign a value, what should I put

    ElenaAA_0-1710414803082.png

    Saludos y gracias

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 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…

Leaderboard > Copilot Studio - General

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 66

#2
Pablo Roldan Profile Picture

Pablo Roldan 55

#3
stampcoin Profile Picture

stampcoin 10

Overall leaderboard