Skip to main content

Notifications

Power Platform Community / Forums / General / Copilot Studio ChatBot...
General
Answered

Copilot Studio ChatBot - HTTP request with variable question

Posted on by 8

Hello guys, I have a question about the HTTP request step. I would like to perform a GET request with a variable that was previously collected from the requester.

For example:

  • I ask, "What's your telephone number?"
  • The requester responds: 551999366165
  • I save this telephone number in a variable (telephone) and use it inside of an HTTP request as a query.

Here is an example: https://br-demo-5.topdesk.net/tas/api/persons?query=phoneNumber==${telephone}

I've tried using (Topic.telephone), ${telephone}, and other methods, but nothing has worked yet.

Here's the problem: I don't know how to use a variable within the URL. Is there a correct way to do this, or is it not possible?



  • Umianta Profile Picture
    Umianta 262 on at
    Re: Copilot Studio ChatBot - HTTP request with variable question

    Hi @kush-sg 

     

    It seems you are not assigning variables correctly. Use Power Fx formulas when creating JSON with variables. See the example below for guidance.

     

    Umianta_0-1716775823726.png

     

    If this was helpful:
    Please mark it as a solution
    Give me a thumbs-up
    Connect on LinkedIn
    I consistently upload technical videos. If you're interested, please visit and subscribe to my YouTube Channel
    Always glad to help, Umesh Khandelwal!

     

  • kush-sg Profile Picture
    kush-sg 14 on at
    Re: Copilot Studio ChatBot - HTTP request with variable question

    @fbanik 
    @v-xiaochen-msft 
    @Umianta 
    Hello guys

    I am encountering the same issue. Could you please help me? I have attached a screenshot below.

    Problem: I stored a value inside a variable (Var1) and tried to pass it in the HTTP POST request body.

    Value that i want to pass (Var1)Value that i want to pass (Var1)Payload - HTTP Post requestPayload - HTTP Post requestResponseResponse

  • fbanik Profile Picture
    fbanik 8 on at
    Re: Copilot Studio ChatBot - HTTP request with variable question

    It worked, thank so much!

  • Umianta Profile Picture
    Umianta 262 on at
    Re: Copilot Studio ChatBot - HTTP request with variable question

    Hi @fbanik 

     

    You can utilize the Power FX concatenate function to construct a URL incorporating variables. Refer to the example below for illustration.

    Umianta_0-1715308196071.png

     

    If this was helpful:
    Please mark it as a solution
    Give me a thumbs-up
    Connect on LinkedIn
    I consistently upload technical videos. If you're interested, please visit and subscribe to my YouTube Channel
    Always glad to help, Umesh Khandelwal!

     

  • Verified answer
    Re: Copilot Studio ChatBot - HTTP request with variable question

    Hi @fbanik ,

     

    Please try this

    vxiaochenmsft_0-1715307718602.png

     

    Best Regards,
    Wearsky

Helpful resources

Quick Links

Exciting News for Copilot Studio Communi…

Get ready to experience a whole new level of engagement with the Copilot Studio…

Celebrating the May Super User of the…

LaurensM is an exceptional contributor to the Power Platform Community…

Check out the Copilot Studio Cookbook…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
renatoromao Profile Picture

renatoromao 6,459

#2
Pstork1 Profile Picture

Pstork1 1,954

#3
Expiscornovus Profile Picture

Expiscornovus 1,667