17

Our house (I live with 5 roommates) uses a google hangouts chat from our phones to communicate various things. Lately we've been discussing some scheduled things, like a rotation for cleaning certain parts of the house, and I thought it would be useful to have a bot announce the pertinent information about the schedule on a hangouts chat.

I'm wondering what the best way to go about this is.

There are two approaches I see:

1) Make an app using google hangouts API which sends messages at the correct interval, connect to this app, use it to chat.

2) Make a google account for a bot which we connect to the hangout, make it send messages at the correct interval.

I like number 2 because I wouldn't have to interfere with the app to change the bot's code, but I'm sort of at a loss for where to start.

Number 1 seems okay, but I'm also not sure I can connect to a google hangouts app on my phone the same way I can just create a chat with friends.

How should I go about doing this task?

mturnshek
  • 312
  • 1
  • 3
  • 9
  • Using Node.js, it's as simple as calling [`xmpp.send('user@gmail.com', 'message')`](https://stackoverflow.com/questions/47762036/send-xmpp-notification-from-node-js-script). – Dan Dascalescu Jul 04 '18 at 05:10
  • @DanDascalescu I checked the linked question but the answer isn't too specific on how to use it for gmail. I tried to replace it, but I couldn't figure out how to send the hangouts message. Can you elaborate further? – programmerskillz Apr 26 '19 at 20:26
  • @programmerskillz: I'm still using the [code in that answer](https://stackoverflow.com/questions/47762036/send-xmpp-notification-from-node-js-script/48097315#48097315) nowadays, and it works fine after I ran `subscribe` once. – Dan Dascalescu Apr 27 '19 at 23:12

5 Answers5

4

Any preference for the language used to code in?

My immediate thought is to tie into the google calendar for a tasklist and have an app read from that via rest.

Then post to the correct hangout (again via rest is probably simplest): you can use Fiddler to find what is being done to post to hangouts, or look through here for an API oriented way to do it.

Let me know if you need more information:) Hopefully what is here should see you steering in the right direction:)

GMasucci
  • 2,834
  • 22
  • 42
1

Google calendar will popup notices on your phone. You could just share the calendar with your roommate, and skip the hangout notices altogether

Jon Anderson
  • 696
  • 4
  • 9
  • 3
    This does not respond to the original question. While your point is valid, this answer does not help others trying to accomplish something similar. For instance, I am currently looking into "botted" hangout notifications for something which happens at arbitrary times. And I want to avoid e-mails. – exhuma Oct 20 '14 at 06:44
1

I would recommend using the API, but I believe you will need to create an account for your bot anyways.

If you like Java, you should take a look at their quickstart example : https://github.com/googleplus/gplus-quickstart-java

stewsters
  • 4,335
  • 3
  • 15
  • 7
1

June 2015 python hangoutsbot. Looks like a good bot to start with. https://github.com/hangoutsbot/hangoutsbot/blob/master/README.md

gaoithe
  • 4,218
  • 3
  • 30
  • 38
  • I'm not sure how they got around the hard-to-find Google Hangouts Messages API, but this is the option that worked best for me. – intcreator Jul 05 '16 at 02:54
0

Currently the below information will not be useful, but once/if the new hangs out chat becomes available outside of a gsuite account if may provide useful.

For examples with the api here: https://github.com/gsuitedevs/hangouts-chat-samples/tree/master/node/basic-cloud-functions-bot

If using cards instead of plain text this may provide useful: https://github.com/BaReinhard/hangouts-card-helper

Brett Reinhard
  • 374
  • 2
  • 13