Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yammer Integration With Hubot #28

Open
learnTech2022 opened this issue Dec 21, 2016 · 20 comments
Open

Yammer Integration With Hubot #28

learnTech2022 opened this issue Dec 21, 2016 · 20 comments

Comments

@learnTech2022
Copy link

Hi,
I am new to the hubot and want to integrate my hubot with yammer, Can u please tell me the procedure step by step. I know their are adoptors available for that purpose, but i dont know how to use adaptors to talk to hubot from yammer.

Thanks,
Krishna P

@athieriot
Copy link
Owner

Hi @krishna1990fis

Have you look at the Readme? It explains more in details how to setup Hubot: https://github.com/athieriot/hubot-yammer

@learnTech2022
Copy link
Author

Hi @athieriot

Thanks for your reply, currently i have hubot running locally in my machine and i am able to have the communication with hubot from command prompt after starting hubot from bin\hubot

Now for yammer integration i have done following things.

  1. npm install -a yammer -n name (as mentioned in README.md file on github/hubot-yammer) as shown below
    image

  2. For yammer account and token

  3. i already had yammer account in my organisation

  4. i signed in with that account

  5. i registered an API application https://www.yammer.com/client_applications

  6. i have got the token for the same and replaced below
    % export HUBOT_YAMMER_ACCESS_TOKEN="my new token"

  7. i created one public group in the yammer

since my hubot is in my local machine, i have set NON-HEROKU Environment Variable
% export HUBOT_YAMMER_ACCESS_TOKEN="access_token"
% export HUBOT_YAMMER_GROUPS="groups list"

and have place both in bin\hubot

with all above setup, im still not able to get reply from the hubot when i post some questions in yammer public group.
image

Please reply if i have missed out some configuration.

Thanks a lot,
Krishna

@athieriot
Copy link
Owner

I think the README mention that the launch command is:

  bin/hubot -a yammer -n name

And it is seperated from installing stuff using npm.

Have you tried that one?

@learnTech2022
Copy link
Author

@athieriot

Also i have copied yammer.coffee script inside script folder of myhubot.

@athieriot
Copy link
Owner

This should not be necessary and will be available when doing

 npm install hubot-yammer

What does return: bin/hubot -a yammer -n name?

@learnTech2022
Copy link
Author

Yes i have tried that way, but it will through an error
image

bin\hubot is the place where hubot interface would be, once we enter bin\hubot, hubot CLI will start and user can post a questions der to hubot.

How are we adding an adoptor to hubot here ? is it by running the above command successfully ?
Please clarify.

@athieriot
Copy link
Owner

I'm sorry but it looks like it doesn't even start hubot. Both your commands ends not finding hubot at all

@learnTech2022
Copy link
Author

where should i run this command, in my user account or inside hubot directory.

1.when i run this from my user account in command prompt, it gives me error as mentioned in above comment
2. when i run the sam command after entering inside the hubot directory, it gives bin is not recognized error

@learnTech2022
Copy link
Author

to find hubot we need to enter into the hubot directory and start hubot by typing bin\hubot command

@learnTech2022
Copy link
Author

@athieriot

i think i have figured out how to run the command. and now im getting this error
image

[Thu Dec 22 2016 20:03:46 GMT+0530 (India Standard Time)] ERROR Cannot load adapter yammer - SyntaxError: unexpected IDENTIFIER

@athieriot
Copy link
Owner

Ah ok that's better. So know that the -n arguments is just the name of the bot. Nothing to do with Yammer

And now you probably need to export HUBOT_YAMMER_ACCESS_TOKEN again.

@learnTech2022
Copy link
Author

I generated hubot yammer access token again, but now i am getting following error
image

Particularly this one is causing the issue,
[Thu Dec 22 2016 21:20: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)

and this

[Thu Dec 22 2016 21:20:58 GMT+0530 (India Standard Time)] ERROR Error: listen EADDRINUSE 0.0.0.0:8080

@learnTech2022
Copy link
Author

