Giter Site home page Giter Site logo

bot-handoff's Introduction

https://palindromed.github.io/palindromed/

My Blog

powered by fastpages

What To Do Next?

Great! You have setup your repo. Now its time to start writing content. Some helpful links:

Note: you may want to remove example blog posts from the _posts, _notebooks or _word folders (but leave them empty, don't delete these folders) if you don't want these blog posts to appear on your site.

Please use the nbdev & blogging channel in the fastai forums for any questions or feature requests.

bot-handoff's People

Contributors

billba avatar palindromed avatar rnrneverdies 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

bot-handoff's Issues

Expose commands through API or backchannel events

Right now it looks like the only way to trigger these commands is via text. Would it be possible to get this functionality exposed as part of the API, either explicitly or via passing in functions that determine whether or not a command should be executed?

botframework 4.0

Is there any plan to port this very useful code to microsoft latest botframework 4.0?

could not get response from bot and it is giving error as cant set headers after they are sent.

please find the Error message below in azure

Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:356:11)
at applyHeaders (D:\home\site\wwwroot\node_modules\cors\lib\index.js:153:15)
at applyHeaders (D:\home\site\wwwroot\node_modules\cors\lib\index.js:149:11)
at applyHeaders (D:\home\site\wwwroot\node_modules\cors\lib\index.js:149:11)
at cors (D:\home\site\wwwroot\node_modules\cors\lib\index.js:184:7)
at D:\home\site\wwwroot\node_modules\cors\lib\index.js:221:17
at originCallback (D:\home\site\wwwroot\node_modules\cors\lib\index.js:211:15)
at D:\home\site\wwwroot\node_modules\cors\lib\index.js:216:13
at optionsCallback (D:\home\site\wwwroot\node_modules\cors\lib\index.js:196:9)
at corsMiddleware (D:\home\site\wwwroot\node_modules\cors\lib\index.js:201:7)
at Layer.handle [as handle_request] (D:\home\site\wwwroot\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (D:\home\site\wwwroot\node_modules\express\lib\router\index.js:317:13)
at D:\home\site\wwwroot\node_modules\express\lib\router\index.js:284:7
at Function.process_params (D:\home\site\wwwroot\node_modules\express\lib\router\index.js:335:12)
at next (D:\home\site\wwwroot\node_modules\express\lib\router\index.js:275:10)
at next (D:\home\site\wwwroot\node_modules\express\lib\router\route.js:127:14)
at D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\ChatConnector.js:481:21
at ChatConnector.onDispatchEvents (D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\ChatConnector.js:458:17)
at ChatConnector.dispatch (D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\ChatConnector.js:466:18)
at D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\ChatConnector.js:149:27
at OpenIdMetadata.getKey (D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\OpenIdMetadata.js:26:13)
at ChatConnector.verifyBotFramework (D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\ChatConnector.js:123:28)
The Bot State API is deprecated. Please refer to https://aka.ms/I6swrh for details on how to replace with your own storage.

Command for allowing the Customer to Disconnect to an Agent

hello, how to allow the customer to disconnect to the Agent and change the customer state to 0? I dont see any commands that will allow the customer to disconnect. Only the agent can disconnect the customer and if not disconnected the customer state will be stucked. The next time the user message the bot it will not answer because he/she was not disconnected by the agent.

ReferenceError: location is not defined

capture

var params = {};
location
.search
.substring(1)
.split("&")
.forEach(function (pair) {
var p = pair.split("=");
params[p[0]] = decodeURIComponent(p[1]);
});

var botConnection = new BotChat.DirectLine({
secret: params['s'],
token: params['t'],
domain: params['domain'],
webSocket: true
});

var bot = {
id: params['botid'] || 'botid',
name: params["botname"] || 'botname'
};

var logon_form = document.getElementById('logon-form');
var user_id = document.getElementById('user-id');

logon_form.onsubmit = e => {
e.preventDefault();
logon_form.style.display = 'none';

var user = {
    id: user_id.value + Math.floor(Math.random() * 1000) + 1,
    name: user_id.value
}

BotChat.App({
    botConnection: botConnection,
    user: user,
    bot: bot,
}, document.getElementById("BotChatGoesHere"));

}

TypeError: handoff.isAgent is not a function

I am getting this error. When i looked into the codes I noticed that indeed it is a function (not sure if its a typescript shorthand) and it is not declared anywhere.

I am also trying to develop my Bot in NodeJS (Javascript), not sure if anyone has managed to integrate this. (Planning to use this for MS Teams)

Edit. I had to change some of the codes to work for my scenario.

(Bug) Messages of non 'message' type are ignored in the middleware

version 0.1.7

Bug: messages of non 'message' type never get past the handoff middleware

expected behavior: messages of non 'message' reach user defined middleware or dialogs.

code to recreate:

expected behavior: bot responds with 'received non standard message type'
actual behavior: no response

import * as express from 'express';
import * as builder from 'botbuilder';
import * as handoff from 'botbuilder-handoff';

const app = express();

// Setup Express Server
app.listen(process.env.port || process.env.PORT || 3978, '::', () => {
    console.log('Server Up');
});

const connector = new builder.ConsoleConnector();
connector.listen();

const NON_MESSAGE_TYPE = 'not message type';


// this is just a simple example, but messages of non 'message' type can exist and have use, such
// as backchannel communication
const bot = new builder.UniversalBot(connector, [
    function (session, args, next) {
        if(session.message.type === NON_MESSAGE_TYPE) {
            session.send('received non standard message type');
        }
    }
]);

const isAgent = (session: builder.Session) => session.message.user.name.startsWith("Agent");

handoff.setup(bot, app, isAgent, {
    mongodbProvider: 'mongodb://localhost:27017/test',
    directlineSecret: 'doesn\t matter',
    retainData: false,
    customerStartHandoffCommand: "HELP"
});

const demoAddress: builder.IAddress = { channelId: 'console',
    user: { id: 'user', name: 'user' }, 
    bot: { id: 'bot', name: 'Bot' },
    conversation: { id: 'userConversation' } 
};

const exampleMessage = new builder.Message()
    .address(demoAddress)
    .toMessage();

exampleMessage.type = NON_MESSAGE_TYPE;

// doesn't get a response
bot.send(exampleMessage);

Errors with strict type-checking

Hi,

I was experimenting with your library and I'm having trouble integrating it with my typescript code.

If I simply take the code in the current master and try to compile it with tsc, I get a large number of type-checking errors, ranging from implicit any to Object is possibly 'undefined to forbidden parameter assignments. I have set my tsconfig.json to "strict" = true as per recommended best practices.

As an alternative, I considered using your npm package but it didn't seem to contain the type definitions, so I would lose all the type-checking benefits after integration.

If I use it as normal javascript, everything works fine.

Thanks,
Dan

CDN does not have required CSS and other support files

This might probably be too old or support URLs might have changed. The code snippet is not found to be working when used as it is provided one changes the required keys in environment variables.
I am getting the following errors on developer console of chrome -

Refused to apply style from 'https://unpkg.com/[email protected]/botchat.css' because its MIME type ('text/plain') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
localhost/:21 

GET https://unpkg.com/[email protected]/botchat.js net::ERR_ABORTED 404

connectToBot.js:11 Uncaught ReferenceError: BotChat is not defineat connectToBot.js:11

I checked the URLs mentioned specially https://unpkg.com/[email protected]/botchat.css and found Cannot find "/botchat.css" in [email protected]

CDN does not have this file. Can someone suggest that where can we get those missing files to get this example running.

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.