{"id":15715506,"url":"https://github.com/cloudflare/ghc-errbot","last_synced_at":"2025-09-01T22:39:19.754Z","repository":{"id":43656400,"uuid":"130853621","full_name":"cloudflare/GHC-Errbot","owner":"cloudflare","description":"A Google Hangouts Chat Backend for Errbot","archived":false,"fork":false,"pushed_at":"2024-09-25T22:38:14.000Z","size":71,"stargazers_count":20,"open_issues_count":3,"forks_count":15,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-30T14:40:15.718Z","etag":null,"topics":["errbot","hangouts-chat"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-04-24T12:51:00.000Z","updated_at":"2025-01-09T21:00:00.000Z","dependencies_parsed_at":"2024-02-29T17:50:52.258Z","dependency_job_id":"54c7e2c7-442c-449e-8d85-2961272881cc","html_url":"https://github.com/cloudflare/GHC-Errbot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2FGHC-Errbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2FGHC-Errbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2FGHC-Errbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2FGHC-Errbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflare","download_url":"https://codeload.github.com/cloudflare/GHC-Errbot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237261775,"owners_count":19281310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["errbot","hangouts-chat"],"created_at":"2024-10-03T21:41:47.685Z","updated_at":"2025-02-05T07:32:53.869Z","avatar_url":"https://github.com/cloudflare.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Hangouts Chat - Errbot Backend\n\nThis is a backend for Google Hangouts Chat (https://chat.google.com) for Errbot(https://errbot.io).\n\nIt allows you to use errbot to create bots, but as always, it's a work in progress.\n\n## Installation\n\n```\ngit clone https://github.com/cloudflare/GHC-Errbot\n```\n\nand then\n\n```\nBACKEND = 'Google-Hangouts-Chat'\nBOT_EXTRA_BACKEND_DIR = '/path/to/where/you/cloned/the/repo/'\n```\n\nto your config.py\n\n## Authentication\n\n1. Create a Google Pub/Sub topic in a GCE project\n\n2. Create a Subscriber on that topic and grant your bot account Subscriber permissions\n\n3. Generate a creds.json for your bot\n\n4. Create an application with `errbot init`, and then create a `BOT_IDENTITY` block in your config.py with the following information:\n\n```\nBOT_IDENTITY = {\n    'GOOGLE_CREDS_FILE': '/path/to/bot/creds.json',\n    'GOOGLE_CLOUD_ENGINE_PROJECT': '\u003cyour project name\u003e',\n    'GOOGLE_CLOUD_ENGINE_PUBSUB_TOPIC': '\u003cyour pub/sub topic\u003e',\n    'GOOGLE_CLOUD_ENGINE_PUBSUB_SUBSCRIPTION': '\u003cyour pub/sub subscription name\u003e',\n}\n```\n\n5. Set BOT_PREFIX to the name of the bot, including the mention(`@`)\n\n6. (optional) To enable prometheus metrics, set METRICS_PORT to an integer. This will be the port you want to open for metrics.\n\n# Examples\n\n## Attachments\n\nThis backend supports attachments in [message events][1]. To download a Google Chat upload attachment, we need to use the [GetAttachment API][2] and HTTP GET request with _Bearer authentication_. Since the backend is already authenticated, we opportunistically provide a ready-to-use _downloader_ object with the message context, so that errbot [plugins][3] can use it to directly download the attachments, no extra steps required.\n\nHere's a code example on how to use the downloader helper in a errbot plugin:\n\n```python\nfrom io import BytesIO\nfrom errbot import BotPlugin, botcmd\n\n@botcmd(split_args_with=None)\ndef upload(self, msg, args):\n    attachments = msg._extras.get('attachment', [])\n    for attachment in attachments:\n        if attachment['source'] == 'UPLOADED_CONTENT':\n            url = f\"\"\"https://chat.googleapis.com/v1/media/{ attachment['attachmentDataRef']['resourceName'] }?alt=media\"\"\"\n            downloader = msg._extras.get('downloader')\n            content = downloader(url)\n            if content != None:\n                d = BytesIO()\n                d.write(content)\n                # jira.add_attachment(issue=issue, attachment=d, filename=attachment['contentName'])\n```\n\n# Acknowledgement\nThe code in `markdownconverter.py` is from https://github.com/dr-BEat/errbot-backend-hangoutschat. It is MIT licensed.\n\n# License\n\nLicensed under the BSD 3 License.\n\n[1]: https://developers.google.com/chat/api/guides/message-formats/events#message\n[2]: https://developers.google.com/chat/how-tos/get-attachment\n[3]: https://errbot.readthedocs.io/en/latest/errbot.botplugin.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fghc-errbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflare%2Fghc-errbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fghc-errbot/lists"}