Skip to main content

Notifications

Topic Creation & Management
Unanswered

Return array of objects from JSON response to user

Posted on by 11

I have a topic that includes a connector action which calls a customer connector. The JSON response includes an array of objects.

 

Schema:

{
 "type": "object",
 "properties": {
 "value": {
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "IssueId": {
 "type": "string"
 },
 "AppId": {
 "type": "string"
 },
 "Owner": {
 "type": "string"
 },
 "Custodian": {
 "type": "string"
 }
 },
 "required": [
 "IssueId",
 "AppId",
 "Owner",
 "Custodian"
 ]
 }
 }
 }
}

 

I would like to loop through the result and return each object to the user using an adaptive card, but I can't find a way to do this?

  • Expiscornovus Profile Picture
    Expiscornovus 1,700 on at
    Re: Return array of objects from JSON response to user

    Hi @MZSR,

     

    That would be an adaptive card per object with the Owner as the recipient, so multiple cards would be sent in one flow run. You would loop through the items of your json and can you use the details of the current item in the Post adaptive card in a chat or channel action.

     

    Just make sure you use the Power Virtual Agents option in the Post as dropdown and your Copilot in the Bot dropdown. This way it will sent the card as your bot.

  • MZSR Profile Picture
    MZSR 11 on at
    Re: Return array of objects from JSON response to user

    Thank you @Expiscornovus! I am aware how to do this in a flow, however am not sure how this would then be returned to the bot. For example, should I create a foreach and append this all into one big string (which in my case will be long) before this is returned to the bot? And how will this work with the adaptive card? Will that be one adaptive card returned to the bot or multiple (packed in multiple messages)?

  • Expiscornovus Profile Picture
    Expiscornovus 1,700 on at
    Re: Return array of objects from JSON response to user

    Hi @MZSR,

     

    As far as I am aware there is no apply to each/for each control/step available in topic management.

     

    You might be able to workaround this by sending the objects to a Power Automate cloud flow and send the adaptive card from there.

     

    Cloud flows do have an apply to each action. You can send it as a pro-active messages from the bot:

    https://learn.microsoft.com/en-us/microsoft-copilot-studio/advanced-proactive-message#send-a-proactive-adaptive-card

     

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,990

#3
Expiscornovus Profile Picture

Expiscornovus 1,700

Featured topics