Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Document Pls #4

Closed
ghost opened this issue May 17, 2017 · 7 comments
Closed

Document Pls #4

ghost opened this issue May 17, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented May 17, 2017

@maxpert

Hi,

Could you please provide the document where the integration is explained.

Tried connecting the adapter to https://botname.azurewebsites.net/api/messages. Getting status as adapter started, but no activities are received when a test chat is initialized at dev.botframework.com

Should there be any other configuration done?

Regards,
Ram

@billbliss
Copy link
Contributor

You have set BOTBUILDER_APP_ID and BOTBUILDER_APP_PASSWORD as described in README.md, right?

A related question: are you seeing your app ID echoed in the console at startup?

Seeing no response in the test chat window on dev.botframework.com is consistent with the App ID/App Password not being set correctly.

@ghost
Copy link
Author

ghost commented May 22, 2017

Hi @billbliss ,

Thank you for your response, Yes I have checked the AppID/Password, and the AppID is echoed in the console at startup.

But nothing happens post that, there are no activities triggered. below is the code.
Util = require 'util'
Timers = require 'timers'

BotBuilder = require 'botbuilder'
{Robot, Adapter, TextMessage, User} = require 'hubot'

LogPrefix = "hubot-botframework:"

class BotFrameworkAdapter extends Adapter
constructor: (@Robot) ->
super @Robot
@APPID = "0cf0da9c-d61a-4d32-b23a-622cf4df870f"
@appPassword = "8tSbjmxTmTQ1v2OuZTFU5VV"
@endpoint = "https://nodeiva.azurewebsites.net/api/messages"
@robot.logger.info "#{LogPrefix} Adapter loaded. Using appId #{@APPID}"

    @connector  = new BotBuilder.ChatConnector
        appId: @appId
        appPassword: @appPassword

    #@robot.logger.info "#{LogPrefix} Connected."

    @connector.onEvent (events, cb) => @onBotEvents events, cb
    @robot.logger.info "#{LogPrefix} event is events"

onBotEvents: (activities, cb) ->
    @robot.logger.info "#{LogPrefix} onBotEvents"
    activities = [activities] unless Array.isArray activities

    for activity in activities
        address = activity.address
        user = @robot.brain.userForId address.user.id, name: address.user.name, room: address.conversation.id
        user.activity = activity
        if activity.type == 'message'
            @robot.receive new TextMessage(user, activity.text, activity.sourceEvent.clientActivityId)

send: (context, strings...) ->
    @robot.logger.info "#{LogPrefix} Message"
    @reply context, strings...

reply: (context, strings...) ->
    @robot.logger.info "#{LogPrefix} Sending reply"
    for str in strings
        msg = 
            type: 'message'
            text: str
            address: context.user.activity.address
        @connector.send [msg]
            

run: ->
    @robot.router.post @endpoint, @connector.listen()
    @robot.logger.info "#{LogPrefix} Adapter running at #{@endpoint}"
    Timers.setTimeout(=> @emit "connected", 1000)

exports.use = (robot) ->
new BotFrameworkAdapter robot

@ghost
Copy link
Author

ghost commented May 22, 2017

adding to my response...

I am able to get response on the test window in dev.botframework.com but the adapter does not record any activities being triggered.

@ghost
Copy link
Author

ghost commented May 22, 2017

~\Documents\GitHub\hubot> ./bin/hubot -a botframework
[Mon May 22 2017 15:46:57 GMT+0530 (India Standard Time)] INFO hubot-botframework: Adapter loaded. Using appId 21a137ba-f74d-4227-b5b3-7120dab3aa33
[Mon May 22 2017 15:46:57 GMT+0530 (India Standard Time)] INFO hubot-botframework: event is events
[Mon May 22 2017 15:46:57 GMT+0530 (India Standard Time)] INFO hubot-botframework: Adapter running at https://onexhubbot20170515041913.azurewebsites.net/api/messages
[Mon May 22 2017 15:46:57 GMT+0530 (India Standard Time)] WARNING Loading scripts from hubot-scripts.json is deprecated and will be removed in 3.0 (https://github.com/github/hubot-scripts/issues/1113) in favor of packages for each script.

Your hubot-scripts.json is empty, so you just need to remove it.
[Mon May 22 2017 15:46:58 GMT+0530 (India Standard Time)] ERROR hubot-heroku-alive included, but missing HUBOT_HEROKU_KEEPALIVE_URL. `heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s  | grep web-url | cut -d= -f2)`
[Mon May 22 2017 15:46:58 GMT+0530 (India Standard Time)] INFO hubot-redis-brain: Using default redis on localhost:6379

@maxpert
Copy link
Contributor

maxpert commented May 22, 2017

You should remove the hubot-heroku-alive from your external-scripts.json; my current JSON looks like this:

[
  "hubot-diagnostics",
  "hubot-help",
  "hubot-pugme",
  "hubot-maps",
  "hubot-rules",
  "hubot-shipit"
]

@ghost
Copy link
Author

ghost commented May 22, 2017

@maxpert , Thanks for your response. I have removed heroku and redis from external-scripts.json;

Below is the status when I run hubot with adapter.
[Mon May 22 2017 23:22:21 GMT+0530 (India Standard Time)] INFO hubot-botframework: Adapter loaded. Using appId 3db1ba52-2579-4f55-a5dc-742276eac4c5
[Mon May 22 2017 23:22:21 GMT+0530 (India Standard Time)] INFO hubot-botframework: Adapter running.

Nothing happens after this.. (even if I send messages using the test window in dev.botframework.com)
Should there be any scripts created to invoke the activity, or should I modify my Microsoft Botframework bot to send any particular messages to the endpoint.

@ghost
Copy link
Author

ghost commented May 24, 2017

Has been resolved. Issue with endpoint URL

@ghost ghost closed this as completed May 24, 2017
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants