Web Chat did not display the result - botframework

Currently, I had developed Microsoft Graph ChatBot which retrieves the data from SharePoint but when I debug in Emulator its work, but I deploy in WebChat the result did not display.
The results from Emulator,
The results from WebChat
Anyone know how to solve it or suggestion?

There are currently two versions of Web Chat: Gemini and Scorpio. Test in Web Chat is still using the older version - Scorpio - which unfortunately does not support OAuth Cards. The BotFramework Development Team is working to update Test in Web Chat, but if you need an immediate fix, I would recommend creating your own web page that uses the latest version of Web Chat. Take a look at the sample code below.
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>WebChat</title>
<script src="https://cdn.botframework.com/botframework-webchat/master/webchat.js"></script>
<style>
html, body { height: 100% }
body {
margin: 0;
}
#webchat {
height: 100%;
}
</style>
</head>
<body>
<div id="webchat" role="main"></div>
<script>
(async function() {
// Note, for the simplicity of this example, we are simply using the Web Chat Secret here;
// however, it is recommended that you create a backend REST API to generate and manage
// tokens for production.
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ secret: '<WEB_CHAT_SECRET>'}),
}, document.getElementById('webchat'));
})().catch(err => console.log(err));
</script>
</body>
For more examples of how to get started with Web Chat, take a look at the Web Chat samples.
Hope this helps!

Related

Google Analytics API request returns captcha?

Since yesterday, our connection to the Google Analytics API returns an HTML page with... captcha. Does anyone experience something like this?
We use the API with the PHP library. Our code for retrieving a report (its wrapped in our own class but it uses the google/apiclient package):
// Create analytics
$this->analytics = new \Google_Service_AnalyticsReporting($this->client);
// Create the ReportRequest object.
$request = new \Google_Service_AnalyticsReporting_ReportRequest();
$request->setViewId($view_id);
$request->setDateRanges($this->dateRanges);
$request->setMetrics( array_values( $this->metrics ) );
$request->setDimensions( array_values( $this->dimensions ) );
$request->setSegments($this->segments);
$body = new \Google_Service_AnalyticsReporting_GetReportsRequest();
$body->setReportRequests( array( $request) );
try {
$reports = $this->analytics->reports->batchGet( $body );
}
catch(\Google_Service_Exception $e)
{
echo"Error (1)...\n";
echo $e->getMessage() . "\n";
$this->lastError = json_decode($e->getMessage());
return false;
}
We catch a Google Service Exception, and the message of the error is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="viewport" content="initial-scale=1"><title>https://analyticsreporting.googleapis.com/v4/reports:batchGet</title></head>
<body style="font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;" onload="e=document.getElementById('captcha');if(e){e.focus();}">
<div style="max-width:400px;">
<hr noshade size="1" style="color:#ccc; background-color:#ccc;"><br>
<form id="captcha-form" action="index" method="post">
To continue, please type the characters below:<br><br>
<img src="/sorry/image?id=14645528721876966739&q=EgSIkL9bGIjOzu4FIhkA8aeDSycUmKeaKy3bPExiN-Ol2PpxQzOfMgFj&hl=en&continue=https://analyticsreporting.googleapis.com/v4/reports:batchGet" border="1" alt="Please enable images"><br><br>
<input type="text" name="captcha" value="" id="captcha" size="12" style="font-size:16px; padding:3px 0 3px 5px; margin-left:0px;"><br><br><br>
<input type="submit" name="btn-submit" value="Submit" style="font-size:18px; padding:4px 0;">
<input type='hidden' name='q' value='EgSIkL9bGIjOzu4FIhkA8aeDSycUmKeaKy3bPExiN-Ol2PpxQzOfMgFj'><input type="hidden" name="continue" value="https://analyticsreporting.googleapis.com/v4/reports:batchGet">
</form>
<hr noshade size="1" style="color:#ccc; background-color:#ccc;">
<div style="font-size:13px;">
<b>About this page</b><br><br>
Our systems have detected unusual traffic from your computer network. This page checks to see if it's really you sending the requests, and not a robot. Why did this happen?<br><br>
<div id="infoDiv" style="display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;">
This page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the Terms of Service. The block will expire shortly after those requests stop. In the meantime, solving the above CAPTCHA will let you continue to use our services.<br><br>This traffic may have been sent by malicious software, a browser plug-in, or a script that sends automated requests. If you share your network connection, ask your administrator for help — a different computer using the same IP address may be responsible. Learn more<br><br>Sometimes you may be asked to solve the CAPTCHA if you are using advanced terms that robots are known to use, or sending requests very quickly.
</div>
IP address: xxx.xxx.xxx.xxx<br>Time: 2019-11-19T08:25:44Z<br>URL: https://analyticsreporting.googleapis.com/v4/reports:batchGet<br>
</div>
</div>
</body>
</html>
If anyone experiences this too or has a solution, please let me know.
Thanks in advance.
This may have been Google applying some safety measures to handle a large spike in traffic. I am also aware they updated their error messages for the API as of the 4th November 2019 which may be why we are now getting this error instead of something else previously.
Email I received from Google:
"we’re upgrading the Google Analytics APIs to a new technical infrastructure stack beginning November 4, 2019. As a result of this change, clients will see some differences in the response error message text for failed API requests."
"If your application or log analysis workflow rely on the specific wording provided in responses of the Management API v3 or Core Reporting API v3, you will need to update the code to reflect the new error response text. Please note that as exact error message wording can change at any time, we strongly discourage hardcoding the specific message text when processing responses from the API."
Today my requests failed and a captcha image was provided in my error log that produced a 404.
Error I received:
"Our systems have detected unusual traffic from your computer network. This page checks to see if it's really you sending the requests, and not a robot."
"The block will expire shortly after those requests stop. In the meantime, solving the above CAPTCHA will let you continue to use our services."
I have since found the service to be back running in small doses without any code changes required.
I suggest to try again and limit the number of requests until the service is back 100%.

Do we need backend integration for recaptchV3

We are planning to use recaptcha-V3 on our website. To try this out first and do a phased released - one suggestion was just to have the front-end integration (without backend integration for site verification) and then monitor using the reCaptcha console for unusual activities. If we find unusual activities, we'll then turn on an extra verification on the login page (controlled by a switch).
So the key question I have got is - Can we integrate recaptchaV3 only on the front-end and not on the backend - and use the Admin console to monitor activities?
Yes you can do that. without any backend integration it can be done but that will not be a good way to implement this . The secret key and as well as the request token will be exposed in client browser.
Try this code :
<script src="http://www.google.com/recaptcha/api.js?render={recaptchaSiteKey}"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('recaptchaSiteKey', {action: 'homepage'}).then(function(token) {
var recaptchaSecret={recaptchaSecret};
var responseString = "https://www.google.com/recaptcha/api/siteverify?secret="+recaptchaSecret+"&response="+token;
$.ajax({
url:responseString
//your code
});
});
});
</script>

Reset Session in Microsoft BotFramework with NodeJS

I am working on a simple project where my primary requirement is to use Microsoft BotFramework's WebChat to create a custom inline app. I want to add a button at the header which will be a reset button, which will restart the session and remove all the messages but will maintain the same conversation ID. I am not finding any useful documentation on how can I send a message to the bot from a button click. Also How can I notify the bot which conversation's session needs to be erased.
This is the sample code I am using,
<!DOCTYPE html>
<html>
<head>
<link href="stylesheets/botchat.css" rel="stylesheet" />
</head>
<body>
<div id="bot"/>
<script src="javascripts/botchat.js"></script>
<script>
BotChat.App({
directLine: { secret: '' },
user: { id: 'you' },
bot: { id: 'agent' },
sendTyping: true,
resize: 'detect'
}, document.getElementById("bot"));
</script>
</body>
</html>
I have also checked that we have something called deleteUserData event, but I am not sure how do I use this in my scenario.
You can do this via back channel. In a nutshell, what will happen is the web page that's hosting webchat will connect to the same DirectLine instance your webchat is using, which will allow the page to communicate with the bot. You can then set up a handler for a reset event which will call the appropriate code to handle resetting the state.
You can see how to set up back channel here:
https://github.com/MissionMarsFourthHorizon/operation-max/tree/master/Node/exercise8-BackChannel
Try session.clearDialogStack(); or delete session.userData;

Modernizr detecting geolocation api not working

I'm trying to get simple code for modernizr js to say whether or not a browser can support geolocation api. Here's my code.
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
<!-- check if geolocation works on browser -->
<script>
if(Modernizr.geolocation)
{
document.getElementById("geoConfirm").innerHTML = "This will work on this browser!";
}
else{
document.getElementById("geoConfirm").innerHTML = "This will not work on this browser";
}
</script>
<p id="geoConfirm">Test</p>
It's such simple code but it's not working, and it's bugging me because there's barely anything to go over. Thoughts?

Facebook Apps Performance - Insights

How to i know my apps perfomance and page loding ratings in Insights.
i referred App on Facebook tutorial,
through that i used following methods in my code,
FB.Canvas.setDoneLoading , FB.Canvas.Prefetcher.addStaticResource and
FB.Canvas.Prefetcher.setCollectionMode.
My Code:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({ appId: '*****', cookie: true, xfbml: true, oauth: true });
FB.Canvas.Prefetcher.setCollectionMode(FB.Canvas.Prefetcher.COLLECT_AUTOMATIC);
FB.Canvas.Prefetcher.addStaticResource("http://example.com/fb/js/fb.js");
FB.Canvas.Prefetcher.addStaticResource("http://example.com/fb/css/fb.css");
FB.Canvas.Prefetcher.addStaticResource("http://example.com/fb/css/style.css");
FB.Canvas.setDoneLoading();
};
</script>
<script type="text/javascript" src="//connect.facebook.net/en_US/all.js"></script>
when i see in insight dashboard it showing like,
is there any wrong.. why its not showing... have i call that methods in correct place..?
thanks in advance..
Have you tried the Graph API Explorer to ensure that they're working in that respect?
http://developers.facebook.com/tools/explorer/?method=GET&path=2439131959%2Fstaticresources
Use the dropdown at the top right to select your application (you should be logged in as the owner of the app you want to test); your selection will replace the &path=nnn in the input field to the right of the GET request in the explorer.
Make sure that you're not getting an error response from Facebook. This is how I've checked my prefetch methods; I haven't used the insights dashboard yet.

Resources