Botframework-composer: support expression in body of http action

Created on 7 Apr 2020  路  9Comments  路  Source: microsoft/BotFramework-Composer

Is your feature request related to a problem? Please describe.

I'm always frustrated when I can't use expression in body

Describe the solution you'd like

Change to UI like options in begin dialog:
image

Describe alternatives you've considered

Additional context

Question skill-reported

Most helpful comment

We'll look to make this possible in R9

All 9 comments

@xieofxie please give more information in your request. It is possible to use both variables and expressions in the body of an HTTP call today.

Calendar skill need to add multiple attendee emails in http request body like:

"attendees": [
    {
      "emailAddress": {
        "address": "${user.ResolvedAttendees[0]}"
      }
    },
    {
      "emailAddress": {
        "address": "${user.ResolvedAttendees[1]}"
      }
    },
    ...
  ]

Now we can only add fixed count of items in list, because the body should be a json format.

why can't you use a foreach node with setproperty inside of it to create your object and then assign it into the body?

Do you mean that I create a attendee list object, then add it in body like this?

"attendees": [
    ${dialog.attendeeList}
  ]

This is not a valid json, so will get an error.

Ah, I see. I think you would want

{
  "attendees": ${dialog.attendeeList}
}

Yes. That is what I want.

We'll look to make this possible in R9

@cwhitten At first look I thought I can't use string(expression) in the body, however after some investigation, I found the following works:

  • Assume dialog.a is an object/array/string
    This will serialize the content of a to data, thus object/array/string could be set dynamically
{
    "data":"=dialog.a"
}
  • Assume dialog.a is an object
    This will serialize the content of a to json, thus key-value pairs could be set dynamically
    "=dialog.a"

@KayMKM will this solve your problem?

@hibrenda I may close this now. But this is different from #1829 as that one requires body could be other types instead of json

Thanks

@xieofxie thanks for the investigation. I just removed the link to issue 1829. And we also need to document or show this usage in sample as well @luhan2017 .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philip-mc picture philip-mc  路  14Comments

sujeongHeo picture sujeongHeo  路  15Comments

gbelenky picture gbelenky  路  22Comments

KoradaRajesh picture KoradaRajesh  路  25Comments

cxbuilders picture cxbuilders  路  15Comments