Open Nostreum opened 7 years ago
Did you pull the code from github and run it? or did you pull down the package from npm? If the former, because it's a typescript project you have to build it using npm run build.
It should be easier to just npm install the package though!
Below are steps I did in my machine .
Created a "Samplebot" using VisualStudio C# which returns number of characters from typed message (default out of the box from bot template)
Then I deployed it to local IIS and "http://localhost/SampleBot/api/messages" works fine. I can use this endpoint in Bot Emulator and is works fine.
Created a folder "NodeDirectline" in my D drive and then using npm i installed your package D:\NodeDirectline>npm install --save offline-directline So far all good and package installed in this folder.
Then finally I ran below command which return error npm run directline 3000 localhost:///SampleBot/api/messages
Is this fine or I am doing something wrong.I am not a node guy but for this solution i installed node in my machine.
Thanks
@mohdkhan786 sorry you're running into issues. There may be a problem with the npm script approach right now. Can you try creating an app.js with the following code (and your own parameters in the initializeRoutes function) and try running it (node app.js in the cmd line)?
const directline = require("offline-directline");
const express = require("express");
const app = express();
directline.initializeRoutes(app, "http://127.0.0.1:3000", "http://127.0.0.1:3978/api/messages");
Hello @ryanvolum , As per your suggestion ,i performed below steps but still one issue. I think I am very close.your help is needed in last step.
step 1 => I created a new app.js file in "NodeDirectline" folder as per mention in my previous steps with below code
const directline = require("offline-directline"); const express = require("express"); const app = express(); directline.initializeRoutes(app, "http://127.0.0.1:3000", "http://localhost/AppointmentBot/api/messages");
step 2 => downloaded Microsoft/BotFramework-WebChat from github and unzip it Then updated below code in ..\samples\fullwindow\Index.html directLine: { secret: params['s'], token: params['t'], domain: params['domain'], webSocket: false }
npm install npm build npm start
Now I have a bot running and directline endpoint running.
Step 3: ==> Then Open url in browser http://localhost:8000/samples/fullwindow/?domain=http://127.0.0.1:3000/directline&botid=MyAppointmentBot&botname=MyAppointmentBot&userid=user1
. I can check a conversation id is also created in command line.
but now when i type something and press enter, it always says "could not send"
Thanks for your help..
@mohdkhan786 is your bot running locally at http://localhost/AppointmentBot/api/messages? Your bot should be receiving messages and replying to them. It seems odd that that bot endpoint doesn't have a port. Are you able to test your bot in the emulator with that endpoint?
I've identified the "couldn't send retry" return from webchat as a bug, and will implement a fix, but either way you should still be seeing messages from your bot.
My bot in C# I have hosted in local IIS server and not express IIS. Yes I can use same URL in bot emulator and it works fine.
Do you suggest some other approach with port number?
Is this code works only with express IIS and not with local server. Default port for local IIS is 80
const express = require("express"); const app = express();
@mohdkhan786 the port number really shouldn't matter. This package is just setting up a REST service that your bot and your client can both make calls against. I've since tested the package with a C# bot and everything seems to be working. Are you sure you're passing the right URLs into the initializeRoutes function? The first should be where you want to host the connector, and the second should be the endpoint where your bot is hosted (including api/messages)
Hello @ryanvolum @ryvolum
After my further investigation, I identified one problem may be help you to check. This solution is working fine for me when i create my bot using [Microsoft.bot.builder Version 3.0.0.0] but when I upgrade this to [Microsoft.bot.builder Version 3.9.0.0] then comes the problem and not sending request.
What I mean is same sample string length bot works with Ver3 but when i upgrade bot builder, then problem comes.Then It will not work even if we downgrate bot builder version t0 Ver 3.0.0.0 Is there anything in your offline directline dl which depends on Version3.0.0.0
Will be really helpful if you suggest something.
@ryanvolum I followed all steps . my ap.js is running , my webchat code is running but getting error in sending request
@ryanvolum
hi ryan
did you get chance to address issue which I am facing in offline direct as explained above.
thanks in advance
@ryanvolum Hi Ryan, I am also facing the same issue as raised by @mohdkhan786 . I have deployed the repo as mentioned in your post but not able to send the message successfully. Please guide me to resolve this.
Created conversation with conversationId: da7191c9-4433-4c8a-b6f3-0cc29bc46a21 (node:16495) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): FetchError: request to http://127.0.0.1:3978/api/messages failed, reason: connect ECONNREFUSED 127.0.0.1:3978
Regards, Alan
Hi !
I tried your solution and got this error :
module.js:471 throw err; ^
Error: Cannot find module 'C:\Users\h21178\Desktop\offline_dl-master\dist\cmdutil.js' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:389:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:504:3
Command :
npm run directline 3000 localhost://127.0.0.1:3979/api/messages
Thanks :)