how to get rid of heroku stuff here, all of a sudden this got popped up. i even tried deleting this from the node-module. But it again created after running the above command.

@athieriot
Copy link
Owner

The last error means you already have another service running on port 8080 and so something that tries to run it fails. Can it has to do with listener.coffee?

As I am guessing you are not publishing on heroku at the moment but running on your computer, you will need to export the environment variable requested (With a dummy) not to have the error.

I never use hubot heroku keepalive so I won't be super useful with it I'm afraid

@learnTech2022
Copy link
Author

last error somehow disappeared, but the second one is still their.
Yes you are ritte, im not deploying on heroku, its in my local machine. I even tried exporting the environment variable requested like this
export HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web-url | cut -d= -f2)
But it dint work !

I think one last step im struck.

@athieriot
Copy link
Owner

You can't just use this command line on your computer if you don't have the heroku tool belt installed. Try using any other value. Like literally anything. "blabla"

@learnTech2022
Copy link
Author

i tried giving some random value, but its not going (export HUBOT_HEROKU_KEEPALIVE_URL="aaaaaaaa")
Anyway its late i will look into it tomorrow.

I thank you very much for helping me out with the setup, thank you so much once again.
Bye now
Take care
Have a good day !

Krishna P

@learnTech2022
Copy link
Author

@athieriot
Now i am able to get rid of above mentioned error. i have removed hubot heroku using npm uninstall command for time being.

image

what next ? it is not doing anything, how do i proceed now ? Do i need to post some message in the yammer public group i have created ? Please suggest.

Thank you
Krishna P

@athieriot
Copy link
Owner

Good news. So normally, Hubot should now respond in the "chatbot_Hubot" group in Yammer.

I believe that it will answer to the name you passed as "-n" argument.
(I would advice you to use a simpler name ^^)

So could you try:

Or

  hubot help

@learnTech2022
Copy link
Author

learnTech2022 commented Dec 26, 2016

@athieriot Hi,

After following all the steps properly, i am still not able to communicate with the hubot from yammer group.

Let me list the steps i have done so far.

  1. I have a account in yammer by my official email id, and have created a saparate group for hubot communication which is public.
  2. Access token for hubot from yammer
    ===============================================================
  • Register a new application on Yammer at https://www.yammer.com/client_applications. Leave the callback URLs empty
  • Take notes of your consumer_key and consumer_secret
  • Make a new bot user on Yammer.
  • Sign in as the new bot user on Yammer
  • Go to https://www.yammer.com/dialog/oauth?client_id=<consumer_key>
  • There's an authorization dialog. Authorize the app
  • Look at the URL bar and there's a code= query parameter in there, copy that
  • curl https://www.yammer.com/oauth2/access_token?code=&client_id= - --<consumer_key>&client_secret=<consumer_secret>
  • you'll get a big JSON that contains access_token
  • Now set the token to HUBOT_YAMMER_ACCESSTOKEN.`
    ==================================================================
  1. I have set the access token in yammer.coffee as follows,
    ==================================================================
    access_token: {"user_id":1564529334,"network_id":81433,"network_permalink":"fisglobal.com","network_name":"FIS Global","token":"81433-qZlaPZbgokuCKdpiHnhK2Q","view_members":true,"view_groups":true,"view_messages":true,"view_subscriptions":true,"modify_subscriptions":true,"modify_messages":true,"view_tags":true,"created_at":"2016/12/23 10:26:11 +0000","authorized_at":"2016/12/23 10:26:11 +0000","expires_at":null}
    ==================================================================
    Please correct me if i am wrong in using access token

  2. before that i ran npm install hubot-adopter and it was successfull after which i got hubot-yammer folder in node_modules folder of myhubot

  3. then i executed this command bin\hubot -a yammer -n krishnapujar

  4. then i went to yammer and loged in with my account and typed krishnapujar help in a group which i created for chatbot as chatbot_Hubot

Did i miss out something ? Please write back

Thank You
Krishna

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants