cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chris_C
Level: Powered On

Custom QnA Maker Connector String - JSON?

I have created a customer connector for QNA Maker that I have working fine in a Flow. I wanted to add additional commands that aren't built into the default QNA Maker connector. I have not had any luck with it inside a PowerApp though. I have been trying to nail this done the past few days, in between taking breaks from it, but I cannot narrow it down or find a solution.

 

CreatePairConnector.png

 

FlowResponse.png

    

 

 

The closest I have come across to my situation is the following:

https://powerusers.microsoft.com/t5/General-Discussion/CUSTOM-CONNECTOR-Help-with-JSON-Request-or-Re...

 

For now I am using static values to test because I am just trying to get the connection string down.

 

I’ve tried collecting the values in a separate button and then passing that value to the ADD parameter. It complains about the value being a Table and not a Record.

 

qnalistCompile.png

 

I’ve tried directly adding the values into the ADD action and it looks for a qnalist column then, theirs is where I tried creating it with the compile button I setup. I know QNAList is the array value, but not sure how it's suppsed to be used in this function.

 

qnalistMissing.png

 

I've tried adding the values as a table similar to the article I found, but no luck either.

 

TableError.png

 

I've also tried many other iterations. I know it’s a formatting issue, I just can’t narrow it down. Help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Custom QnA Maker Connector String - JSON?

Hi @Chris_C,

Could you please share a bit more about the parameter type you specified for the add parameter within your custom connector?

Based on the screenshot that you provided, I think there is something wrong with the formula you provided for the add parameter. The add parameter is required to provide a record value, but you provide a Table value.

In addition, within the add parameter, you should also provide a value for qnaList property.

I have made a test on my side, please modify your formula as below:

QnAFlow.CreatePair(
      {
          'Content-Type': 'application/json',
           add: {
                      qnaList: Table(
{
id: 0,
answer: "At the time of running this test, it is 12:24 pm CST.",
questions: ["What time is it?", "Do you have the time?"]
}
) } } )

Or

Set the OnSelect property of the "Collect" button to following:

ClearCollect(
Collection1,
Table({id:0, answer: "At the time of running this test, it is 12:24 pm CST.", questions: ["What time is it?","Do you have the time?"]})
)

Modify your formula as below:

QnAFlow.CreatePair(
      {
          'Content-Type': 'application/json',
           add: {
                      qnaList: Collection1
                   }
      }
)

Please take a try with above solution, then check if your issue is solved.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Community Support Team
Community Support Team

Re: Custom QnA Maker Connector String - JSON?

Hi @Chris_C,

Could you please share a bit more about the parameter type you specified for the add parameter within your custom connector?

Based on the screenshot that you provided, I think there is something wrong with the formula you provided for the add parameter. The add parameter is required to provide a record value, but you provide a Table value.

In addition, within the add parameter, you should also provide a value for qnaList property.

I have made a test on my side, please modify your formula as below:

QnAFlow.CreatePair(
      {
          'Content-Type': 'application/json',
           add: {
                      qnaList: Table(
{
id: 0,
answer: "At the time of running this test, it is 12:24 pm CST.",
questions: ["What time is it?", "Do you have the time?"]
}
) } } )

Or

Set the OnSelect property of the "Collect" button to following:

ClearCollect(
Collection1,
Table({id:0, answer: "At the time of running this test, it is 12:24 pm CST.", questions: ["What time is it?","Do you have the time?"]})
)

Modify your formula as below:

QnAFlow.CreatePair(
      {
          'Content-Type': 'application/json',
           add: {
                      qnaList: Collection1
                   }
      }
)

Please take a try with above solution, then check if your issue is solved.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Chris_C
Level: Powered On

Re: Custom QnA Maker Connector String - JSON?

@v-xida-msft Thank you, that worked perfectly. I actually grabbed the JSON from the QNA Maker API page.

 

https://westus.dev.cognitive.microsoft.com/docs/services/5a93fcf85b4ccd136866eb37/operations/5ac2662...

 

{
  "add": {
    "qnaList": [
      {
        "id": 0,
        "answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle",
        "source": "Custom Editorial",
        "questions": [
          "How can I change the default message from QnA Maker?"
        ],
        "metadata": []
      },
      {
        "id": 0,
        "answer": "You can use our REST apis to manage your KB. See here for details: https://westus.dev.cognitive.microsoft.com/docs/services/58994a073d9e04097c7ba6fe/operations/58994a073d9e041ad42d9baa",
        "source": "Custom Editorial",
        "questions": [
          "How do I programmatically update my KB?"
        ],
        "metadata": [
          {
            "name": "category",
            "value": "api"
          }
        ]
      }
    ],
    "urls": [
      "https://docs.microsoft.com/en-us/azure/cognitive-services/Emotion/FAQ"
    ],
    "files": [
      {
        "fileName": "SurfaceManual.pdf",
        "fileUri": "https://download.microsoft.com/download/2/9/B/29B20383-302C-4517-A006-B0186F04BE28/surface-pro-4-user-guide-EN.pdf"
      }
    ]
  },
  "delete": {
    "ids": [
      4,
      13,
      35
    ],
    "sources": [
      "Custom Editorial"
    ]
  },
  "update": {
    "name": "QnA Maker + Emotion API FAQ Bot",
    "qnaList": [
      {
        "id": 30,
        "answer": "Yes, you can use our REST APIs to manage a KB. Please check our documentation for details.",
        "source": "Custom Q&A",
        "questions": {
          "add": [
            "can I programmatically manage a KB?"
          ],
          "delete": [
            "How do I programmatically update my KB?"
          ]
        },
        "metadata": {
          "delete": [
            {
              "name": "category",
              "value": "api"
            }
          ],
          "add": [
            {
              "name": "category",
              "value": "programmatic"
            }
          ]
        }
      }
    ],
    "urls": [
      "https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq"
    ]
  }
}

I only kept the ADD portion since I was trying to make a seperate connector action speciffically for it.

 

Thank you much!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 88 members 4,289 guests
Please welcome our newest community members: