Implementing Bing Search with Bing Search API
# 🤝help
p
Hi. I am building a chatbot where one task is to provide user with information related to his surroundings - activities, attractions, restaurants etc. I have implemented Card Caruosel to show some resulst, but obviously users might have more inquiries regards those topics - such as other activities etc. Therefore, it seems that Bing Search API is supposed to provide a solution. I have gone over videos many times. And I am using templates. Of cause I have set the question to be saved into {{workflow.user.Question}}, set apiKey (.....) , endpoint (https://api.bing.microsoft.com/) etc., set mesagge to send: to - answer: {{JSON.stringify(workflow.answer)}}. When I run the bot I getting no errors, the variable userQuestion is filled, api call is being made, but I am getting no response - just (answer:""). The Logs are as follows: 1 16:16:02debugSending Message. Type: choice. Text: What are you looking for?..... 16:16:02debugWaiting for user input..... 16:16:14debug[Capture] Field validation successful! Extracted: "Activities in Tel Aviv". Input: Activities in Tel Aviv 16:16:14debug[Capture] Prompt success 16:16:14debugTransition from (flow:Main) [node:Question] to [node:Call-API] 16:16:14debugExecute code "make a GET request to https://api.bing.microsoft.com/ with the following URL parameters: query: workflow.usersQuestion, apiKey:env.apiKey, ignorePantry:'false', sort: 'popularity'. If response.status is 200,save the response.data.results to workflow.answer" 16:16:14debugTransition from (flow:Main) [node:Call-API] to [node:ShowResults] 16:16:14debugSending Message. Type: text. Text: answer: "" Can someone explain why this happens?
a
there might be something funky going on in the call api code. Would you mind posting it here?
p
{ "triggers"; [ { "id": "on_user_question", "name": "On User Question", "condition": "user_asks", "actions": [ { "id": "make_bing_search_request", "action": "http.request", "url": "https://api.bing.microsoft.com/", "params": { "query": "{{workflow.usersQuestion}}", "apiKey": "{{env.apiKey}}", "ignorePantry": "false", }, "success": [ { "id": "represent_response_to_user", "action": "json.stringify", "params": { "data": "{{http.response.data}}", "indent": 4 }, "success": [ { "id": "reply", "action": "botframework.reply", "content": "{{json.result}}" } ] } ] } ] } ] }
a
We use the axios library for API calls in cloud, you'll need to format your API call to use that library https://axios-http.com/docs/intro
10 Views