Giter VIP home page Giter VIP logo

microsoft / botbuilder-samples Goto Github PK

View Code? Open in Web Editor NEW
4.3K 238.0 4.8K 81.97 MB

Welcome to the Bot Framework samples repository. Here you will find task-focused samples in C#, JavaScript/TypeScript, and Python to help you get started with the Bot Framework SDK!

Home Page: https://github.com/Microsoft/botframework

License: MIT License

C# 24.94% HTML 28.36% JavaScript 23.60% TypeScript 6.70% Shell 0.71% Batchfile 0.36% TSQL 0.23% PowerShell 2.84% ASP.NET 0.02% Java 5.12% Python 3.84% CSS 3.28%
bots bot-framework sdk dotnet javascript typescript yeoman vsix microsoft-congnitive-services python

botbuilder-samples's Introduction

Bot Framework Samples

Overview

This branch contains samples for the released version of the Microsoft Bot Framework V4 SDK for .NET, JS and Python. If you need samples for the Bot Framework V3 SDK, go here.

Getting the samples

To use the samples, clone this GitHub repository using Git.

    git clone https://github.com/Microsoft/BotBuilder-Samples.git
    cd BotBuilder-Samples

Sample lists

Samples are designed to illustrate functionality you'll need to implement to build great bots!

Bot essentials

Sample Name Description .NET JavaScript Python Java
2 Echo bot Demonstrates how to receive and send messages. .NET Core JavaScript, TypeScript Python Java
3 Welcome user Introduces activity types and provides a welcome message on conversation update activity. .NET Core JavaScript, TypeScript Python Java
5 Multi turn prompts Demonstrates how to use waterfall dialog, prompts, and component dialog to create a simple interaction that asks the user for name, age, and prints back that information. .NET Core JavaScript, TypeScript Python Java
6 Using cards Introduces all card types including thumbnail, audio, media etc. Builds on Welcoming user + multi-prompt bot by presenting a card with buttons in welcome message that route to appropriate dialog. .NET Core JavaScript, TypeScript Python Java
7 Adaptive cards Demonstrates how the multi-turn dialog can use a card to get user input for name and age. .NET Core JavaScript Python Java
8 Suggested actions Demonstrates how to enable your bot to present buttons that the user can tap to provide input. .NET Core JavaScript Python Java
13 Core bot Core bot shows how to use cards, dialog, and Language Understanding (LUIS). .NET Core, .NET Web JavaScript, TypeScript Python Java
15 Handling attachments Demonstrates how to listen for/handle user provided attachments. .NET Core JavaScript Python Java
40 TIMEX resolution Demonstrates various ways to parse and manipulate the TIMEX expressions you get from LUIS and the DateTimeRecognizer used by the DateTimePrompt. .NET Core JavaScript Python Java
43 Complex dialogs Demonstrates different ways for composing dialogs. .NET Core JavaScript Python Java
45 State management Demonstrates how to use state management and storage objects to manage and persist state. .NET Core JavaScript Python Java

Advanced bots

Sample Name Description .NET JavaScript Python Java
1 Console echo bot Introduces the concept of adapter and demonstrates a simple echo bot on console adapter and how to send a reply and access the incoming message. .NET Core JavaScript, TypeScript Python
1 Browser echo bot Demonstrates how to host a bot in the browser using Web Chat and a custom Web Chat Adapter. ECMAScript 6
16 Proactive messages Demonstrates how to send proactive messages to users. .NET Core JavaScript, TypeScript Python Java
17 Multilingual bot Using translate middleware to support a multi-lingual bot. Demonstrates custom middleware. .NET Core JavaScript Python Java
19 Custom dialogs Demonstrates complex conversation flow using the Dialogs library. .NET Core JavaScript Python Java
21 Application Insights Demonstrates how to add telemetry logging to your bot, storing telemetry within Application Insights. .NET Core JavaScript Java
23 Facebook events Integrate and consume Facebook specific payloads, such as post-backs, quick replies and opt-in events. .NET Core JavaScript Python Java
42 Scale out Demonstrates how you can build your own state solution from the ground up that supports scaled out deployment with ETag based optimistic locking. .NET Core Python Java
44 Basic custom prompts Demonstrates how to implement your own basic prompts to ask the user for information. .NET Core JavaScript Python Java
47 Inspection middleware Demonstrates how to use middleware to allow the Bot Framework Emulator to debug traffic into and out of the bot in addition to looking at the current state of the bot. [.NET Core][cs#47] JavaScript Python Java
70 Styling webchat This sample shows how to create a web page with custom Web Chat component. ECMAScript 6

Authentication samples

Sample Name Description .NET JavaScript Python Java
18 OAuth authentication Bot that demonstrates how to integrate OAuth providers. .NET Core JavaScript Python Java
24 MSGraph authentication Demonstrates bot authentication capabilities of Azure Bot Service. Demonstrates utilizing the Microsoft Graph API to retrieve data about the user. .NET Core JavaScript Python Java
46 Teams authentication Demonstrates how to use authentication for a bot running in Microsoft Teams. .NET Core JavaScript Python Java
84 Certificate authentication Demonstrates how to use Certificates to authenticate the bot .NET Core JavaScript
85 Subject name/issuer authentication Demonstrates how to use the subject name/issuer authentication in a bot .NET Core JavaScript

Custom question answering samples

Sample Name Description .NET JavaScript Python Java
12 Custom question answering (simple) Demonstrates how to use Custom question answering to have simple single-turn conversations .NET Core JavaScript
48 Custom question answering (advanced) Demonstrates how to integrate Multiturn and Active learning in a Custom question answering bot [.NET Core][cs#48] JavaScript

Teams samples

Sample Name Description .NET JavaScript Python Java
25 Message Reactions Demonstrates how to create a simple bot that responds to Message Reactions .NET Core JavaScript Java
46 Authentication Demonstrates how to use authentication for a bot running in Microsoft Teams. .NET Core JavaScript Python Java
50 Messaging extensions - search A Messaging Extension that accepts search requests and returns results. .NET Core JavaScript Python Java
51 Messaging extensions - action A Messaging Extension that accepts parameters and returns a card. Also, how to receive a forwarded message as a parameter in a Messaging Extension. .NET Core JavaScript Python Java
52 Messaging extensions - auth and config A Messaging Extension that has a configuration page, accepts search requests and returns results after the user has signed in. .NET Core JavaScript
53 Messaging extensions - action preview Demonstrates how to create a Preview and Edit flow for a Messaging Extension. .NET Core JavaScript Python Java
54 Task module Demonstrates how to retrieve a Task Module, and values from cards in the Task Module, for a Messaging Extension. .NET Core JavaScript Python Java
55 Link unfurling A Messaging Extension that performs link unfurling. .NET Core) JavaScript Python Java
56 File upload Demonstrates how to obtain file consent, and upload files to Teams from a bot. Also, how to receive a file sent to a bot. .NET Core JavaScript Python Java
57 Conversation bot Demonstrates various features of bots on Teams: message all members in a Team or Channel, @mention a user from a bot, update previously sent messages, etc. .NET Core JavaScript Python Java
58 Start new thread in a channel Demonstrates creating a new thread in a channel. .NET Core JavaScript Python Java

Skills samples

Sample Name Description .NET JavaScript Python Java
80 Skills - simple bot to bot This sample shows how to connect a skill to a skill consumer. .NET Core JavaScript Python Java
81 Skills - skill dialog This sample shows how to connect a skill to a skill dialog consumer. .NET Core JavaScript Python Java
82 Skills - SSO with CloudAdapter This sample shows how use SSO with skills and CloudAdapter. .NET Core JavaScript NA NA

Experimental / preview samples

A collection of experimental samples exist, intended to provide samples for features currently in preview or as a way to solicit feedback on a given design, approach, or technology being considered by the Bot Framework Team.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Reporting security issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at [email protected]. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

Copyright (c) Microsoft Corporation. All rights reserved.

botbuilder-samples's People

Contributors

arturl avatar batta32 avatar benbrown avatar carlosscastro avatar ceciliaavila avatar chrimc62 avatar cleemullins avatar danieladu avatar daveta avatar dependabot[bot] avatar ejadib avatar enzocano avatar ericdahlvang avatar gabog avatar gurvsing avatar jasonsowers avatar johnataylor avatar kaiqb avatar mrivera-ms avatar mzyhappy avatar pcostantini avatar sgellock avatar stevengum avatar sw-joelmut avatar tomlm avatar tracyboehrer avatar tsuwandy avatar virtual-josh avatar vishwacsena avatar willportnoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

botbuilder-samples's Issues

[.NET] Can't run DirectLine sample

Hello,

I have a bot registered on bot framework. I have it's bot-id, it's Microsoft app id, and its Microsoft secret password. I have also configured DirectLine as a channel on it.

I have downloaded the core-DirectLine sample, and I did the following changes before running the sample:

  • To the Web Api Project (Bot's logic), I modified the web.config values:
 <add key="BotId" value="MY_BOT_ID_HERE" />
 <add key="MicrosoftAppId" value="MY_APP_ID_HERE" />
 <add key="MicrosoftAppPassword" value="MY_PASS_HERE" />
  • To the Console Application (DirectLine client), I modified the app.config values:

<add key="DirectLineSecret" value="DIRECT_LINE_SECRET_HERE"/>
<add key="BotId" value="MY_BOT_ID_HERE" />

One thing to mention is that when I configured DirectLine, it gives me two secret keys but I think is the same using one or another.

I have the Bot app deployed on Azure, and I run the console app locally.

What happens:

Whenever I send a message from Skype (bot user), the client doesn't receive anything. Similarly, when I write something on the DirectLineClientApp, the bot user doesn't receive anything via the bot.

This is what I get when I send something via direct line client app:

screen shot 2017-01-25 at 14 25 16

But nothing on Skype bot. And the same vice versa.

Any help?

Thanks.

[Node] bot always replies with default message

[15:45:19] Emulator listening on http://[::]:9002
[15:45:37] -> POST 202 [conversationUpdate]
[15:45:50] -> POST 202 [message] hi
[15:45:52] <- POST 200 Reply[message] Sorry, I did not understand 'hi'. Type 'help' if y...
[15:45:59] -> POST 202 [message] help
[15:46:00] <- POST 200 Reply[message] Sorry, I did not understand 'help'. Type 'help' if...
[15:47:09] -> POST 202 [message] Help
[15:47:10] <- POST 200 Reply[message] Sorry, I did not understand 'Help'. Type 'help' if...
[15:50:41] -> POST 202 [message] search hotels in Seattle
[15:50:42] <- POST 200 Reply[message] Sorry, I did not understand 'search hotels in Seat...

I have imported LuisBot.json into LUIS, updated .env with its URL and App ID and password and I'm trying it via the Emulator under Linux. Before importing to LUIS, I tried to "test this sample as-is, using the hosted sample application", as mentioned in the README but got

[15:29:41] -> POST 401 [conversationUpdate]
[15:29:41] Error: The bot's MSA appId or passsword is incorrect.
[15:29:41] Click here to edit your bot's MSA info.

and wasn't sure what to fill in.
I notice the original URL in the sample code is https://api.projectoxford.ai/luis/v1/application?...
whereas mine is https://api.projectoxford.ai/luis/v2.0/apps/...
Could that be an issue?

Return heroCard in blog-LUISActionBinding

Hello,
I'm wondering how I can return a herocard in the fulfill function in the ActionBinding framework? The examples are all strings in the callback. For example, in the WeatherInPlaceAction, I want to show a sunny picture with temperature instead of just a sentence. Really appreciate your help!

Yan

[Question] core-GlobalMessageHandlers cancel with confirmation

I want to create Cancel scrollable like in core-GlobalMessageHandlers, but is should show confirmation dialog. My problem is that i can't receive dialog response from IDialog inside ScrollableBase.
I have this code

var cancelDialog = new CancelDialog();
var interruption = cancelDialog.Void<object, IMessageActivity>();
this.task.Call(interruption, null);
await this.task.PollAsync(token);

But how can I process cancelDialog response, so I can call this.task.reset() ?

[.NET] Problems with speech to text sample

This may not be specific to this sample as I see an interesting error on all projects I run.

First, the immediate window is getting this a good number of times:
iisexpress.exe Warning: 0 : Service url localhost:62141 is not trusted and JwtToken cannot be sent to it.

I feel like this may be causing my issue where I can push an attachment to the emulator, but if it is a wav file I break to the catch exception on the try catch. Anything not a wav file gives me the correct output, but the wav seems to throw an exception when it tries to hit the bing service. I was hoping someone may have some information on this issue.

[Help] Use path of file instead of stream

Hi everybody,

is there some way to use 'request', but instead of stream.pipe a file stored in my local machine? I'm asking this because I need to convert mp4 to wav before processing with your Speech API.

I am referring to this:

stream.pipe(request.post(speechRequestData, (error, response, body) => {
        if (error) {
            reject(error);
        }
        else if (response.statusCode != 200) {
            reject(body);
        }
        else {
            resolve(JSON.parse(body).header.name);
        }
    }));

[Feature Request] Non ASP .NET sample?

Can we have a sample that doesn't use ASP .NET to interact with the bot API etc.? Just something super simple so that we have a distilled example of the bot API calls without the ASP .NET stuff around it.

[Question] CarouselCards issue with attachmentLayout.carousel

Below code only show the hero card listing but not the attachmentLayout.carousel.

function CreateHeroCard(session, builder, title, subtitle, text, url, buttons){
    var card = new builder.HeroCard(session)
        .title(title)
        .subtitle(subtitle)
        .text(text)     
        .images([builder.CardImage.create(session, url)])
        .buttons(buttons);      
    return card;
}

function SendHeroCard(session, builder){
     var request = require("request");
    var url = 'http://example.com/fetch/' + session.userData.profile.userToken + '/' + session.userData.profile.Level1;
    request(url, function (error, response, body)
    {
        if (!error && response.statusCode == 200) {
            var attachmentsArr = [];
            var attachmentsChoice = [];
            var jsondata = parseJson(body);
            var nextLevel = treeRoot.first(function (node) {
                return node.model.attributes.id === session.userData.profile.treeSelectdNodeId; // 1.1
            });
            for (var i = 0; i < jsondata.length; i++) {
                var secondListChild = [];
                if(nextLevel.model.children.length > 0) { 
                    for (var j = 0; j < nextLevel.model.children.length; j++) {
                        if (nextLevel.model.children[j].attributes.title != '' && nextLevel.model.children[j].attributes.title != undefined) {
                            secondListChild.push(builder.CardAction.imBack(session, nextLevel.model.children[j].attributes.id+":"+ jsondata[i].HierarchyLevel2, nextLevel.model.children[j].attributes.title));
                        }
                        attachmentsChoice.push(nextLevel.model.children[j].attributes.id+":"+ jsondata[i].HierarchyLevel2);
                    }
                    secondListChild.push(builder.CardAction.imBack(session, "previous menu", "previous menu"));
                }
                var card = CreateHeroCard(session, builder, jsondata[i].HierarchyLevel2, "RITS Builder Result", "", "http://hsplbot.headfitted.in/images/RockwellLogo3.png", 
                secondListChild);
                attachmentsArr.push(card);
                
            }
            var reply = new builder.Message(session)
                    .textFormat(builder.TextFormat.xml)
                    //.attachmentLayout(builder.AttachmentLayout.carousel)
                    .attachments(attachmentsArr);
            //session.send(reply);
            builder.Prompts.choice(session, reply, attachmentsChoice);
        } 
    });
};

If you review my code. I commented
//.attachmentLayout(builder.AttachmentLayout.carousel)

If you remove the comment of this line below error received in bot node

Error: Request to 'https://smba.trafficmanager.net/v3/conversations/29%3A1z7akAj7gyQq-8N4O-hkjHHJHGKJsdsd/activities' failed: [400] Bad Request
    at Request._callback (/home/node_modules/botbuilder/lib/bots/ChatConnector.js:413:46)
    at Request.self.callback (/home/node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/home/node_modules/request/request.js:1081:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/home/node_modules/request/request.js:1001:12)
    at IncomingMessage.g (events.js:291:16)
    at emitNone (events.js:91:20)

[Question] CSharp/core-BasicMultiDialog: RootDialog.cs

Hey there, I've been trying to use your /CSharp/core-BasicMultiDialog/Dialogs/RootDialog.cs example and this.NameDialogResumeAfter and this.AgeDialogResumeAfter in the SendWelcomeMessageAsync and NameDialogResumeAfter methods are throwing errors? Do I need to pass parameters to them? line 37 and 46 btw

[Question] Node\intelligence-LUIS can not recognize my query

I'm trying the Node\intelligence-LUIS example locally in the bot-emulator, it replies

Sorry, I did not understand 'Hotels'. Type 'help' if you need assistance.

no matter what I type, even 'help'.

I have specified my LUIS endpoint, and I'm sure the LUIS service is OK because I can get normal results by typing directly in the browser url. How can I get this example work? Thanks

[Question] Store user data

I am trying to store some user data for a bot but I cannot find the right way. I used a .txt file and this method works but when I upload the project all the users that will use the bot, will share the same file and I don't want to do that. I want to store some settings for every different user that will use the bot and keep these settings for ever.
I tried Stateclient and GetUserData but the stored values are disappearing. I am doing something wrong ?
How can I implement this?

[Question] Always get a 400 Bad Request response.

Hi,

I can't get this code works with the Bot Framework Emulator. I always have a 400 BAD REQUEST response on Conversation.SendAsync(activity, () => new RootLuisDialog()).

I've triple checked my modelId and SuscriptionKey, but no change.

Thanks.

[.NET] Are these samples outdated?

Hi there.

sorry for my English. I try the undersatnd the Microsoft Bot Builder and the Dialogs methods.

In the samples the Microsoft Bot Builder 3.2.1.0 is used.

In the namespace Microsoft.Bot.Builder.Dialogs there is a class called PromptStyler

The void method "Apply" uses IList option.

In the new assembly 3.5.0.0 there is IReadOnlyList options.

When I updated the solution I can't build the Bot. Why is there a change from IList to IReadOnlyList?

And how can I fix the issue?

-->Sample I used: SearchPowerBots > Project "Search.Dialogs"

Many thanks
Arash

[Question] Microsoft.Cognitive.LUIS.ActionBinding

Hi.

I was trying to implement Action Binding on my bot that uses Luis Dialogs but when creating an Action, Visual Studio can't find the ActionBinding namespace in Microsoft.Cognitive.LUIS.ActionBinding

I copied the imports from here

I have the latest Nuget package in my project for Microsoft.Cognitive.LUIS which is v2.0.2

Below my packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Autofac" version="4.6.0" targetFramework="net46" />
  <package id="Chronic.Signed" version="0.3.2" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net46" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net46" />
  <package id="Microsoft.Bot.Builder" version="3.8.1.0" targetFramework="net46" />
  <package id="Microsoft.Cognitive.LUIS" version="2.0.2" targetFramework="net46" />
  <package id="Microsoft.IdentityModel.Protocol.Extensions" version="1.0.4.403061554" targetFramework="net46" />
  <package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net46" />
  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" targetFramework="net46" />
  <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net46" />
  <package id="System.IdentityModel.Tokens.Jwt" version="4.0.4.403061554" targetFramework="net46" />
</packages>

Any tips on getting it to work?

display attachment content

can I display attachment content if so instead of attachment.contenttype what should I use???
By attachment I mean a audio file

How to Refresh WebChat Token

Hi
I am using Webchat in my web site application
I am generated Token using WebChat Secret, Not using DirectLine

I am not able to find API and process to Refresh token after 30 min for my Webchat
due to this chat session is expired after 30 min and stop responding

If I regenerate token with secret my conversation data will lost

Downloaded (image) file is different from received file

The description here, for receiving an attachment, works well, but when I try it with an image I get the following problem. The original (jpg) file looks like this in a text editor:
\377\330\377\340^@^PJFIF^@^A .....
but the file, after being received and then uploaded (to Amazon S3) looks like this:
\375\375\375\375^@^PJFIF^@^A .....
So all of the escape sequences have been converted to this \375 sequence. Is it obvious why that would be happening? Here's what I'm doing:

request({
url: attachment.contentUrl,
headers:{
'Authorization' : 'Bearer ' + connector.accessToken,
'Content-Type': 'application/octet-stream'
}
}, function (error, response, body){
const Buff = Buffer.from(body,'binary');
var s3Params = {
Bucket: ...,
Key: ....,
Body: Buff,
ACT: ....
};

s3.putObject(s3Params,function(s3err,s3res){
      stuff
});

});

Writing to S3 has worked before, so I don't think that's the problem. I just can't figure out why the files would be identical other than those escape sequences, and was wondering if someone recognizes this.

Cannot resume conversation after authrorization

An error has occurred. {"error":"invalid_client","error_description":"AADSTS70002: 'client_assertion' or 'client_secret' is required for the 'client_credentials' grant type.\r\nTrace ID:some id goes here \r\nCorrelation ID: some id goes here \r\nTimestamp: 2017-04-04 10:41:00Z","error_codes":[70002],"timestamp":"2017-04-04 10:41:00Z","trace_id":"some id goes here","correlation_id":"some id goes here"} Microsoft.Bot.Connector.MicrosoftAppCredentials+OAuthException at Microsoft.Bot.Connector.MicrosoftAppCredentials.d__25.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.MicrosoftAppCredentials.d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.MicrosoftAppCredentials.d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.BotState.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.BotStateExtensions.d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.ConnectorStore.-LoadAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.-LoadAsync>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.BotDataBase1.d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Bot.Builder.Dialogs.Internals.BotDataBase1.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.DialogTaskManagerBotDataLoader.d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.LogPostToBot.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Conversation.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Conversation.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Conversation.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at app.Controllers.OAuthCallbackController.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.TaskHelpersExtensions.d__3`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext() An error has occurred. Response status code does not indicate success: 401 (Unauthorized). System.Net.Http.HttpRequestException at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() at Microsoft.Bot.Connector.MicrosoftAppCredentials.d__25.MoveNext()

This happens when bot instance handles multiple bots.
I'm using MultiCredentialProvider for authentication :

public class MultiCredentialProvider : ICredentialProvider
    {
        public Dictionary<string, string> Credentials = new Dictionary<string, string>
        {
{
            "user1","pass1"
    },
{
           "user1","pass1"
        };

        public Task<bool> IsValidAppIdAsync(string appId)
        {
            return Task.FromResult(this.Credentials.ContainsKey(appId));
        }

        public Task<string> GetAppPasswordAsync(string appId)
        {
            return Task.FromResult(this.Credentials.ContainsKey(appId) ? this.Credentials[appId] : null);
        }

        public Task<bool> IsAuthenticationDisabledAsync()
        {
            return Task.FromResult(!this.Credentials.Any());
        }
    }

  
     [BotAuthentication(CredentialProviderType = typeof(MultiCredentialProvider))]
    public class MessagesController : ApiController
    {

Any idea ? Should i add something to resumption cookie or ? Your ideas/suggestions are welcomed !

[Question] How to send conversation data from bot to an email address

** if (message.Text.Equals("current city", StringComparison.InvariantCultureIgnoreCase))
{
string userCity;

            var city = context.ConversationData.Get<string>(ContextConstants.CityKey);

            if (context.PrivateConversationData.TryGetValue(ContextConstants.CityKey, out userCity))
            {
                await context.PostAsync($"{userName}, you have overridden the city. Your searches are for things in  {userCity}. The default conversation city is {city}.");
            }
            else
            {
                await context.PostAsync($"Hey {userName}, I'm currently configured to search for things in {city}.");

context.ConversationData.SetValue(ContextConstants.UserNameKey, result);
}
} **

I want to send email from the bot with the context of conversation data. Can you help me please ?
I want to

[Question] Add an Image to a button

Hi, I am trying to use CardAction to add a button with an image in it. I was reading through the documentation and I did what it says there, but it is still not working.

builder.CardAction.openUrl(session,"", "Go to Link").image("http://www.clker.com/cliparts/Y/w/d/M/s/y/call-icon-hi.png")

Am I doing anything wrong?
Also. Is there any way to use icons in the text like glyph icons or font awesome icons?

[Question] does bing speech api only support audio/wav files?

Is it there a way to add support for audio/aac and video/mp4 file formats used in Facebook Messenger, as currently the Bing Speech API is only able to handle audio/wav files? For example, is there a way to convert audio/aac or video/mp4 files into audio/wav files online?

How to reverse geocoding using place_id ?

In my database is stored place_id. How to make reverse geocoding based on place_id and just show the map to the user ?

<member name="F:Microsoft.Bot.Builder.Location.LocationOptions.ReverseGeocode">
            <summary>
            Use this option if you want the location dialog to reverse lookup
            geo-coordinates before returning. This can be useful if you depend
            on the channel location service or native control to get user location
            but still want the control to return to you a full address.
            </summary>
            <remarks>
            Due to the accuracy of reverse geo-coders, we only use it to capture
            <see cref="P:Microsoft.Bot.Builder.Location.PostalAddress.Locality"/>, <see cref="P:Microsoft.Bot.Builder.Location.PostalAddress.Region"/>,
            <see cref="P:Microsoft.Bot.Builder.Location.PostalAddress.Country"/>, and <see cref="P:Microsoft.Bot.Builder.Location.PostalAddress.PostalCode"/>
            </remarks>
        </member>

Here is not mentioned place_id.

[Question] Bing spell check mode

The spell checker didn’t work for me until I added the mode:

var values = new Dictionary<string, string>
{
{ "text", text },
{ "mode", "spell" }
};

Is "spell" the correct mode for Chatbots?

use encoding : null to download binary content

Hi,

Thanks for the code sample BotBuilder-Samples/Node/core-ReceiveAttachment/app.js.
But I've found an issue: the download of binary content requires to set encoding with a null value
see http://stackoverflow.com/questions/14855015/getting-binary-content-in-node-js-using-request for more details and https://github.com/request/request (search encoding: null)

I suggest this fix

var requestWithToken = function (url, contentType, token) {
return request({
url: url,
encoding : null,
headers: {
'Authorization': 'Bearer ' + token,
'Content-Type': contentType
}
});
};

// for other case
var requestSimple = function (url, contentType) {
return request({
url: url,
encoding : null,
headers: {
'Content-Type': contentType
}
});
};

best regards,

[Question] ActionBinding - Resolution in matching entity throwing InvalidCastException when using Custom List Entities

I faced a problem yesterday when the user typed a value that is a list entity which would cause an InvalidCastException to be thrown in the ActionBinding project.

Exception message: Object must implement IConvertible

After some debugging (pictures attached) I found the problem and came up with a temporary fix.

In LuisActionResolver.cs (line ~445)

Before:

if (matchingEntity != null)
{
	var paramValue = matchingEntity.Resolution != null && matchingEntity.Resolution.Count > 0
		? matchingEntity.Resolution.First().Value
		: matchingEntity.Entity;

	result &= AssignValue(action, property, paramValue);
}

After:

if (matchingEntity != null)
{
	var paramValue = matchingEntity.Resolution != null && matchingEntity.Resolution.Count > 0
		? matchingEntity.Resolution.First().Value
		: matchingEntity.Entity;

	if (paramValue is JArray)
	{
		paramValue = (paramValue as JArray).First();
	}

	result &= AssignValue(action, property, paramValue);
}

(and the required imports)

It works for me since I don't have the same synonym in multiple entries.

I could create a pull request but I'm not sure if this is the best approach to solve the problem.

1

2

[Question] LUIS custom dimension entity

I realise this is not exactly related to bot builder but i dont know where else to put LUIS related questions.

What i want to do is define a hierarchical entity with the following template "the car has x doors and y seats"

Now the inbuilt dimension entity is pretty unreliable when it comes to recognizing "x doors" and "y seats" so i want to create my own entities called 'doors' and 'seats' which i can do by highlighting the sample utterance and labeling however LUIS doesn't seem to be able to generalize x and y, so if my sample utterance is 5 doors and 7 seats then it wont recognize 3 doors and 5 seats correctly.

How can i get LUIS to recognize a number followed by a keyword as a single entity where number is variable?

context.Call does not execute properly

In my messages controller have this :

public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
        {
           
            if (activity.Type == ActivityTypes.Message)
            {
                try
                {
                    await Conversation.SendAsync(activity, () => new RootDialog());

Than, in The RootDialog :

 private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument)
        {
            var msg = await argument;

            try
            {
                switch (msg.Text)
                {
                  case "FirstCallBack" : 
                  break;
                  case "SecondCallBack" : 
                  break;
                  default:
                  context.Call(new RootLuisDialog(), RootLuisDialog.FinishLuisDialog);

The default option does not executes properly :

In the debugger, when first time msg.text = "hi", default case is hit but it does not "call" LUIS dialog.
Second time LUIS dialog executes properly.

Any idea why this happens this way ?

[Question] Direct line v3 - reply to bot on Attachment having buttons on it.

Hi ALL,

I making project of hitting MS bot via Direct Line Api V3.
direct line is enabled.
token is generating.
communicationg via websocket url .
then able to post message back via Direct line v3 post method.
now , problem is , that, how to post json response back, if bot earlier messaged me, having hero card with buttons
on it .

I am not able to post button action via Direct line post api.

SendAttachment samples should illustrate upload and base64 data URIs

https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-SendAttachment
https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/core-SendAttachment

These samples do a good job on the attachment side, but don't illustrate upload.

They should show:

  1. Uploading via the attachment API (https://docs.botframework.com/en-us/restapi/connector/#!/Conversations/Conversations_UploadAttachment)
  2. Including an attachment inline as a base64 data URI (example here, search for "base64": https://docs.botframework.com/en-us/core-concepts/attachments/)

Node samples and env variables

A lot of samples for node requires defining some env variables, like MICROSOFT_APP_ID, env, PORT. A little bit tricky for me was BING_MAPS_KEY for contoso_flowser sample, which is did not mention in README at all.

IMHO, whole this stuff with variables can be put under management with dotenv-safe (https://github.com/rolodato/dotenv-safe) module via .env.example file. In short: dotenv-safe is same as dotenv, but you can list required environment variables in .env.example file (with empty values), then push it to any public repository. Any user will be required to build own .env file with ALL stuff mentioned in .env.examples to run app. So, you can list any API keys for sample in .env.example. Nice

core-MultiDialogs no Buttons in Emulator

In the preview picture for the emulator of the readme, there are buttons to click (hotels and flights).

When I run the example in the emulator, it is just text. Can't figure out why.
Isn't this Code just sending text?

builder.Prompts.choice( session, 'Are you looking for a flight or a hotel?', [Flights.Label, Hotels.Label], { maxRetries: 3, retryPrompt: 'Not a valid option' });

bildschirmfoto 2017-02-10 um 14 53 39

[Feature Request] Example of running botframework in AWS API Gateway

I have a bot deployed on AWS API Gateway which is using serverless technology. The bot works fine on my machine and I can see requests coming in to /api/messages in API Gateway. But these messages are not being passed to the connector.listen().

Is there any guidance on how requests should interact with the botframework running on this platform?

[Question] Problem with the code...

Hi ,
I ran this code few days ago it was running fine . But now I dowloaded this code from git and deployed it to azure by changing appid and app password , when I run it now i am getting "Did you upload an audio file? I’m more of an audible person. Try sending me a wav file".

Please help.

speech_scrennshot

Question: Select menu instead of Prompt.Choice?

Hello-
I see the ability to have a Prompt.Choice in the Dialog but I am wondering if the ability to use a series of two select menus is supported yet? Basically a Rich form instead of a form with the basic lists and bullet points.

Thanks!

Context.Call doesn't call Dialog's StartAsync

I have the following code in my rootDialog (see below). I am detecting if a user has a profile set up in UserData, if not, I want them to go to the BotUserProfile dialog. There is a series of DialogPrompts in that Dialog, so I need to use Context.Call (not Context.Forward).

The problem is that when I call Context.Call from MessageReceivedAsync, it does not appear to call StartAsync in the child dialog. In fact, it's not clear to me how any methods get called in the child dialog and all the examples of Context.Call that I can find are for FormFlow, not custom dialogs. Context.Call appears to just immediately return the ResumeAfter callback.

BUT, If I move that Context.Call code into the RootDialog's StartAsync, then Context.Call does call the child dialog's StartAsync. This wont work for me as StartAsync is called once per conversation, and I need this check to be performed on every message sent.

Thanks for any help.

    public async Task StartAsync(IDialogContext context)
    {
        context.Wait(this.MessageReceivedAsync);
    }

    public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
    {

        BotUserProfile botUserProfile;

        if (!context.UserData.TryGetValue("botUserProfile", out botUserProfile))
        {
            if (botUserProfile == null)
            {
                try
                {
                    //this doesn't seem to be calling _botUserProfileDialog's StartAsync
                    context.Call(_botUserProfileDialog, ResumeAfterDialog);
                }
                catch (Exception e)
                {

                    await context.PostUpAsync(e.ToString());
                }
            }
            else
            {
                {
                    if (botUserProfile.ActiveUntil < DateTime.UtcNow)
                    {
                        context.UserData.RemoveValue("botUserProfile");
                        context.Call(_botUserProfileDialog, ResumeAfterDialog);
                    }
                }
            }
            ...
        }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.