Search code examples
google-cloud-platformpublish-subscribegoogle-cloud-pubsubgoogle-hangouts

How can I subscribe to a Pub/Sub having token and a topic? For a hangouts chat bot


I'm making a chatbot for Google chat and I've seen there's a Cloud Pub/Sub option. I want to use it but i don't know how to link the conversation to the Pub/Sub system. What Chat gives me is only this Pub/Sub config

How can I do this? there is no end-point or nothing.

Ok, so the documentation in here tells me not very much it only tells that the messages are in this format:

{enter co"sender": {
"displayName": "Pizza Bot",
"avatarUrl": "some_url"}, "text": "Your pizza delivery is here!"}

(Sorry for the format)

I can't link the documentation since it says that it's confidential. But I can see it is VERY similar like the one that's for hangouts.

Any ideas?


Solution

  • In order to use Cloud Pub/Sub as a platform for Hangouts Chat, you will want to post the topic ID the bot config page. You can find directions at https://developers.google.com/hangouts/chat/how-tos/pub-sub.

    Essentially, when publishing your bot:

    1. Go to console.cloud.google.com
    2. In the Navigation menu to the left, Click on APIs and Services
    3. Search for the Hangouts Chat API
    4. Enable the Hangouts Chat API
    5. Go to "Configuration"
    6. Look for Connection Settings > Cloud Pub/Sub
    7. Enter your Topic ID

    It looks like this

    The config page that you are showing has been deprecated and you must now publish a bot to use the Pub/Sub endpoints.