|
Package Summary
Tags | No category tags. |
Version | 2.1.28 |
License | BSD |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2024-07-10 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Kei Okada
Authors
- Yoshiki Obinata
Google Chat ROS
The ROS wrapper for Google Chat API
- Installation Guide
- Sending the message
- Receiving the message
- Handling the event
- Optional functions
- Helper nodes
1. Installation Guide
1.1 Get the API KEY
At first, you should have the permission to access the Google Chat API.
See Google Official Document. Please ensure to get JSON credetial file and save it. DO NOT LOST IT!
For JSK members, all keys are available at Google Drive. If you make new API keys, please upload them here.
1.2 Select the way how to recieve Google Chat event
The way you recieve Google Chat event from API server depends on your system. If your system has static IP and is allowed to recieve https request with specific port, please see HTTPS mode. If not, please see Pub/Sub mode.
HTTPS mode
When you send the message, the node uses Google REST API. When you recieve the message, Google Chat API sends https request to your machine and the node handles it.
You have to prepare SSL certificate. Self-signed one is not available because of Google security issue. Please use the service like Let’s Encrypt. In Google Cloud console, please choose App URL
as connection settings and fill the URL in the App URL form.
Pub/Sub mode
When you send the message, the node uses Google REST API. When you recieve the message, the node uses Google Pub/Sub API’s subscription. The node has already established its connection to Google Pub/Sub API when you launch it.
The way how to set up in Google Cloud console shows below.
1. Authorize the existing Google Chat API project to access Google Cloud Pub/Sub service
In IAM settings in the console, please add the role Pub/Sub Admin
to service account.
2. Create Pub/Sub topic and subscriber
In Pub/Sub settings in the console, please add the topic and subscriptions.
In the figure, we set the topic name chat
, the subscription name chat-sub
as an example.
Note that if you set the topic name chat
, the full name of it becomes projects/<project_name>/topics/chat
. Please confirm the subsciptions subscribes the full name not short one.
3. Grant publish rigts on your topic
In order for Google Chat to publish messages to your topic, it must have publishing rights to the topic. To grant Google Chat these permissions, assign the Pub/Sub Publisher role to the following service account
chat-api-push@system.gserviceaccount.com
4. Set Google Chat API Connection settings
Please choose Cloud Pub/Sub
as connection settings and fill the full topic name in the Topic Name form.
1.3 Install/Build the ROS node
If you want to build from the source
source /opt/ros/${ROS_DISTRO}/setup.bash
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
git clone https://github.com/jsk-ros-pkg/jsk_3rdparty
rosdep install --ignore-src --from-paths . -y -r
cd ..
catkin build
1.4 Launch the node
HTTPS mode
You have to set rosparams receiving_mode=https
, google_cloud_credentials_json
, host
, port
, ssl_certfile
, ssl_keyfile
.
Pub/Sub mode
You have to set rosparams receiving_mode=pubsub
, google_cloud_credentials_json
, project_id
, subscription_id
. subscription_id
would be chat-sub
if you follow Pub/Sub mode example.
Example
roslaunch google_chat_ros google_chat.launch receiving_mode:=pubsub google_cloud_credentials_json:=/path/to/<project_id>-XXXXXXXX.json project_id:=<project_id> subscription_id:=chat-sub
2. Sending the message
2.1 Understanding Google Chat Room
When you see Google Chat UI with browsers or smartphone’s apps, you may see space
, thread
. If you send new message, you must specify the space or thread you want to send the message to. You can get the space name from chat room’s URL. If it is https://mail.google.com/chat/u/0/#chat/space/XXXXXXXXXXX
, XXXXXXXXXXX
becomes the space name.
2.2 Message format
There are 2 types of messages, text and card. The card basically follows the original json structure. As the node covers all the units in here with ros action msgs, it may be complicated for you if you want to use all of them. So in Examples sections, we’ll show you simple ones.
2.3 Sending the message by actionlib
All you have to do is send Actionlib goal to ~send/goal
.
2.4 Examples
Showing the message examples with rostopic pub -1
command on bash
.
Sending a text message
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Hello!'
space: 'spaces/<space name>'"
Sending a message with KeyValue card
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Something FATAL errors have happened in my computer, please fix ASAP'
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'Process ID'
content: '1234'
bottom_label: 'rospy'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'"
Sending an Interactive button
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
header:
title: 'What do you want to eat?'
subtitle: 'Please choose the food shop!'
sections:
-
widgets:
-
buttons:
-
text_button_name: 'STARBUCKS'
text_button_on_click:
action:
action_method_name: 'vote_starbucks'
parameters:
-
key: 'shop'
value: 'starbucks'
-
text_button_name: 'SUBWAY'
text_button_on_click:
action:
action_method_name: 'vote_subway'
parameters:
-
key: 'shop'
value: 'subway'
space: 'spaces/<space name>'"
Sending a message with an image
See Here.
3. Receiving the messages
3.1 ROS Topic
When the bot was mentioned, the node publishes ~message_activity
topic.
3.2 Examples
Receiving a text message
event_time: "2022-04-28T06:25:26.884623Z"
space:
name: "spaces/<space name>"
display_name: ''
room: False
dm: True
message:
name: "spaces/<space name>/messages/<message id>"
sender:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
create_time: "2022-04-28T06:25:26.884623Z"
text: "Hello!"
thread_name: "spaces/<space name>/threads/<thread name>"
annotations: []
argument_text: "Hello!"
attachments: []
user:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
Receiving a message with an image or gdrive file and download it
4. Handling the interactive event
If you’ve already sent the interactive card like Interactive card example, you can receive the activity of buttons. Suppose someone pressed the button STARBUCKS
, the node publishes a ~card_activity
topic like
event_time: "2022-05-02T00:23:47.855023Z"
space:
name: "spaces/<space name>"
display_name: "robotroom_with_thread"
room: True
dm: False
message:
name: "spaces/<space name>/messages/Go__sDfIdec.Go__sDfIdec"
sender:
name: "users/100406614699672138585"
display_name: "Fetch1075"
avatar_url: "https://lh4.googleusercontent.com/proxy/hWEAWt6fmHsFAzeiEoV5FMOx5-jmU3OnzQxCtrr9unyt73NNwv0lh7InFzOh-0yO3jOPgtColHBywnZnJvl4SVqqqrYkyT1uf18k_hDIVYrAv87AY7lM0hp5KtQ1m9br-aPFE98QwNnSTYc2LQ"
avatar: []
email: ''
bot: True
human: False
create_time: "2022-05-02T00:23:47.855023Z"
text: ''
thread_name: "spaces/<space name>/threads/Go__sDfIdec"
annotations: []
argument_text: ''
attachments: []
user:
name: "users/103866924487978823908"
display_name: "Yoshiki Obinata"
avatar_url: "https://lh3.googleusercontent.com/a-/AOh14GgexXiq8ImuKMgOq6QG-4geIzz5IC1-xa0Caead=k"
avatar: []
email: "<your email>"
bot: False
human: True
action:
action_method_name: "vote_starbucks"
parameters:
-
key: "shop"
value: "starbucks"
After the node which handles the chat event subscribed the topic, it can respond with text message like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'The shop accepted!'
content: 'You choose STARBUCKS!!'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'
thread_name: 'spaces/<space name>/threads/<thread name>'"
The important point is that the client node has to remember the thread_name
which the card event was occured at and send response to it.
5. Optional functions
5.1 Sending a message with an image
To send an image, you have to use card
type message. If you want to add the image uploaded to a storage server available for everyone, you just add its URI like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
image_url: 'https://media-cdn.tripadvisor.com/media/photo-s/11/fb/90/e4/dsc-7314-largejpg.jpg'
space: 'spaces/<your space>'"
If you want to attach image saved at your host, you have to launch (gdrive_ros)[https://github.com/jsk-ros-pkg/jsk_3rdparty/tree/master/gdrive_ros] at first and set ~gdrive_upload_service
param with gdrive_ros/Upload
service name. Then publish topic like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
localpath: '/home/user/Pictures/image.png'
space: 'spaces/<your space>'
5.2 Receiving a message with images or gdrive file
You have to set rosparam ~download_data
True, ~download_directory
. If the node recieved the message with image or google drive file, it automatically downloads to ~donwload_directory
path.
Troubleshoot
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
If you encounter 404 Resource not found (resource=chat-sub).
error on your screen as shown in below.
[INFO] [1680417167.337634]: [/google_chat_ros] Expected to use Google Cloud Pub Sub service
Traceback (most recent call last):
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 473, in <module>
node = GoogleChatROS()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 80,
in __init__
self._pubsub_client.run()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/src/google_chat_ros/google_chat.py", line 135, in run
self._streaming_pull_future.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
Please make sure that you have enabled subscription service, as a default it expires in 7 days. We recommend you to set no expiration date.
Changelog for package google_chat_ros
2.1.28 (2023-07-24)
2.1.27 (2023-06-24)
- fix package.xml/CMakeLists.txt to supress catkin_lint errors (#479)
- Contributors: Kei Okada
2.1.26 (2023-06-14)
- add LICENSE files (#476)
- Contributors: Kei Okada
2.1.25 (2023-06-08)
- google_chat_ros_node.py: display project_id, subscription_id (#459)
- add test to check if ros node is loadable,
(#463)
- install python files under CATKIN_PACKAGE_BIN_DESTINATION
- google_chat_ros/test_rospy_node.py: skip healper.py helper.py depends on dialogflow_task_executive. However, when we add this to the <depend> of package.xml, it appempts to build venv using 'dialogflow_task_executive/requirements.txt'. This requires having the same PYTHON_INTERPRETER for both dialogflow and chat ros package. The issue is that dialogflow_task_executive heavily relies on system Python modules, including ROS, making it difficult to use dialogflow with Python3 on Melodic
- add catkin_install_python for test, it is also change installed directory from BIN to SHARE, because we want to have same directory structure between devel and install
- add test to check if ros node is loadable If we use python2 PYTHON_INTERPRETER on 20.04, python2 fails to load rospy in /opt/ros/noetic, because rospy moduels are alraedy updated. If we use python3 PYTHON_INTERPRETER on 18.04, python3 can load rospy in /opt/ros/melodic by chance. c.f. https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/367
- google_chat_ros/README.md: add troubleshooting (#450)
- fix google_chat_ros noetic build errors (#422)
- use same timestamp for one goal
(#403)
- save google chat image in /chat_notification with timestamp
- add google_chat_ros (#392)
- Contributors: Aoi Nakane, Kei Okada, Naoto Tsukamoto, Shingo Kitagawa, Yoshiki Obinata
2.1.24 (2021-07-26)
2.1.23 (2021-07-21)
2.1.22 (2021-06-10)
2.1.21 (2020-08-19)
2.1.20 (2020-08-07)
2.1.19 (2020-07-21)
2.1.18 (2020-07-20)
2.1.17 (2020-04-16 21:51)
2.1.16 (2020-04-16 15:21)
2.1.15 (2019-12-12)
2.1.14 (2019-11-21)
2.1.13 (2019-07-10)
2.1.12 (2019-05-25)
2.1.11 (2018-08-29)
2.1.10 (2018-04-25)
2.1.9 (2018-04-24)
2.1.8 (2018-04-17)
2.1.7 (2018-04-09)
2.1.6 (2017-11-21)
2.1.5 (2017-11-20)
2.1.4 (2017-07-16)
2.1.3 (2017-07-07)
2.1.2 (2017-07-06)
2.1.1 (2017-07-05)
2.1.0 (2017-07-02)
2.0.20 (2017-05-09)
2.0.19 (2017-02-22)
2.0.18 (2016-10-28)
2.0.17 (2016-10-22)
2.0.16 (2016-10-17)
2.0.15 (2016-10-16)
2.0.14 (2016-03-20)
2.0.13 (2015-12-15)
2.0.12 (2015-11-26)
2.0.11 (2015-10-07 14:16)
2.0.10 (2015-10-07 12:47)
2.0.9 (2015-09-26)
2.0.8 (2015-09-15)
2.0.7 (2015-09-14)
2.0.6 (2015-09-08)
2.0.5 (2015-08-23)
2.0.4 (2015-08-18)
2.0.3 (2015-08-01)
2.0.2 (2015-06-29)
2.0.1 (2015-06-19 21:21)
2.0.0 (2015-06-19 10:41)
1.0.71 (2015-05-17)
1.0.70 (2015-05-08)
1.0.69 (2015-05-05 12:28)
1.0.68 (2015-05-05 09:49)
1.0.67 (2015-05-03)
1.0.66 (2015-04-03)
1.0.65 (2015-04-02)
1.0.64 (2015-03-29)
1.0.63 (2015-02-19)
1.0.62 (2015-02-17)
1.0.61 (2015-02-11)
1.0.60 (2015-02-03 10:12)
1.0.59 (2015-02-03 04:05)
1.0.58 (2015-01-07)
1.0.57 (2014-12-23)
1.0.56 (2014-12-17)
1.0.55 (2014-12-09)
1.0.54 (2014-11-15)
1.0.53 (2014-11-01)
1.0.52 (2014-10-23)
1.0.51 (2014-10-20 16:01)
1.0.50 (2014-10-20 01:50)
1.0.49 (2014-10-13)
1.0.48 (2014-10-12)
1.0.47 (2014-10-08)
1.0.46 (2014-10-03)
1.0.45 (2014-09-29)
1.0.44 (2014-09-26 09:17)
1.0.43 (2014-09-26 01:08)
1.0.42 (2014-09-25)
1.0.41 (2014-09-23)
1.0.40 (2014-09-19)
1.0.39 (2014-09-17)
1.0.38 (2014-09-13)
1.0.37 (2014-09-08)
1.0.36 (2014-09-01)
1.0.35 (2014-08-16)
1.0.34 (2014-08-14)
1.0.33 (2014-07-28)
1.0.32 (2014-07-26)
1.0.31 (2014-07-23)
1.0.30 (2014-07-15)
1.0.29 (2014-07-02)
1.0.28 (2014-06-24)
1.0.27 (2014-06-10)
1.0.26 (2014-05-30)
1.0.25 (2014-05-26)
1.0.24 (2014-05-24)
1.0.23 (2014-05-23)
1.0.22 (2014-05-22)
1.0.21 (2014-05-20)
1.0.20 (2014-05-09)
1.0.19 (2014-05-06)
1.0.18 (2014-05-04)
1.0.17 (2014-04-20)
1.0.16 (2014-04-19 23:29)
1.0.15 (2014-04-19 20:19)
1.0.14 (2014-04-19 12:52)
1.0.13 (2014-04-19 11:06)
1.0.12 (2014-04-18 16:58)
1.0.11 (2014-04-18 08:18)
1.0.10 (2014-04-17)
1.0.9 (2014-04-12)
1.0.8 (2014-04-11)
1.0.7 (2014-04-10)
1.0.6 (2014-04-07)
1.0.5 (2014-03-31)
1.0.4 (2014-03-29)
1.0.3 (2014-03-19)
1.0.2 (2014-03-12)
1.0.1 (2014-03-07)
1.0.0 (2014-03-05)
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
message_generation | |
std_msgs | |
actionlib_msgs | |
catkin_virtualenv | |
catkin | |
message_runtime | |
rospy | |
gdrive_ros | |
dialogflow_task_executive | |
rostest |
System Dependencies
Dependant Packages
Name | Deps |
---|---|
jsk_3rdparty |
Launch files
- launch/google_chat.launch
-
- receiving_mode [default: url] — Google Chat API settings. Choose from url, dialogflow, pubsub, none.
- gdrive_upload_service [default: /gdrive_ros/upload] — The ROS service name of gdrive_ros upload
- upload_data_timeout [default: 20]
- download_data [default: true]
- download_data_timeout [default: 10]
- download_directory [default: /tmp]
- download_avatar [default: false]
- google_cloud_credentials_json [default: ]
- use_yaml [default: false] — Whether you use yaml file or not.
- yaml_file [default: ] — Yaml file of web settings.
- respawn [default: true]
- host [default: localhost]
- port [default: 443]
- ssl_certfile [default: default]
- ssl_keyfile [default: default]
- project_id [default: default]
- subscription_id [default: default]
- use_helper [default: true]
- to_dialogflow_client [default: false]
- debug_sound [default: false]
Messages
- msg/FormAction.msg
- msg/KeyValue.msg
- msg/ActionParameter.msg
- msg/Attachment.msg
- msg/Section.msg
- msg/Button.msg
- msg/MessageEvent.msg
- msg/Message.msg
- msg/WidgetMarkup.msg
- msg/CardHeader.msg
- msg/Image.msg
- msg/User.msg
- msg/Space.msg
- msg/SpaceEvent.msg
- msg/CardAction.msg
- msg/OnClick.msg
- msg/Annotation.msg
- msg/CardEvent.msg
- msg/SlashCommand.msg
- msg/Card.msg
Services
Plugins
Recent questions tagged google_chat_ros at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 2.1.28 |
License | BSD |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2024-07-10 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Kei Okada
Authors
- Yoshiki Obinata
Google Chat ROS
The ROS wrapper for Google Chat API
- Installation Guide
- Sending the message
- Receiving the message
- Handling the event
- Optional functions
- Helper nodes
1. Installation Guide
1.1 Get the API KEY
At first, you should have the permission to access the Google Chat API.
See Google Official Document. Please ensure to get JSON credetial file and save it. DO NOT LOST IT!
For JSK members, all keys are available at Google Drive. If you make new API keys, please upload them here.
1.2 Select the way how to recieve Google Chat event
The way you recieve Google Chat event from API server depends on your system. If your system has static IP and is allowed to recieve https request with specific port, please see HTTPS mode. If not, please see Pub/Sub mode.
HTTPS mode
When you send the message, the node uses Google REST API. When you recieve the message, Google Chat API sends https request to your machine and the node handles it.
You have to prepare SSL certificate. Self-signed one is not available because of Google security issue. Please use the service like Let’s Encrypt. In Google Cloud console, please choose App URL
as connection settings and fill the URL in the App URL form.
Pub/Sub mode
When you send the message, the node uses Google REST API. When you recieve the message, the node uses Google Pub/Sub API’s subscription. The node has already established its connection to Google Pub/Sub API when you launch it.
The way how to set up in Google Cloud console shows below.
1. Authorize the existing Google Chat API project to access Google Cloud Pub/Sub service
In IAM settings in the console, please add the role Pub/Sub Admin
to service account.
2. Create Pub/Sub topic and subscriber
In Pub/Sub settings in the console, please add the topic and subscriptions.
In the figure, we set the topic name chat
, the subscription name chat-sub
as an example.
Note that if you set the topic name chat
, the full name of it becomes projects/<project_name>/topics/chat
. Please confirm the subsciptions subscribes the full name not short one.
3. Grant publish rigts on your topic
In order for Google Chat to publish messages to your topic, it must have publishing rights to the topic. To grant Google Chat these permissions, assign the Pub/Sub Publisher role to the following service account
chat-api-push@system.gserviceaccount.com
4. Set Google Chat API Connection settings
Please choose Cloud Pub/Sub
as connection settings and fill the full topic name in the Topic Name form.
1.3 Install/Build the ROS node
If you want to build from the source
source /opt/ros/${ROS_DISTRO}/setup.bash
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
git clone https://github.com/jsk-ros-pkg/jsk_3rdparty
rosdep install --ignore-src --from-paths . -y -r
cd ..
catkin build
1.4 Launch the node
HTTPS mode
You have to set rosparams receiving_mode=https
, google_cloud_credentials_json
, host
, port
, ssl_certfile
, ssl_keyfile
.
Pub/Sub mode
You have to set rosparams receiving_mode=pubsub
, google_cloud_credentials_json
, project_id
, subscription_id
. subscription_id
would be chat-sub
if you follow Pub/Sub mode example.
Example
roslaunch google_chat_ros google_chat.launch receiving_mode:=pubsub google_cloud_credentials_json:=/path/to/<project_id>-XXXXXXXX.json project_id:=<project_id> subscription_id:=chat-sub
2. Sending the message
2.1 Understanding Google Chat Room
When you see Google Chat UI with browsers or smartphone’s apps, you may see space
, thread
. If you send new message, you must specify the space or thread you want to send the message to. You can get the space name from chat room’s URL. If it is https://mail.google.com/chat/u/0/#chat/space/XXXXXXXXXXX
, XXXXXXXXXXX
becomes the space name.
2.2 Message format
There are 2 types of messages, text and card. The card basically follows the original json structure. As the node covers all the units in here with ros action msgs, it may be complicated for you if you want to use all of them. So in Examples sections, we’ll show you simple ones.
2.3 Sending the message by actionlib
All you have to do is send Actionlib goal to ~send/goal
.
2.4 Examples
Showing the message examples with rostopic pub -1
command on bash
.
Sending a text message
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Hello!'
space: 'spaces/<space name>'"
Sending a message with KeyValue card
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Something FATAL errors have happened in my computer, please fix ASAP'
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'Process ID'
content: '1234'
bottom_label: 'rospy'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'"
Sending an Interactive button
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
header:
title: 'What do you want to eat?'
subtitle: 'Please choose the food shop!'
sections:
-
widgets:
-
buttons:
-
text_button_name: 'STARBUCKS'
text_button_on_click:
action:
action_method_name: 'vote_starbucks'
parameters:
-
key: 'shop'
value: 'starbucks'
-
text_button_name: 'SUBWAY'
text_button_on_click:
action:
action_method_name: 'vote_subway'
parameters:
-
key: 'shop'
value: 'subway'
space: 'spaces/<space name>'"
Sending a message with an image
See Here.
3. Receiving the messages
3.1 ROS Topic
When the bot was mentioned, the node publishes ~message_activity
topic.
3.2 Examples
Receiving a text message
event_time: "2022-04-28T06:25:26.884623Z"
space:
name: "spaces/<space name>"
display_name: ''
room: False
dm: True
message:
name: "spaces/<space name>/messages/<message id>"
sender:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
create_time: "2022-04-28T06:25:26.884623Z"
text: "Hello!"
thread_name: "spaces/<space name>/threads/<thread name>"
annotations: []
argument_text: "Hello!"
attachments: []
user:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
Receiving a message with an image or gdrive file and download it
4. Handling the interactive event
If you’ve already sent the interactive card like Interactive card example, you can receive the activity of buttons. Suppose someone pressed the button STARBUCKS
, the node publishes a ~card_activity
topic like
event_time: "2022-05-02T00:23:47.855023Z"
space:
name: "spaces/<space name>"
display_name: "robotroom_with_thread"
room: True
dm: False
message:
name: "spaces/<space name>/messages/Go__sDfIdec.Go__sDfIdec"
sender:
name: "users/100406614699672138585"
display_name: "Fetch1075"
avatar_url: "https://lh4.googleusercontent.com/proxy/hWEAWt6fmHsFAzeiEoV5FMOx5-jmU3OnzQxCtrr9unyt73NNwv0lh7InFzOh-0yO3jOPgtColHBywnZnJvl4SVqqqrYkyT1uf18k_hDIVYrAv87AY7lM0hp5KtQ1m9br-aPFE98QwNnSTYc2LQ"
avatar: []
email: ''
bot: True
human: False
create_time: "2022-05-02T00:23:47.855023Z"
text: ''
thread_name: "spaces/<space name>/threads/Go__sDfIdec"
annotations: []
argument_text: ''
attachments: []
user:
name: "users/103866924487978823908"
display_name: "Yoshiki Obinata"
avatar_url: "https://lh3.googleusercontent.com/a-/AOh14GgexXiq8ImuKMgOq6QG-4geIzz5IC1-xa0Caead=k"
avatar: []
email: "<your email>"
bot: False
human: True
action:
action_method_name: "vote_starbucks"
parameters:
-
key: "shop"
value: "starbucks"
After the node which handles the chat event subscribed the topic, it can respond with text message like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'The shop accepted!'
content: 'You choose STARBUCKS!!'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'
thread_name: 'spaces/<space name>/threads/<thread name>'"
The important point is that the client node has to remember the thread_name
which the card event was occured at and send response to it.
5. Optional functions
5.1 Sending a message with an image
To send an image, you have to use card
type message. If you want to add the image uploaded to a storage server available for everyone, you just add its URI like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
image_url: 'https://media-cdn.tripadvisor.com/media/photo-s/11/fb/90/e4/dsc-7314-largejpg.jpg'
space: 'spaces/<your space>'"
If you want to attach image saved at your host, you have to launch (gdrive_ros)[https://github.com/jsk-ros-pkg/jsk_3rdparty/tree/master/gdrive_ros] at first and set ~gdrive_upload_service
param with gdrive_ros/Upload
service name. Then publish topic like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
localpath: '/home/user/Pictures/image.png'
space: 'spaces/<your space>'
5.2 Receiving a message with images or gdrive file
You have to set rosparam ~download_data
True, ~download_directory
. If the node recieved the message with image or google drive file, it automatically downloads to ~donwload_directory
path.
Troubleshoot
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
If you encounter 404 Resource not found (resource=chat-sub).
error on your screen as shown in below.
[INFO] [1680417167.337634]: [/google_chat_ros] Expected to use Google Cloud Pub Sub service
Traceback (most recent call last):
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 473, in <module>
node = GoogleChatROS()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 80,
in __init__
self._pubsub_client.run()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/src/google_chat_ros/google_chat.py", line 135, in run
self._streaming_pull_future.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
Please make sure that you have enabled subscription service, as a default it expires in 7 days. We recommend you to set no expiration date.
Changelog for package google_chat_ros
2.1.28 (2023-07-24)
2.1.27 (2023-06-24)
- fix package.xml/CMakeLists.txt to supress catkin_lint errors (#479)
- Contributors: Kei Okada
2.1.26 (2023-06-14)
- add LICENSE files (#476)
- Contributors: Kei Okada
2.1.25 (2023-06-08)
- google_chat_ros_node.py: display project_id, subscription_id (#459)
- add test to check if ros node is loadable,
(#463)
- install python files under CATKIN_PACKAGE_BIN_DESTINATION
- google_chat_ros/test_rospy_node.py: skip healper.py helper.py depends on dialogflow_task_executive. However, when we add this to the <depend> of package.xml, it appempts to build venv using 'dialogflow_task_executive/requirements.txt'. This requires having the same PYTHON_INTERPRETER for both dialogflow and chat ros package. The issue is that dialogflow_task_executive heavily relies on system Python modules, including ROS, making it difficult to use dialogflow with Python3 on Melodic
- add catkin_install_python for test, it is also change installed directory from BIN to SHARE, because we want to have same directory structure between devel and install
- add test to check if ros node is loadable If we use python2 PYTHON_INTERPRETER on 20.04, python2 fails to load rospy in /opt/ros/noetic, because rospy moduels are alraedy updated. If we use python3 PYTHON_INTERPRETER on 18.04, python3 can load rospy in /opt/ros/melodic by chance. c.f. https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/367
- google_chat_ros/README.md: add troubleshooting (#450)
- fix google_chat_ros noetic build errors (#422)
- use same timestamp for one goal
(#403)
- save google chat image in /chat_notification with timestamp
- add google_chat_ros (#392)
- Contributors: Aoi Nakane, Kei Okada, Naoto Tsukamoto, Shingo Kitagawa, Yoshiki Obinata
2.1.24 (2021-07-26)
2.1.23 (2021-07-21)
2.1.22 (2021-06-10)
2.1.21 (2020-08-19)
2.1.20 (2020-08-07)
2.1.19 (2020-07-21)
2.1.18 (2020-07-20)
2.1.17 (2020-04-16 21:51)
2.1.16 (2020-04-16 15:21)
2.1.15 (2019-12-12)
2.1.14 (2019-11-21)
2.1.13 (2019-07-10)
2.1.12 (2019-05-25)
2.1.11 (2018-08-29)
2.1.10 (2018-04-25)
2.1.9 (2018-04-24)
2.1.8 (2018-04-17)
2.1.7 (2018-04-09)
2.1.6 (2017-11-21)
2.1.5 (2017-11-20)
2.1.4 (2017-07-16)
2.1.3 (2017-07-07)
2.1.2 (2017-07-06)
2.1.1 (2017-07-05)
2.1.0 (2017-07-02)
2.0.20 (2017-05-09)
2.0.19 (2017-02-22)
2.0.18 (2016-10-28)
2.0.17 (2016-10-22)
2.0.16 (2016-10-17)
2.0.15 (2016-10-16)
2.0.14 (2016-03-20)
2.0.13 (2015-12-15)
2.0.12 (2015-11-26)
2.0.11 (2015-10-07 14:16)
2.0.10 (2015-10-07 12:47)
2.0.9 (2015-09-26)
2.0.8 (2015-09-15)
2.0.7 (2015-09-14)
2.0.6 (2015-09-08)
2.0.5 (2015-08-23)
2.0.4 (2015-08-18)
2.0.3 (2015-08-01)
2.0.2 (2015-06-29)
2.0.1 (2015-06-19 21:21)
2.0.0 (2015-06-19 10:41)
1.0.71 (2015-05-17)
1.0.70 (2015-05-08)
1.0.69 (2015-05-05 12:28)
1.0.68 (2015-05-05 09:49)
1.0.67 (2015-05-03)
1.0.66 (2015-04-03)
1.0.65 (2015-04-02)
1.0.64 (2015-03-29)
1.0.63 (2015-02-19)
1.0.62 (2015-02-17)
1.0.61 (2015-02-11)
1.0.60 (2015-02-03 10:12)
1.0.59 (2015-02-03 04:05)
1.0.58 (2015-01-07)
1.0.57 (2014-12-23)
1.0.56 (2014-12-17)
1.0.55 (2014-12-09)
1.0.54 (2014-11-15)
1.0.53 (2014-11-01)
1.0.52 (2014-10-23)
1.0.51 (2014-10-20 16:01)
1.0.50 (2014-10-20 01:50)
1.0.49 (2014-10-13)
1.0.48 (2014-10-12)
1.0.47 (2014-10-08)
1.0.46 (2014-10-03)
1.0.45 (2014-09-29)
1.0.44 (2014-09-26 09:17)
1.0.43 (2014-09-26 01:08)
1.0.42 (2014-09-25)
1.0.41 (2014-09-23)
1.0.40 (2014-09-19)
1.0.39 (2014-09-17)
1.0.38 (2014-09-13)
1.0.37 (2014-09-08)
1.0.36 (2014-09-01)
1.0.35 (2014-08-16)
1.0.34 (2014-08-14)
1.0.33 (2014-07-28)
1.0.32 (2014-07-26)
1.0.31 (2014-07-23)
1.0.30 (2014-07-15)
1.0.29 (2014-07-02)
1.0.28 (2014-06-24)
1.0.27 (2014-06-10)
1.0.26 (2014-05-30)
1.0.25 (2014-05-26)
1.0.24 (2014-05-24)
1.0.23 (2014-05-23)
1.0.22 (2014-05-22)
1.0.21 (2014-05-20)
1.0.20 (2014-05-09)
1.0.19 (2014-05-06)
1.0.18 (2014-05-04)
1.0.17 (2014-04-20)
1.0.16 (2014-04-19 23:29)
1.0.15 (2014-04-19 20:19)
1.0.14 (2014-04-19 12:52)
1.0.13 (2014-04-19 11:06)
1.0.12 (2014-04-18 16:58)
1.0.11 (2014-04-18 08:18)
1.0.10 (2014-04-17)
1.0.9 (2014-04-12)
1.0.8 (2014-04-11)
1.0.7 (2014-04-10)
1.0.6 (2014-04-07)
1.0.5 (2014-03-31)
1.0.4 (2014-03-29)
1.0.3 (2014-03-19)
1.0.2 (2014-03-12)
1.0.1 (2014-03-07)
1.0.0 (2014-03-05)
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
message_generation | |
std_msgs | |
actionlib_msgs | |
catkin_virtualenv | |
catkin | |
message_runtime | |
rospy | |
gdrive_ros | |
dialogflow_task_executive | |
rostest |
System Dependencies
Dependant Packages
Name | Deps |
---|---|
jsk_3rdparty |
Launch files
- launch/google_chat.launch
-
- receiving_mode [default: url] — Google Chat API settings. Choose from url, dialogflow, pubsub, none.
- gdrive_upload_service [default: /gdrive_ros/upload] — The ROS service name of gdrive_ros upload
- upload_data_timeout [default: 20]
- download_data [default: true]
- download_data_timeout [default: 10]
- download_directory [default: /tmp]
- download_avatar [default: false]
- google_cloud_credentials_json [default: ]
- use_yaml [default: false] — Whether you use yaml file or not.
- yaml_file [default: ] — Yaml file of web settings.
- respawn [default: true]
- host [default: localhost]
- port [default: 443]
- ssl_certfile [default: default]
- ssl_keyfile [default: default]
- project_id [default: default]
- subscription_id [default: default]
- use_helper [default: true]
- to_dialogflow_client [default: false]
- debug_sound [default: false]
Messages
- msg/FormAction.msg
- msg/KeyValue.msg
- msg/ActionParameter.msg
- msg/Attachment.msg
- msg/Section.msg
- msg/Button.msg
- msg/MessageEvent.msg
- msg/Message.msg
- msg/WidgetMarkup.msg
- msg/CardHeader.msg
- msg/Image.msg
- msg/User.msg
- msg/Space.msg
- msg/SpaceEvent.msg
- msg/CardAction.msg
- msg/OnClick.msg
- msg/Annotation.msg
- msg/CardEvent.msg
- msg/SlashCommand.msg
- msg/Card.msg
Services
Plugins
Recent questions tagged google_chat_ros at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 2.1.28 |
License | BSD |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2024-07-10 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Kei Okada
Authors
- Yoshiki Obinata
Google Chat ROS
The ROS wrapper for Google Chat API
- Installation Guide
- Sending the message
- Receiving the message
- Handling the event
- Optional functions
- Helper nodes
1. Installation Guide
1.1 Get the API KEY
At first, you should have the permission to access the Google Chat API.
See Google Official Document. Please ensure to get JSON credetial file and save it. DO NOT LOST IT!
For JSK members, all keys are available at Google Drive. If you make new API keys, please upload them here.
1.2 Select the way how to recieve Google Chat event
The way you recieve Google Chat event from API server depends on your system. If your system has static IP and is allowed to recieve https request with specific port, please see HTTPS mode. If not, please see Pub/Sub mode.
HTTPS mode
When you send the message, the node uses Google REST API. When you recieve the message, Google Chat API sends https request to your machine and the node handles it.
You have to prepare SSL certificate. Self-signed one is not available because of Google security issue. Please use the service like Let’s Encrypt. In Google Cloud console, please choose App URL
as connection settings and fill the URL in the App URL form.
Pub/Sub mode
When you send the message, the node uses Google REST API. When you recieve the message, the node uses Google Pub/Sub API’s subscription. The node has already established its connection to Google Pub/Sub API when you launch it.
The way how to set up in Google Cloud console shows below.
1. Authorize the existing Google Chat API project to access Google Cloud Pub/Sub service
In IAM settings in the console, please add the role Pub/Sub Admin
to service account.
2. Create Pub/Sub topic and subscriber
In Pub/Sub settings in the console, please add the topic and subscriptions.
In the figure, we set the topic name chat
, the subscription name chat-sub
as an example.
Note that if you set the topic name chat
, the full name of it becomes projects/<project_name>/topics/chat
. Please confirm the subsciptions subscribes the full name not short one.
3. Grant publish rigts on your topic
In order for Google Chat to publish messages to your topic, it must have publishing rights to the topic. To grant Google Chat these permissions, assign the Pub/Sub Publisher role to the following service account
chat-api-push@system.gserviceaccount.com
4. Set Google Chat API Connection settings
Please choose Cloud Pub/Sub
as connection settings and fill the full topic name in the Topic Name form.
1.3 Install/Build the ROS node
If you want to build from the source
source /opt/ros/${ROS_DISTRO}/setup.bash
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
git clone https://github.com/jsk-ros-pkg/jsk_3rdparty
rosdep install --ignore-src --from-paths . -y -r
cd ..
catkin build
1.4 Launch the node
HTTPS mode
You have to set rosparams receiving_mode=https
, google_cloud_credentials_json
, host
, port
, ssl_certfile
, ssl_keyfile
.
Pub/Sub mode
You have to set rosparams receiving_mode=pubsub
, google_cloud_credentials_json
, project_id
, subscription_id
. subscription_id
would be chat-sub
if you follow Pub/Sub mode example.
Example
roslaunch google_chat_ros google_chat.launch receiving_mode:=pubsub google_cloud_credentials_json:=/path/to/<project_id>-XXXXXXXX.json project_id:=<project_id> subscription_id:=chat-sub
2. Sending the message
2.1 Understanding Google Chat Room
When you see Google Chat UI with browsers or smartphone’s apps, you may see space
, thread
. If you send new message, you must specify the space or thread you want to send the message to. You can get the space name from chat room’s URL. If it is https://mail.google.com/chat/u/0/#chat/space/XXXXXXXXXXX
, XXXXXXXXXXX
becomes the space name.
2.2 Message format
There are 2 types of messages, text and card. The card basically follows the original json structure. As the node covers all the units in here with ros action msgs, it may be complicated for you if you want to use all of them. So in Examples sections, we’ll show you simple ones.
2.3 Sending the message by actionlib
All you have to do is send Actionlib goal to ~send/goal
.
2.4 Examples
Showing the message examples with rostopic pub -1
command on bash
.
Sending a text message
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Hello!'
space: 'spaces/<space name>'"
Sending a message with KeyValue card
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Something FATAL errors have happened in my computer, please fix ASAP'
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'Process ID'
content: '1234'
bottom_label: 'rospy'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'"
Sending an Interactive button
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
header:
title: 'What do you want to eat?'
subtitle: 'Please choose the food shop!'
sections:
-
widgets:
-
buttons:
-
text_button_name: 'STARBUCKS'
text_button_on_click:
action:
action_method_name: 'vote_starbucks'
parameters:
-
key: 'shop'
value: 'starbucks'
-
text_button_name: 'SUBWAY'
text_button_on_click:
action:
action_method_name: 'vote_subway'
parameters:
-
key: 'shop'
value: 'subway'
space: 'spaces/<space name>'"
Sending a message with an image
See Here.
3. Receiving the messages
3.1 ROS Topic
When the bot was mentioned, the node publishes ~message_activity
topic.
3.2 Examples
Receiving a text message
event_time: "2022-04-28T06:25:26.884623Z"
space:
name: "spaces/<space name>"
display_name: ''
room: False
dm: True
message:
name: "spaces/<space name>/messages/<message id>"
sender:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
create_time: "2022-04-28T06:25:26.884623Z"
text: "Hello!"
thread_name: "spaces/<space name>/threads/<thread name>"
annotations: []
argument_text: "Hello!"
attachments: []
user:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
Receiving a message with an image or gdrive file and download it
4. Handling the interactive event
If you’ve already sent the interactive card like Interactive card example, you can receive the activity of buttons. Suppose someone pressed the button STARBUCKS
, the node publishes a ~card_activity
topic like
event_time: "2022-05-02T00:23:47.855023Z"
space:
name: "spaces/<space name>"
display_name: "robotroom_with_thread"
room: True
dm: False
message:
name: "spaces/<space name>/messages/Go__sDfIdec.Go__sDfIdec"
sender:
name: "users/100406614699672138585"
display_name: "Fetch1075"
avatar_url: "https://lh4.googleusercontent.com/proxy/hWEAWt6fmHsFAzeiEoV5FMOx5-jmU3OnzQxCtrr9unyt73NNwv0lh7InFzOh-0yO3jOPgtColHBywnZnJvl4SVqqqrYkyT1uf18k_hDIVYrAv87AY7lM0hp5KtQ1m9br-aPFE98QwNnSTYc2LQ"
avatar: []
email: ''
bot: True
human: False
create_time: "2022-05-02T00:23:47.855023Z"
text: ''
thread_name: "spaces/<space name>/threads/Go__sDfIdec"
annotations: []
argument_text: ''
attachments: []
user:
name: "users/103866924487978823908"
display_name: "Yoshiki Obinata"
avatar_url: "https://lh3.googleusercontent.com/a-/AOh14GgexXiq8ImuKMgOq6QG-4geIzz5IC1-xa0Caead=k"
avatar: []
email: "<your email>"
bot: False
human: True
action:
action_method_name: "vote_starbucks"
parameters:
-
key: "shop"
value: "starbucks"
After the node which handles the chat event subscribed the topic, it can respond with text message like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'The shop accepted!'
content: 'You choose STARBUCKS!!'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'
thread_name: 'spaces/<space name>/threads/<thread name>'"
The important point is that the client node has to remember the thread_name
which the card event was occured at and send response to it.
5. Optional functions
5.1 Sending a message with an image
To send an image, you have to use card
type message. If you want to add the image uploaded to a storage server available for everyone, you just add its URI like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
image_url: 'https://media-cdn.tripadvisor.com/media/photo-s/11/fb/90/e4/dsc-7314-largejpg.jpg'
space: 'spaces/<your space>'"
If you want to attach image saved at your host, you have to launch (gdrive_ros)[https://github.com/jsk-ros-pkg/jsk_3rdparty/tree/master/gdrive_ros] at first and set ~gdrive_upload_service
param with gdrive_ros/Upload
service name. Then publish topic like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
localpath: '/home/user/Pictures/image.png'
space: 'spaces/<your space>'
5.2 Receiving a message with images or gdrive file
You have to set rosparam ~download_data
True, ~download_directory
. If the node recieved the message with image or google drive file, it automatically downloads to ~donwload_directory
path.
Troubleshoot
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
If you encounter 404 Resource not found (resource=chat-sub).
error on your screen as shown in below.
[INFO] [1680417167.337634]: [/google_chat_ros] Expected to use Google Cloud Pub Sub service
Traceback (most recent call last):
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 473, in <module>
node = GoogleChatROS()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 80,
in __init__
self._pubsub_client.run()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/src/google_chat_ros/google_chat.py", line 135, in run
self._streaming_pull_future.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
Please make sure that you have enabled subscription service, as a default it expires in 7 days. We recommend you to set no expiration date.
Changelog for package google_chat_ros
2.1.28 (2023-07-24)
2.1.27 (2023-06-24)
- fix package.xml/CMakeLists.txt to supress catkin_lint errors (#479)
- Contributors: Kei Okada
2.1.26 (2023-06-14)
- add LICENSE files (#476)
- Contributors: Kei Okada
2.1.25 (2023-06-08)
- google_chat_ros_node.py: display project_id, subscription_id (#459)
- add test to check if ros node is loadable,
(#463)
- install python files under CATKIN_PACKAGE_BIN_DESTINATION
- google_chat_ros/test_rospy_node.py: skip healper.py helper.py depends on dialogflow_task_executive. However, when we add this to the <depend> of package.xml, it appempts to build venv using 'dialogflow_task_executive/requirements.txt'. This requires having the same PYTHON_INTERPRETER for both dialogflow and chat ros package. The issue is that dialogflow_task_executive heavily relies on system Python modules, including ROS, making it difficult to use dialogflow with Python3 on Melodic
- add catkin_install_python for test, it is also change installed directory from BIN to SHARE, because we want to have same directory structure between devel and install
- add test to check if ros node is loadable If we use python2 PYTHON_INTERPRETER on 20.04, python2 fails to load rospy in /opt/ros/noetic, because rospy moduels are alraedy updated. If we use python3 PYTHON_INTERPRETER on 18.04, python3 can load rospy in /opt/ros/melodic by chance. c.f. https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/367
- google_chat_ros/README.md: add troubleshooting (#450)
- fix google_chat_ros noetic build errors (#422)
- use same timestamp for one goal
(#403)
- save google chat image in /chat_notification with timestamp
- add google_chat_ros (#392)
- Contributors: Aoi Nakane, Kei Okada, Naoto Tsukamoto, Shingo Kitagawa, Yoshiki Obinata
2.1.24 (2021-07-26)
2.1.23 (2021-07-21)
2.1.22 (2021-06-10)
2.1.21 (2020-08-19)
2.1.20 (2020-08-07)
2.1.19 (2020-07-21)
2.1.18 (2020-07-20)
2.1.17 (2020-04-16 21:51)
2.1.16 (2020-04-16 15:21)
2.1.15 (2019-12-12)
2.1.14 (2019-11-21)
2.1.13 (2019-07-10)
2.1.12 (2019-05-25)
2.1.11 (2018-08-29)
2.1.10 (2018-04-25)
2.1.9 (2018-04-24)
2.1.8 (2018-04-17)
2.1.7 (2018-04-09)
2.1.6 (2017-11-21)
2.1.5 (2017-11-20)
2.1.4 (2017-07-16)
2.1.3 (2017-07-07)
2.1.2 (2017-07-06)
2.1.1 (2017-07-05)
2.1.0 (2017-07-02)
2.0.20 (2017-05-09)
2.0.19 (2017-02-22)
2.0.18 (2016-10-28)
2.0.17 (2016-10-22)
2.0.16 (2016-10-17)
2.0.15 (2016-10-16)
2.0.14 (2016-03-20)
2.0.13 (2015-12-15)
2.0.12 (2015-11-26)
2.0.11 (2015-10-07 14:16)
2.0.10 (2015-10-07 12:47)
2.0.9 (2015-09-26)
2.0.8 (2015-09-15)
2.0.7 (2015-09-14)
2.0.6 (2015-09-08)
2.0.5 (2015-08-23)
2.0.4 (2015-08-18)
2.0.3 (2015-08-01)
2.0.2 (2015-06-29)
2.0.1 (2015-06-19 21:21)
2.0.0 (2015-06-19 10:41)
1.0.71 (2015-05-17)
1.0.70 (2015-05-08)
1.0.69 (2015-05-05 12:28)
1.0.68 (2015-05-05 09:49)
1.0.67 (2015-05-03)
1.0.66 (2015-04-03)
1.0.65 (2015-04-02)
1.0.64 (2015-03-29)
1.0.63 (2015-02-19)
1.0.62 (2015-02-17)
1.0.61 (2015-02-11)
1.0.60 (2015-02-03 10:12)
1.0.59 (2015-02-03 04:05)
1.0.58 (2015-01-07)
1.0.57 (2014-12-23)
1.0.56 (2014-12-17)
1.0.55 (2014-12-09)
1.0.54 (2014-11-15)
1.0.53 (2014-11-01)
1.0.52 (2014-10-23)
1.0.51 (2014-10-20 16:01)
1.0.50 (2014-10-20 01:50)
1.0.49 (2014-10-13)
1.0.48 (2014-10-12)
1.0.47 (2014-10-08)
1.0.46 (2014-10-03)
1.0.45 (2014-09-29)
1.0.44 (2014-09-26 09:17)
1.0.43 (2014-09-26 01:08)
1.0.42 (2014-09-25)
1.0.41 (2014-09-23)
1.0.40 (2014-09-19)
1.0.39 (2014-09-17)
1.0.38 (2014-09-13)
1.0.37 (2014-09-08)
1.0.36 (2014-09-01)
1.0.35 (2014-08-16)
1.0.34 (2014-08-14)
1.0.33 (2014-07-28)
1.0.32 (2014-07-26)
1.0.31 (2014-07-23)
1.0.30 (2014-07-15)
1.0.29 (2014-07-02)
1.0.28 (2014-06-24)
1.0.27 (2014-06-10)
1.0.26 (2014-05-30)
1.0.25 (2014-05-26)
1.0.24 (2014-05-24)
1.0.23 (2014-05-23)
1.0.22 (2014-05-22)
1.0.21 (2014-05-20)
1.0.20 (2014-05-09)
1.0.19 (2014-05-06)
1.0.18 (2014-05-04)
1.0.17 (2014-04-20)
1.0.16 (2014-04-19 23:29)
1.0.15 (2014-04-19 20:19)
1.0.14 (2014-04-19 12:52)
1.0.13 (2014-04-19 11:06)
1.0.12 (2014-04-18 16:58)
1.0.11 (2014-04-18 08:18)
1.0.10 (2014-04-17)
1.0.9 (2014-04-12)
1.0.8 (2014-04-11)
1.0.7 (2014-04-10)
1.0.6 (2014-04-07)
1.0.5 (2014-03-31)
1.0.4 (2014-03-29)
1.0.3 (2014-03-19)
1.0.2 (2014-03-12)
1.0.1 (2014-03-07)
1.0.0 (2014-03-05)
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
message_generation | |
std_msgs | |
actionlib_msgs | |
catkin_virtualenv | |
catkin | |
message_runtime | |
rospy | |
gdrive_ros | |
dialogflow_task_executive | |
rostest |
System Dependencies
Dependant Packages
Name | Deps |
---|---|
jsk_3rdparty |
Launch files
- launch/google_chat.launch
-
- receiving_mode [default: url] — Google Chat API settings. Choose from url, dialogflow, pubsub, none.
- gdrive_upload_service [default: /gdrive_ros/upload] — The ROS service name of gdrive_ros upload
- upload_data_timeout [default: 20]
- download_data [default: true]
- download_data_timeout [default: 10]
- download_directory [default: /tmp]
- download_avatar [default: false]
- google_cloud_credentials_json [default: ]
- use_yaml [default: false] — Whether you use yaml file or not.
- yaml_file [default: ] — Yaml file of web settings.
- respawn [default: true]
- host [default: localhost]
- port [default: 443]
- ssl_certfile [default: default]
- ssl_keyfile [default: default]
- project_id [default: default]
- subscription_id [default: default]
- use_helper [default: true]
- to_dialogflow_client [default: false]
- debug_sound [default: false]
Messages
- msg/FormAction.msg
- msg/KeyValue.msg
- msg/ActionParameter.msg
- msg/Attachment.msg
- msg/Section.msg
- msg/Button.msg
- msg/MessageEvent.msg
- msg/Message.msg
- msg/WidgetMarkup.msg
- msg/CardHeader.msg
- msg/Image.msg
- msg/User.msg
- msg/Space.msg
- msg/SpaceEvent.msg
- msg/CardAction.msg
- msg/OnClick.msg
- msg/Annotation.msg
- msg/CardEvent.msg
- msg/SlashCommand.msg
- msg/Card.msg
Services
Plugins
Recent questions tagged google_chat_ros at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 2.1.28 |
License | BSD |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2024-07-10 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Kei Okada
Authors
- Yoshiki Obinata
Google Chat ROS
The ROS wrapper for Google Chat API
- Installation Guide
- Sending the message
- Receiving the message
- Handling the event
- Optional functions
- Helper nodes
1. Installation Guide
1.1 Get the API KEY
At first, you should have the permission to access the Google Chat API.
See Google Official Document. Please ensure to get JSON credetial file and save it. DO NOT LOST IT!
For JSK members, all keys are available at Google Drive. If you make new API keys, please upload them here.
1.2 Select the way how to recieve Google Chat event
The way you recieve Google Chat event from API server depends on your system. If your system has static IP and is allowed to recieve https request with specific port, please see HTTPS mode. If not, please see Pub/Sub mode.
HTTPS mode
When you send the message, the node uses Google REST API. When you recieve the message, Google Chat API sends https request to your machine and the node handles it.
You have to prepare SSL certificate. Self-signed one is not available because of Google security issue. Please use the service like Let’s Encrypt. In Google Cloud console, please choose App URL
as connection settings and fill the URL in the App URL form.
Pub/Sub mode
When you send the message, the node uses Google REST API. When you recieve the message, the node uses Google Pub/Sub API’s subscription. The node has already established its connection to Google Pub/Sub API when you launch it.
The way how to set up in Google Cloud console shows below.
1. Authorize the existing Google Chat API project to access Google Cloud Pub/Sub service
In IAM settings in the console, please add the role Pub/Sub Admin
to service account.
2. Create Pub/Sub topic and subscriber
In Pub/Sub settings in the console, please add the topic and subscriptions.
In the figure, we set the topic name chat
, the subscription name chat-sub
as an example.
Note that if you set the topic name chat
, the full name of it becomes projects/<project_name>/topics/chat
. Please confirm the subsciptions subscribes the full name not short one.
3. Grant publish rigts on your topic
In order for Google Chat to publish messages to your topic, it must have publishing rights to the topic. To grant Google Chat these permissions, assign the Pub/Sub Publisher role to the following service account
chat-api-push@system.gserviceaccount.com
4. Set Google Chat API Connection settings
Please choose Cloud Pub/Sub
as connection settings and fill the full topic name in the Topic Name form.
1.3 Install/Build the ROS node
If you want to build from the source
source /opt/ros/${ROS_DISTRO}/setup.bash
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
git clone https://github.com/jsk-ros-pkg/jsk_3rdparty
rosdep install --ignore-src --from-paths . -y -r
cd ..
catkin build
1.4 Launch the node
HTTPS mode
You have to set rosparams receiving_mode=https
, google_cloud_credentials_json
, host
, port
, ssl_certfile
, ssl_keyfile
.
Pub/Sub mode
You have to set rosparams receiving_mode=pubsub
, google_cloud_credentials_json
, project_id
, subscription_id
. subscription_id
would be chat-sub
if you follow Pub/Sub mode example.
Example
roslaunch google_chat_ros google_chat.launch receiving_mode:=pubsub google_cloud_credentials_json:=/path/to/<project_id>-XXXXXXXX.json project_id:=<project_id> subscription_id:=chat-sub
2. Sending the message
2.1 Understanding Google Chat Room
When you see Google Chat UI with browsers or smartphone’s apps, you may see space
, thread
. If you send new message, you must specify the space or thread you want to send the message to. You can get the space name from chat room’s URL. If it is https://mail.google.com/chat/u/0/#chat/space/XXXXXXXXXXX
, XXXXXXXXXXX
becomes the space name.
2.2 Message format
There are 2 types of messages, text and card. The card basically follows the original json structure. As the node covers all the units in here with ros action msgs, it may be complicated for you if you want to use all of them. So in Examples sections, we’ll show you simple ones.
2.3 Sending the message by actionlib
All you have to do is send Actionlib goal to ~send/goal
.
2.4 Examples
Showing the message examples with rostopic pub -1
command on bash
.
Sending a text message
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Hello!'
space: 'spaces/<space name>'"
Sending a message with KeyValue card
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Something FATAL errors have happened in my computer, please fix ASAP'
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'Process ID'
content: '1234'
bottom_label: 'rospy'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'"
Sending an Interactive button
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
header:
title: 'What do you want to eat?'
subtitle: 'Please choose the food shop!'
sections:
-
widgets:
-
buttons:
-
text_button_name: 'STARBUCKS'
text_button_on_click:
action:
action_method_name: 'vote_starbucks'
parameters:
-
key: 'shop'
value: 'starbucks'
-
text_button_name: 'SUBWAY'
text_button_on_click:
action:
action_method_name: 'vote_subway'
parameters:
-
key: 'shop'
value: 'subway'
space: 'spaces/<space name>'"
Sending a message with an image
See Here.
3. Receiving the messages
3.1 ROS Topic
When the bot was mentioned, the node publishes ~message_activity
topic.
3.2 Examples
Receiving a text message
event_time: "2022-04-28T06:25:26.884623Z"
space:
name: "spaces/<space name>"
display_name: ''
room: False
dm: True
message:
name: "spaces/<space name>/messages/<message id>"
sender:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
create_time: "2022-04-28T06:25:26.884623Z"
text: "Hello!"
thread_name: "spaces/<space name>/threads/<thread name>"
annotations: []
argument_text: "Hello!"
attachments: []
user:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
Receiving a message with an image or gdrive file and download it
4. Handling the interactive event
If you’ve already sent the interactive card like Interactive card example, you can receive the activity of buttons. Suppose someone pressed the button STARBUCKS
, the node publishes a ~card_activity
topic like
event_time: "2022-05-02T00:23:47.855023Z"
space:
name: "spaces/<space name>"
display_name: "robotroom_with_thread"
room: True
dm: False
message:
name: "spaces/<space name>/messages/Go__sDfIdec.Go__sDfIdec"
sender:
name: "users/100406614699672138585"
display_name: "Fetch1075"
avatar_url: "https://lh4.googleusercontent.com/proxy/hWEAWt6fmHsFAzeiEoV5FMOx5-jmU3OnzQxCtrr9unyt73NNwv0lh7InFzOh-0yO3jOPgtColHBywnZnJvl4SVqqqrYkyT1uf18k_hDIVYrAv87AY7lM0hp5KtQ1m9br-aPFE98QwNnSTYc2LQ"
avatar: []
email: ''
bot: True
human: False
create_time: "2022-05-02T00:23:47.855023Z"
text: ''
thread_name: "spaces/<space name>/threads/Go__sDfIdec"
annotations: []
argument_text: ''
attachments: []
user:
name: "users/103866924487978823908"
display_name: "Yoshiki Obinata"
avatar_url: "https://lh3.googleusercontent.com/a-/AOh14GgexXiq8ImuKMgOq6QG-4geIzz5IC1-xa0Caead=k"
avatar: []
email: "<your email>"
bot: False
human: True
action:
action_method_name: "vote_starbucks"
parameters:
-
key: "shop"
value: "starbucks"
After the node which handles the chat event subscribed the topic, it can respond with text message like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'The shop accepted!'
content: 'You choose STARBUCKS!!'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'
thread_name: 'spaces/<space name>/threads/<thread name>'"
The important point is that the client node has to remember the thread_name
which the card event was occured at and send response to it.
5. Optional functions
5.1 Sending a message with an image
To send an image, you have to use card
type message. If you want to add the image uploaded to a storage server available for everyone, you just add its URI like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
image_url: 'https://media-cdn.tripadvisor.com/media/photo-s/11/fb/90/e4/dsc-7314-largejpg.jpg'
space: 'spaces/<your space>'"
If you want to attach image saved at your host, you have to launch (gdrive_ros)[https://github.com/jsk-ros-pkg/jsk_3rdparty/tree/master/gdrive_ros] at first and set ~gdrive_upload_service
param with gdrive_ros/Upload
service name. Then publish topic like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
localpath: '/home/user/Pictures/image.png'
space: 'spaces/<your space>'
5.2 Receiving a message with images or gdrive file
You have to set rosparam ~download_data
True, ~download_directory
. If the node recieved the message with image or google drive file, it automatically downloads to ~donwload_directory
path.
Troubleshoot
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
If you encounter 404 Resource not found (resource=chat-sub).
error on your screen as shown in below.
[INFO] [1680417167.337634]: [/google_chat_ros] Expected to use Google Cloud Pub Sub service
Traceback (most recent call last):
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 473, in <module>
node = GoogleChatROS()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 80,
in __init__
self._pubsub_client.run()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/src/google_chat_ros/google_chat.py", line 135, in run
self._streaming_pull_future.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
Please make sure that you have enabled subscription service, as a default it expires in 7 days. We recommend you to set no expiration date.
Changelog for package google_chat_ros
2.1.28 (2023-07-24)
2.1.27 (2023-06-24)
- fix package.xml/CMakeLists.txt to supress catkin_lint errors (#479)
- Contributors: Kei Okada
2.1.26 (2023-06-14)
- add LICENSE files (#476)
- Contributors: Kei Okada
2.1.25 (2023-06-08)
- google_chat_ros_node.py: display project_id, subscription_id (#459)
- add test to check if ros node is loadable,
(#463)
- install python files under CATKIN_PACKAGE_BIN_DESTINATION
- google_chat_ros/test_rospy_node.py: skip healper.py helper.py depends on dialogflow_task_executive. However, when we add this to the <depend> of package.xml, it appempts to build venv using 'dialogflow_task_executive/requirements.txt'. This requires having the same PYTHON_INTERPRETER for both dialogflow and chat ros package. The issue is that dialogflow_task_executive heavily relies on system Python modules, including ROS, making it difficult to use dialogflow with Python3 on Melodic
- add catkin_install_python for test, it is also change installed directory from BIN to SHARE, because we want to have same directory structure between devel and install
- add test to check if ros node is loadable If we use python2 PYTHON_INTERPRETER on 20.04, python2 fails to load rospy in /opt/ros/noetic, because rospy moduels are alraedy updated. If we use python3 PYTHON_INTERPRETER on 18.04, python3 can load rospy in /opt/ros/melodic by chance. c.f. https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/367
- google_chat_ros/README.md: add troubleshooting (#450)
- fix google_chat_ros noetic build errors (#422)
- use same timestamp for one goal
(#403)
- save google chat image in /chat_notification with timestamp
- add google_chat_ros (#392)
- Contributors: Aoi Nakane, Kei Okada, Naoto Tsukamoto, Shingo Kitagawa, Yoshiki Obinata
2.1.24 (2021-07-26)
2.1.23 (2021-07-21)
2.1.22 (2021-06-10)
2.1.21 (2020-08-19)
2.1.20 (2020-08-07)
2.1.19 (2020-07-21)
2.1.18 (2020-07-20)
2.1.17 (2020-04-16 21:51)
2.1.16 (2020-04-16 15:21)
2.1.15 (2019-12-12)
2.1.14 (2019-11-21)
2.1.13 (2019-07-10)
2.1.12 (2019-05-25)
2.1.11 (2018-08-29)
2.1.10 (2018-04-25)
2.1.9 (2018-04-24)
2.1.8 (2018-04-17)
2.1.7 (2018-04-09)
2.1.6 (2017-11-21)
2.1.5 (2017-11-20)
2.1.4 (2017-07-16)
2.1.3 (2017-07-07)
2.1.2 (2017-07-06)
2.1.1 (2017-07-05)
2.1.0 (2017-07-02)
2.0.20 (2017-05-09)
2.0.19 (2017-02-22)
2.0.18 (2016-10-28)
2.0.17 (2016-10-22)
2.0.16 (2016-10-17)
2.0.15 (2016-10-16)
2.0.14 (2016-03-20)
2.0.13 (2015-12-15)
2.0.12 (2015-11-26)
2.0.11 (2015-10-07 14:16)
2.0.10 (2015-10-07 12:47)
2.0.9 (2015-09-26)
2.0.8 (2015-09-15)
2.0.7 (2015-09-14)
2.0.6 (2015-09-08)
2.0.5 (2015-08-23)
2.0.4 (2015-08-18)
2.0.3 (2015-08-01)
2.0.2 (2015-06-29)
2.0.1 (2015-06-19 21:21)
2.0.0 (2015-06-19 10:41)
1.0.71 (2015-05-17)
1.0.70 (2015-05-08)
1.0.69 (2015-05-05 12:28)
1.0.68 (2015-05-05 09:49)
1.0.67 (2015-05-03)
1.0.66 (2015-04-03)
1.0.65 (2015-04-02)
1.0.64 (2015-03-29)
1.0.63 (2015-02-19)
1.0.62 (2015-02-17)
1.0.61 (2015-02-11)
1.0.60 (2015-02-03 10:12)
1.0.59 (2015-02-03 04:05)
1.0.58 (2015-01-07)
1.0.57 (2014-12-23)
1.0.56 (2014-12-17)
1.0.55 (2014-12-09)
1.0.54 (2014-11-15)
1.0.53 (2014-11-01)
1.0.52 (2014-10-23)
1.0.51 (2014-10-20 16:01)
1.0.50 (2014-10-20 01:50)
1.0.49 (2014-10-13)
1.0.48 (2014-10-12)
1.0.47 (2014-10-08)
1.0.46 (2014-10-03)
1.0.45 (2014-09-29)
1.0.44 (2014-09-26 09:17)
1.0.43 (2014-09-26 01:08)
1.0.42 (2014-09-25)
1.0.41 (2014-09-23)
1.0.40 (2014-09-19)
1.0.39 (2014-09-17)
1.0.38 (2014-09-13)
1.0.37 (2014-09-08)
1.0.36 (2014-09-01)
1.0.35 (2014-08-16)
1.0.34 (2014-08-14)
1.0.33 (2014-07-28)
1.0.32 (2014-07-26)
1.0.31 (2014-07-23)
1.0.30 (2014-07-15)
1.0.29 (2014-07-02)
1.0.28 (2014-06-24)
1.0.27 (2014-06-10)
1.0.26 (2014-05-30)
1.0.25 (2014-05-26)
1.0.24 (2014-05-24)
1.0.23 (2014-05-23)
1.0.22 (2014-05-22)
1.0.21 (2014-05-20)
1.0.20 (2014-05-09)
1.0.19 (2014-05-06)
1.0.18 (2014-05-04)
1.0.17 (2014-04-20)
1.0.16 (2014-04-19 23:29)
1.0.15 (2014-04-19 20:19)
1.0.14 (2014-04-19 12:52)
1.0.13 (2014-04-19 11:06)
1.0.12 (2014-04-18 16:58)
1.0.11 (2014-04-18 08:18)
1.0.10 (2014-04-17)
1.0.9 (2014-04-12)
1.0.8 (2014-04-11)
1.0.7 (2014-04-10)
1.0.6 (2014-04-07)
1.0.5 (2014-03-31)
1.0.4 (2014-03-29)
1.0.3 (2014-03-19)
1.0.2 (2014-03-12)
1.0.1 (2014-03-07)
1.0.0 (2014-03-05)
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
message_generation | |
std_msgs | |
actionlib_msgs | |
catkin_virtualenv | |
catkin | |
message_runtime | |
rospy | |
gdrive_ros | |
dialogflow_task_executive | |
rostest |
System Dependencies
Dependant Packages
Name | Deps |
---|---|
jsk_3rdparty | |
jsk_robot_startup |
Launch files
- launch/google_chat.launch
-
- receiving_mode [default: url] — Google Chat API settings. Choose from url, dialogflow, pubsub, none.
- gdrive_upload_service [default: /gdrive_ros/upload] — The ROS service name of gdrive_ros upload
- upload_data_timeout [default: 20]
- download_data [default: true]
- download_data_timeout [default: 10]
- download_directory [default: /tmp]
- download_avatar [default: false]
- google_cloud_credentials_json [default: ]
- use_yaml [default: false] — Whether you use yaml file or not.
- yaml_file [default: ] — Yaml file of web settings.
- respawn [default: true]
- host [default: localhost]
- port [default: 443]
- ssl_certfile [default: default]
- ssl_keyfile [default: default]
- project_id [default: default]
- subscription_id [default: default]
- use_helper [default: true]
- to_dialogflow_client [default: false]
- debug_sound [default: false]
Messages
- msg/FormAction.msg
- msg/KeyValue.msg
- msg/ActionParameter.msg
- msg/Attachment.msg
- msg/Section.msg
- msg/Button.msg
- msg/MessageEvent.msg
- msg/Message.msg
- msg/WidgetMarkup.msg
- msg/CardHeader.msg
- msg/Image.msg
- msg/User.msg
- msg/Space.msg
- msg/SpaceEvent.msg
- msg/CardAction.msg
- msg/OnClick.msg
- msg/Annotation.msg
- msg/CardEvent.msg
- msg/SlashCommand.msg
- msg/Card.msg
Services
Plugins
Recent questions tagged google_chat_ros at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 2.1.28 |
License | BSD |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2024-07-10 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Kei Okada
Authors
- Yoshiki Obinata
Google Chat ROS
The ROS wrapper for Google Chat API
- Installation Guide
- Sending the message
- Receiving the message
- Handling the event
- Optional functions
- Helper nodes
1. Installation Guide
1.1 Get the API KEY
At first, you should have the permission to access the Google Chat API.
See Google Official Document. Please ensure to get JSON credetial file and save it. DO NOT LOST IT!
For JSK members, all keys are available at Google Drive. If you make new API keys, please upload them here.
1.2 Select the way how to recieve Google Chat event
The way you recieve Google Chat event from API server depends on your system. If your system has static IP and is allowed to recieve https request with specific port, please see HTTPS mode. If not, please see Pub/Sub mode.
HTTPS mode
When you send the message, the node uses Google REST API. When you recieve the message, Google Chat API sends https request to your machine and the node handles it.
You have to prepare SSL certificate. Self-signed one is not available because of Google security issue. Please use the service like Let’s Encrypt. In Google Cloud console, please choose App URL
as connection settings and fill the URL in the App URL form.
Pub/Sub mode
When you send the message, the node uses Google REST API. When you recieve the message, the node uses Google Pub/Sub API’s subscription. The node has already established its connection to Google Pub/Sub API when you launch it.
The way how to set up in Google Cloud console shows below.
1. Authorize the existing Google Chat API project to access Google Cloud Pub/Sub service
In IAM settings in the console, please add the role Pub/Sub Admin
to service account.
2. Create Pub/Sub topic and subscriber
In Pub/Sub settings in the console, please add the topic and subscriptions.
In the figure, we set the topic name chat
, the subscription name chat-sub
as an example.
Note that if you set the topic name chat
, the full name of it becomes projects/<project_name>/topics/chat
. Please confirm the subsciptions subscribes the full name not short one.
3. Grant publish rigts on your topic
In order for Google Chat to publish messages to your topic, it must have publishing rights to the topic. To grant Google Chat these permissions, assign the Pub/Sub Publisher role to the following service account
chat-api-push@system.gserviceaccount.com
4. Set Google Chat API Connection settings
Please choose Cloud Pub/Sub
as connection settings and fill the full topic name in the Topic Name form.
1.3 Install/Build the ROS node
If you want to build from the source
source /opt/ros/${ROS_DISTRO}/setup.bash
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
git clone https://github.com/jsk-ros-pkg/jsk_3rdparty
rosdep install --ignore-src --from-paths . -y -r
cd ..
catkin build
1.4 Launch the node
HTTPS mode
You have to set rosparams receiving_mode=https
, google_cloud_credentials_json
, host
, port
, ssl_certfile
, ssl_keyfile
.
Pub/Sub mode
You have to set rosparams receiving_mode=pubsub
, google_cloud_credentials_json
, project_id
, subscription_id
. subscription_id
would be chat-sub
if you follow Pub/Sub mode example.
Example
roslaunch google_chat_ros google_chat.launch receiving_mode:=pubsub google_cloud_credentials_json:=/path/to/<project_id>-XXXXXXXX.json project_id:=<project_id> subscription_id:=chat-sub
2. Sending the message
2.1 Understanding Google Chat Room
When you see Google Chat UI with browsers or smartphone’s apps, you may see space
, thread
. If you send new message, you must specify the space or thread you want to send the message to. You can get the space name from chat room’s URL. If it is https://mail.google.com/chat/u/0/#chat/space/XXXXXXXXXXX
, XXXXXXXXXXX
becomes the space name.
2.2 Message format
There are 2 types of messages, text and card. The card basically follows the original json structure. As the node covers all the units in here with ros action msgs, it may be complicated for you if you want to use all of them. So in Examples sections, we’ll show you simple ones.
2.3 Sending the message by actionlib
All you have to do is send Actionlib goal to ~send/goal
.
2.4 Examples
Showing the message examples with rostopic pub -1
command on bash
.
Sending a text message
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Hello!'
space: 'spaces/<space name>'"
Sending a message with KeyValue card
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Something FATAL errors have happened in my computer, please fix ASAP'
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'Process ID'
content: '1234'
bottom_label: 'rospy'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'"
Sending an Interactive button
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
header:
title: 'What do you want to eat?'
subtitle: 'Please choose the food shop!'
sections:
-
widgets:
-
buttons:
-
text_button_name: 'STARBUCKS'
text_button_on_click:
action:
action_method_name: 'vote_starbucks'
parameters:
-
key: 'shop'
value: 'starbucks'
-
text_button_name: 'SUBWAY'
text_button_on_click:
action:
action_method_name: 'vote_subway'
parameters:
-
key: 'shop'
value: 'subway'
space: 'spaces/<space name>'"
Sending a message with an image
See Here.
3. Receiving the messages
3.1 ROS Topic
When the bot was mentioned, the node publishes ~message_activity
topic.
3.2 Examples
Receiving a text message
event_time: "2022-04-28T06:25:26.884623Z"
space:
name: "spaces/<space name>"
display_name: ''
room: False
dm: True
message:
name: "spaces/<space name>/messages/<message id>"
sender:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
create_time: "2022-04-28T06:25:26.884623Z"
text: "Hello!"
thread_name: "spaces/<space name>/threads/<thread name>"
annotations: []
argument_text: "Hello!"
attachments: []
user:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
Receiving a message with an image or gdrive file and download it
4. Handling the interactive event
If you’ve already sent the interactive card like Interactive card example, you can receive the activity of buttons. Suppose someone pressed the button STARBUCKS
, the node publishes a ~card_activity
topic like
event_time: "2022-05-02T00:23:47.855023Z"
space:
name: "spaces/<space name>"
display_name: "robotroom_with_thread"
room: True
dm: False
message:
name: "spaces/<space name>/messages/Go__sDfIdec.Go__sDfIdec"
sender:
name: "users/100406614699672138585"
display_name: "Fetch1075"
avatar_url: "https://lh4.googleusercontent.com/proxy/hWEAWt6fmHsFAzeiEoV5FMOx5-jmU3OnzQxCtrr9unyt73NNwv0lh7InFzOh-0yO3jOPgtColHBywnZnJvl4SVqqqrYkyT1uf18k_hDIVYrAv87AY7lM0hp5KtQ1m9br-aPFE98QwNnSTYc2LQ"
avatar: []
email: ''
bot: True
human: False
create_time: "2022-05-02T00:23:47.855023Z"
text: ''
thread_name: "spaces/<space name>/threads/Go__sDfIdec"
annotations: []
argument_text: ''
attachments: []
user:
name: "users/103866924487978823908"
display_name: "Yoshiki Obinata"
avatar_url: "https://lh3.googleusercontent.com/a-/AOh14GgexXiq8ImuKMgOq6QG-4geIzz5IC1-xa0Caead=k"
avatar: []
email: "<your email>"
bot: False
human: True
action:
action_method_name: "vote_starbucks"
parameters:
-
key: "shop"
value: "starbucks"
After the node which handles the chat event subscribed the topic, it can respond with text message like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'The shop accepted!'
content: 'You choose STARBUCKS!!'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'
thread_name: 'spaces/<space name>/threads/<thread name>'"
The important point is that the client node has to remember the thread_name
which the card event was occured at and send response to it.
5. Optional functions
5.1 Sending a message with an image
To send an image, you have to use card
type message. If you want to add the image uploaded to a storage server available for everyone, you just add its URI like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
image_url: 'https://media-cdn.tripadvisor.com/media/photo-s/11/fb/90/e4/dsc-7314-largejpg.jpg'
space: 'spaces/<your space>'"
If you want to attach image saved at your host, you have to launch (gdrive_ros)[https://github.com/jsk-ros-pkg/jsk_3rdparty/tree/master/gdrive_ros] at first and set ~gdrive_upload_service
param with gdrive_ros/Upload
service name. Then publish topic like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
localpath: '/home/user/Pictures/image.png'
space: 'spaces/<your space>'
5.2 Receiving a message with images or gdrive file
You have to set rosparam ~download_data
True, ~download_directory
. If the node recieved the message with image or google drive file, it automatically downloads to ~donwload_directory
path.
Troubleshoot
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
If you encounter 404 Resource not found (resource=chat-sub).
error on your screen as shown in below.
[INFO] [1680417167.337634]: [/google_chat_ros] Expected to use Google Cloud Pub Sub service
Traceback (most recent call last):
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 473, in <module>
node = GoogleChatROS()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 80,
in __init__
self._pubsub_client.run()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/src/google_chat_ros/google_chat.py", line 135, in run
self._streaming_pull_future.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
Please make sure that you have enabled subscription service, as a default it expires in 7 days. We recommend you to set no expiration date.
Changelog for package google_chat_ros
2.1.28 (2023-07-24)
2.1.27 (2023-06-24)
- fix package.xml/CMakeLists.txt to supress catkin_lint errors (#479)
- Contributors: Kei Okada
2.1.26 (2023-06-14)
- add LICENSE files (#476)
- Contributors: Kei Okada
2.1.25 (2023-06-08)
- google_chat_ros_node.py: display project_id, subscription_id (#459)
- add test to check if ros node is loadable,
(#463)
- install python files under CATKIN_PACKAGE_BIN_DESTINATION
- google_chat_ros/test_rospy_node.py: skip healper.py helper.py depends on dialogflow_task_executive. However, when we add this to the <depend> of package.xml, it appempts to build venv using 'dialogflow_task_executive/requirements.txt'. This requires having the same PYTHON_INTERPRETER for both dialogflow and chat ros package. The issue is that dialogflow_task_executive heavily relies on system Python modules, including ROS, making it difficult to use dialogflow with Python3 on Melodic
- add catkin_install_python for test, it is also change installed directory from BIN to SHARE, because we want to have same directory structure between devel and install
- add test to check if ros node is loadable If we use python2 PYTHON_INTERPRETER on 20.04, python2 fails to load rospy in /opt/ros/noetic, because rospy moduels are alraedy updated. If we use python3 PYTHON_INTERPRETER on 18.04, python3 can load rospy in /opt/ros/melodic by chance. c.f. https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/367
- google_chat_ros/README.md: add troubleshooting (#450)
- fix google_chat_ros noetic build errors (#422)
- use same timestamp for one goal
(#403)
- save google chat image in /chat_notification with timestamp
- add google_chat_ros (#392)
- Contributors: Aoi Nakane, Kei Okada, Naoto Tsukamoto, Shingo Kitagawa, Yoshiki Obinata
2.1.24 (2021-07-26)
2.1.23 (2021-07-21)
2.1.22 (2021-06-10)
2.1.21 (2020-08-19)
2.1.20 (2020-08-07)
2.1.19 (2020-07-21)
2.1.18 (2020-07-20)
2.1.17 (2020-04-16 21:51)
2.1.16 (2020-04-16 15:21)
2.1.15 (2019-12-12)
2.1.14 (2019-11-21)
2.1.13 (2019-07-10)
2.1.12 (2019-05-25)
2.1.11 (2018-08-29)
2.1.10 (2018-04-25)
2.1.9 (2018-04-24)
2.1.8 (2018-04-17)
2.1.7 (2018-04-09)
2.1.6 (2017-11-21)
2.1.5 (2017-11-20)
2.1.4 (2017-07-16)
2.1.3 (2017-07-07)
2.1.2 (2017-07-06)
2.1.1 (2017-07-05)
2.1.0 (2017-07-02)
2.0.20 (2017-05-09)
2.0.19 (2017-02-22)
2.0.18 (2016-10-28)
2.0.17 (2016-10-22)
2.0.16 (2016-10-17)
2.0.15 (2016-10-16)
2.0.14 (2016-03-20)
2.0.13 (2015-12-15)
2.0.12 (2015-11-26)
2.0.11 (2015-10-07 14:16)
2.0.10 (2015-10-07 12:47)
2.0.9 (2015-09-26)
2.0.8 (2015-09-15)
2.0.7 (2015-09-14)
2.0.6 (2015-09-08)
2.0.5 (2015-08-23)
2.0.4 (2015-08-18)
2.0.3 (2015-08-01)
2.0.2 (2015-06-29)
2.0.1 (2015-06-19 21:21)
2.0.0 (2015-06-19 10:41)
1.0.71 (2015-05-17)
1.0.70 (2015-05-08)
1.0.69 (2015-05-05 12:28)
1.0.68 (2015-05-05 09:49)
1.0.67 (2015-05-03)
1.0.66 (2015-04-03)
1.0.65 (2015-04-02)
1.0.64 (2015-03-29)
1.0.63 (2015-02-19)
1.0.62 (2015-02-17)
1.0.61 (2015-02-11)
1.0.60 (2015-02-03 10:12)
1.0.59 (2015-02-03 04:05)
1.0.58 (2015-01-07)
1.0.57 (2014-12-23)
1.0.56 (2014-12-17)
1.0.55 (2014-12-09)
1.0.54 (2014-11-15)
1.0.53 (2014-11-01)
1.0.52 (2014-10-23)
1.0.51 (2014-10-20 16:01)
1.0.50 (2014-10-20 01:50)
1.0.49 (2014-10-13)
1.0.48 (2014-10-12)
1.0.47 (2014-10-08)
1.0.46 (2014-10-03)
1.0.45 (2014-09-29)
1.0.44 (2014-09-26 09:17)
1.0.43 (2014-09-26 01:08)
1.0.42 (2014-09-25)
1.0.41 (2014-09-23)
1.0.40 (2014-09-19)
1.0.39 (2014-09-17)
1.0.38 (2014-09-13)
1.0.37 (2014-09-08)
1.0.36 (2014-09-01)
1.0.35 (2014-08-16)
1.0.34 (2014-08-14)
1.0.33 (2014-07-28)
1.0.32 (2014-07-26)
1.0.31 (2014-07-23)
1.0.30 (2014-07-15)
1.0.29 (2014-07-02)
1.0.28 (2014-06-24)
1.0.27 (2014-06-10)
1.0.26 (2014-05-30)
1.0.25 (2014-05-26)
1.0.24 (2014-05-24)
1.0.23 (2014-05-23)
1.0.22 (2014-05-22)
1.0.21 (2014-05-20)
1.0.20 (2014-05-09)
1.0.19 (2014-05-06)
1.0.18 (2014-05-04)
1.0.17 (2014-04-20)
1.0.16 (2014-04-19 23:29)
1.0.15 (2014-04-19 20:19)
1.0.14 (2014-04-19 12:52)
1.0.13 (2014-04-19 11:06)
1.0.12 (2014-04-18 16:58)
1.0.11 (2014-04-18 08:18)
1.0.10 (2014-04-17)
1.0.9 (2014-04-12)
1.0.8 (2014-04-11)
1.0.7 (2014-04-10)
1.0.6 (2014-04-07)
1.0.5 (2014-03-31)
1.0.4 (2014-03-29)
1.0.3 (2014-03-19)
1.0.2 (2014-03-12)
1.0.1 (2014-03-07)
1.0.0 (2014-03-05)
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
message_generation | |
std_msgs | |
actionlib_msgs | |
catkin_virtualenv | |
catkin | |
message_runtime | |
rospy | |
gdrive_ros | |
dialogflow_task_executive | |
rostest |
System Dependencies
Dependant Packages
Name | Deps |
---|---|
jsk_3rdparty | |
jsk_robot_startup |
Launch files
- launch/google_chat.launch
-
- receiving_mode [default: url] — Google Chat API settings. Choose from url, dialogflow, pubsub, none.
- gdrive_upload_service [default: /gdrive_ros/upload] — The ROS service name of gdrive_ros upload
- upload_data_timeout [default: 20]
- download_data [default: true]
- download_data_timeout [default: 10]
- download_directory [default: /tmp]
- download_avatar [default: false]
- google_cloud_credentials_json [default: ]
- use_yaml [default: false] — Whether you use yaml file or not.
- yaml_file [default: ] — Yaml file of web settings.
- respawn [default: true]
- host [default: localhost]
- port [default: 443]
- ssl_certfile [default: default]
- ssl_keyfile [default: default]
- project_id [default: default]
- subscription_id [default: default]
- use_helper [default: true]
- to_dialogflow_client [default: false]
- debug_sound [default: false]
Messages
- msg/FormAction.msg
- msg/KeyValue.msg
- msg/ActionParameter.msg
- msg/Attachment.msg
- msg/Section.msg
- msg/Button.msg
- msg/MessageEvent.msg
- msg/Message.msg
- msg/WidgetMarkup.msg
- msg/CardHeader.msg
- msg/Image.msg
- msg/User.msg
- msg/Space.msg
- msg/SpaceEvent.msg
- msg/CardAction.msg
- msg/OnClick.msg
- msg/Annotation.msg
- msg/CardEvent.msg
- msg/SlashCommand.msg
- msg/Card.msg
Services
Plugins
Recent questions tagged google_chat_ros at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 2.1.28 |
License | BSD |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2024-07-10 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Kei Okada
Authors
- Yoshiki Obinata
Google Chat ROS
The ROS wrapper for Google Chat API
- Installation Guide
- Sending the message
- Receiving the message
- Handling the event
- Optional functions
- Helper nodes
1. Installation Guide
1.1 Get the API KEY
At first, you should have the permission to access the Google Chat API.
See Google Official Document. Please ensure to get JSON credetial file and save it. DO NOT LOST IT!
For JSK members, all keys are available at Google Drive. If you make new API keys, please upload them here.
1.2 Select the way how to recieve Google Chat event
The way you recieve Google Chat event from API server depends on your system. If your system has static IP and is allowed to recieve https request with specific port, please see HTTPS mode. If not, please see Pub/Sub mode.
HTTPS mode
When you send the message, the node uses Google REST API. When you recieve the message, Google Chat API sends https request to your machine and the node handles it.
You have to prepare SSL certificate. Self-signed one is not available because of Google security issue. Please use the service like Let’s Encrypt. In Google Cloud console, please choose App URL
as connection settings and fill the URL in the App URL form.
Pub/Sub mode
When you send the message, the node uses Google REST API. When you recieve the message, the node uses Google Pub/Sub API’s subscription. The node has already established its connection to Google Pub/Sub API when you launch it.
The way how to set up in Google Cloud console shows below.
1. Authorize the existing Google Chat API project to access Google Cloud Pub/Sub service
In IAM settings in the console, please add the role Pub/Sub Admin
to service account.
2. Create Pub/Sub topic and subscriber
In Pub/Sub settings in the console, please add the topic and subscriptions.
In the figure, we set the topic name chat
, the subscription name chat-sub
as an example.
Note that if you set the topic name chat
, the full name of it becomes projects/<project_name>/topics/chat
. Please confirm the subsciptions subscribes the full name not short one.
3. Grant publish rigts on your topic
In order for Google Chat to publish messages to your topic, it must have publishing rights to the topic. To grant Google Chat these permissions, assign the Pub/Sub Publisher role to the following service account
chat-api-push@system.gserviceaccount.com
4. Set Google Chat API Connection settings
Please choose Cloud Pub/Sub
as connection settings and fill the full topic name in the Topic Name form.
1.3 Install/Build the ROS node
If you want to build from the source
source /opt/ros/${ROS_DISTRO}/setup.bash
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
git clone https://github.com/jsk-ros-pkg/jsk_3rdparty
rosdep install --ignore-src --from-paths . -y -r
cd ..
catkin build
1.4 Launch the node
HTTPS mode
You have to set rosparams receiving_mode=https
, google_cloud_credentials_json
, host
, port
, ssl_certfile
, ssl_keyfile
.
Pub/Sub mode
You have to set rosparams receiving_mode=pubsub
, google_cloud_credentials_json
, project_id
, subscription_id
. subscription_id
would be chat-sub
if you follow Pub/Sub mode example.
Example
roslaunch google_chat_ros google_chat.launch receiving_mode:=pubsub google_cloud_credentials_json:=/path/to/<project_id>-XXXXXXXX.json project_id:=<project_id> subscription_id:=chat-sub
2. Sending the message
2.1 Understanding Google Chat Room
When you see Google Chat UI with browsers or smartphone’s apps, you may see space
, thread
. If you send new message, you must specify the space or thread you want to send the message to. You can get the space name from chat room’s URL. If it is https://mail.google.com/chat/u/0/#chat/space/XXXXXXXXXXX
, XXXXXXXXXXX
becomes the space name.
2.2 Message format
There are 2 types of messages, text and card. The card basically follows the original json structure. As the node covers all the units in here with ros action msgs, it may be complicated for you if you want to use all of them. So in Examples sections, we’ll show you simple ones.
2.3 Sending the message by actionlib
All you have to do is send Actionlib goal to ~send/goal
.
2.4 Examples
Showing the message examples with rostopic pub -1
command on bash
.
Sending a text message
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Hello!'
space: 'spaces/<space name>'"
Sending a message with KeyValue card
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Something FATAL errors have happened in my computer, please fix ASAP'
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'Process ID'
content: '1234'
bottom_label: 'rospy'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'"
Sending an Interactive button
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
header:
title: 'What do you want to eat?'
subtitle: 'Please choose the food shop!'
sections:
-
widgets:
-
buttons:
-
text_button_name: 'STARBUCKS'
text_button_on_click:
action:
action_method_name: 'vote_starbucks'
parameters:
-
key: 'shop'
value: 'starbucks'
-
text_button_name: 'SUBWAY'
text_button_on_click:
action:
action_method_name: 'vote_subway'
parameters:
-
key: 'shop'
value: 'subway'
space: 'spaces/<space name>'"
Sending a message with an image
See Here.
3. Receiving the messages
3.1 ROS Topic
When the bot was mentioned, the node publishes ~message_activity
topic.
3.2 Examples
Receiving a text message
event_time: "2022-04-28T06:25:26.884623Z"
space:
name: "spaces/<space name>"
display_name: ''
room: False
dm: True
message:
name: "spaces/<space name>/messages/<message id>"
sender:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
create_time: "2022-04-28T06:25:26.884623Z"
text: "Hello!"
thread_name: "spaces/<space name>/threads/<thread name>"
annotations: []
argument_text: "Hello!"
attachments: []
user:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
Receiving a message with an image or gdrive file and download it
4. Handling the interactive event
If you’ve already sent the interactive card like Interactive card example, you can receive the activity of buttons. Suppose someone pressed the button STARBUCKS
, the node publishes a ~card_activity
topic like
event_time: "2022-05-02T00:23:47.855023Z"
space:
name: "spaces/<space name>"
display_name: "robotroom_with_thread"
room: True
dm: False
message:
name: "spaces/<space name>/messages/Go__sDfIdec.Go__sDfIdec"
sender:
name: "users/100406614699672138585"
display_name: "Fetch1075"
avatar_url: "https://lh4.googleusercontent.com/proxy/hWEAWt6fmHsFAzeiEoV5FMOx5-jmU3OnzQxCtrr9unyt73NNwv0lh7InFzOh-0yO3jOPgtColHBywnZnJvl4SVqqqrYkyT1uf18k_hDIVYrAv87AY7lM0hp5KtQ1m9br-aPFE98QwNnSTYc2LQ"
avatar: []
email: ''
bot: True
human: False
create_time: "2022-05-02T00:23:47.855023Z"
text: ''
thread_name: "spaces/<space name>/threads/Go__sDfIdec"
annotations: []
argument_text: ''
attachments: []
user:
name: "users/103866924487978823908"
display_name: "Yoshiki Obinata"
avatar_url: "https://lh3.googleusercontent.com/a-/AOh14GgexXiq8ImuKMgOq6QG-4geIzz5IC1-xa0Caead=k"
avatar: []
email: "<your email>"
bot: False
human: True
action:
action_method_name: "vote_starbucks"
parameters:
-
key: "shop"
value: "starbucks"
After the node which handles the chat event subscribed the topic, it can respond with text message like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'The shop accepted!'
content: 'You choose STARBUCKS!!'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'
thread_name: 'spaces/<space name>/threads/<thread name>'"
The important point is that the client node has to remember the thread_name
which the card event was occured at and send response to it.
5. Optional functions
5.1 Sending a message with an image
To send an image, you have to use card
type message. If you want to add the image uploaded to a storage server available for everyone, you just add its URI like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
image_url: 'https://media-cdn.tripadvisor.com/media/photo-s/11/fb/90/e4/dsc-7314-largejpg.jpg'
space: 'spaces/<your space>'"
If you want to attach image saved at your host, you have to launch (gdrive_ros)[https://github.com/jsk-ros-pkg/jsk_3rdparty/tree/master/gdrive_ros] at first and set ~gdrive_upload_service
param with gdrive_ros/Upload
service name. Then publish topic like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
localpath: '/home/user/Pictures/image.png'
space: 'spaces/<your space>'
5.2 Receiving a message with images or gdrive file
You have to set rosparam ~download_data
True, ~download_directory
. If the node recieved the message with image or google drive file, it automatically downloads to ~donwload_directory
path.
Troubleshoot
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
If you encounter 404 Resource not found (resource=chat-sub).
error on your screen as shown in below.
[INFO] [1680417167.337634]: [/google_chat_ros] Expected to use Google Cloud Pub Sub service
Traceback (most recent call last):
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 473, in <module>
node = GoogleChatROS()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 80,
in __init__
self._pubsub_client.run()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/src/google_chat_ros/google_chat.py", line 135, in run
self._streaming_pull_future.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
Please make sure that you have enabled subscription service, as a default it expires in 7 days. We recommend you to set no expiration date.
Changelog for package google_chat_ros
2.1.28 (2023-07-24)
2.1.27 (2023-06-24)
- fix package.xml/CMakeLists.txt to supress catkin_lint errors (#479)
- Contributors: Kei Okada
2.1.26 (2023-06-14)
- add LICENSE files (#476)
- Contributors: Kei Okada
2.1.25 (2023-06-08)
- google_chat_ros_node.py: display project_id, subscription_id (#459)
- add test to check if ros node is loadable,
(#463)
- install python files under CATKIN_PACKAGE_BIN_DESTINATION
- google_chat_ros/test_rospy_node.py: skip healper.py helper.py depends on dialogflow_task_executive. However, when we add this to the <depend> of package.xml, it appempts to build venv using 'dialogflow_task_executive/requirements.txt'. This requires having the same PYTHON_INTERPRETER for both dialogflow and chat ros package. The issue is that dialogflow_task_executive heavily relies on system Python modules, including ROS, making it difficult to use dialogflow with Python3 on Melodic
- add catkin_install_python for test, it is also change installed directory from BIN to SHARE, because we want to have same directory structure between devel and install
- add test to check if ros node is loadable If we use python2 PYTHON_INTERPRETER on 20.04, python2 fails to load rospy in /opt/ros/noetic, because rospy moduels are alraedy updated. If we use python3 PYTHON_INTERPRETER on 18.04, python3 can load rospy in /opt/ros/melodic by chance. c.f. https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/367
- google_chat_ros/README.md: add troubleshooting (#450)
- fix google_chat_ros noetic build errors (#422)
- use same timestamp for one goal
(#403)
- save google chat image in /chat_notification with timestamp
- add google_chat_ros (#392)
- Contributors: Aoi Nakane, Kei Okada, Naoto Tsukamoto, Shingo Kitagawa, Yoshiki Obinata
2.1.24 (2021-07-26)
2.1.23 (2021-07-21)
2.1.22 (2021-06-10)
2.1.21 (2020-08-19)
2.1.20 (2020-08-07)
2.1.19 (2020-07-21)
2.1.18 (2020-07-20)
2.1.17 (2020-04-16 21:51)
2.1.16 (2020-04-16 15:21)
2.1.15 (2019-12-12)
2.1.14 (2019-11-21)
2.1.13 (2019-07-10)
2.1.12 (2019-05-25)
2.1.11 (2018-08-29)
2.1.10 (2018-04-25)
2.1.9 (2018-04-24)
2.1.8 (2018-04-17)
2.1.7 (2018-04-09)
2.1.6 (2017-11-21)
2.1.5 (2017-11-20)
2.1.4 (2017-07-16)
2.1.3 (2017-07-07)
2.1.2 (2017-07-06)
2.1.1 (2017-07-05)
2.1.0 (2017-07-02)
2.0.20 (2017-05-09)
2.0.19 (2017-02-22)
2.0.18 (2016-10-28)
2.0.17 (2016-10-22)
2.0.16 (2016-10-17)
2.0.15 (2016-10-16)
2.0.14 (2016-03-20)
2.0.13 (2015-12-15)
2.0.12 (2015-11-26)
2.0.11 (2015-10-07 14:16)
2.0.10 (2015-10-07 12:47)
2.0.9 (2015-09-26)
2.0.8 (2015-09-15)
2.0.7 (2015-09-14)
2.0.6 (2015-09-08)
2.0.5 (2015-08-23)
2.0.4 (2015-08-18)
2.0.3 (2015-08-01)
2.0.2 (2015-06-29)
2.0.1 (2015-06-19 21:21)
2.0.0 (2015-06-19 10:41)
1.0.71 (2015-05-17)
1.0.70 (2015-05-08)
1.0.69 (2015-05-05 12:28)
1.0.68 (2015-05-05 09:49)
1.0.67 (2015-05-03)
1.0.66 (2015-04-03)
1.0.65 (2015-04-02)
1.0.64 (2015-03-29)
1.0.63 (2015-02-19)
1.0.62 (2015-02-17)
1.0.61 (2015-02-11)
1.0.60 (2015-02-03 10:12)
1.0.59 (2015-02-03 04:05)
1.0.58 (2015-01-07)
1.0.57 (2014-12-23)
1.0.56 (2014-12-17)
1.0.55 (2014-12-09)
1.0.54 (2014-11-15)
1.0.53 (2014-11-01)
1.0.52 (2014-10-23)
1.0.51 (2014-10-20 16:01)
1.0.50 (2014-10-20 01:50)
1.0.49 (2014-10-13)
1.0.48 (2014-10-12)
1.0.47 (2014-10-08)
1.0.46 (2014-10-03)
1.0.45 (2014-09-29)
1.0.44 (2014-09-26 09:17)
1.0.43 (2014-09-26 01:08)
1.0.42 (2014-09-25)
1.0.41 (2014-09-23)
1.0.40 (2014-09-19)
1.0.39 (2014-09-17)
1.0.38 (2014-09-13)
1.0.37 (2014-09-08)
1.0.36 (2014-09-01)
1.0.35 (2014-08-16)
1.0.34 (2014-08-14)
1.0.33 (2014-07-28)
1.0.32 (2014-07-26)
1.0.31 (2014-07-23)
1.0.30 (2014-07-15)
1.0.29 (2014-07-02)
1.0.28 (2014-06-24)
1.0.27 (2014-06-10)
1.0.26 (2014-05-30)
1.0.25 (2014-05-26)
1.0.24 (2014-05-24)
1.0.23 (2014-05-23)
1.0.22 (2014-05-22)
1.0.21 (2014-05-20)
1.0.20 (2014-05-09)
1.0.19 (2014-05-06)
1.0.18 (2014-05-04)
1.0.17 (2014-04-20)
1.0.16 (2014-04-19 23:29)
1.0.15 (2014-04-19 20:19)
1.0.14 (2014-04-19 12:52)
1.0.13 (2014-04-19 11:06)
1.0.12 (2014-04-18 16:58)
1.0.11 (2014-04-18 08:18)
1.0.10 (2014-04-17)
1.0.9 (2014-04-12)
1.0.8 (2014-04-11)
1.0.7 (2014-04-10)
1.0.6 (2014-04-07)
1.0.5 (2014-03-31)
1.0.4 (2014-03-29)
1.0.3 (2014-03-19)
1.0.2 (2014-03-12)
1.0.1 (2014-03-07)
1.0.0 (2014-03-05)
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
message_generation | |
std_msgs | |
actionlib_msgs | |
catkin_virtualenv | |
catkin | |
message_runtime | |
rospy | |
gdrive_ros | |
dialogflow_task_executive | |
rostest |
System Dependencies
Dependant Packages
Name | Deps |
---|---|
jsk_3rdparty |
Launch files
- launch/google_chat.launch
-
- receiving_mode [default: url] — Google Chat API settings. Choose from url, dialogflow, pubsub, none.
- gdrive_upload_service [default: /gdrive_ros/upload] — The ROS service name of gdrive_ros upload
- upload_data_timeout [default: 20]
- download_data [default: true]
- download_data_timeout [default: 10]
- download_directory [default: /tmp]
- download_avatar [default: false]
- google_cloud_credentials_json [default: ]
- use_yaml [default: false] — Whether you use yaml file or not.
- yaml_file [default: ] — Yaml file of web settings.
- respawn [default: true]
- host [default: localhost]
- port [default: 443]
- ssl_certfile [default: default]
- ssl_keyfile [default: default]
- project_id [default: default]
- subscription_id [default: default]
- use_helper [default: true]
- to_dialogflow_client [default: false]
- debug_sound [default: false]
Messages
- msg/FormAction.msg
- msg/KeyValue.msg
- msg/ActionParameter.msg
- msg/Attachment.msg
- msg/Section.msg
- msg/Button.msg
- msg/MessageEvent.msg
- msg/Message.msg
- msg/WidgetMarkup.msg
- msg/CardHeader.msg
- msg/Image.msg
- msg/User.msg
- msg/Space.msg
- msg/SpaceEvent.msg
- msg/CardAction.msg
- msg/OnClick.msg
- msg/Annotation.msg
- msg/CardEvent.msg
- msg/SlashCommand.msg
- msg/Card.msg
Services
Plugins
Recent questions tagged google_chat_ros at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 2.1.28 |
License | BSD |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2024-07-10 |
Dev Status | DEVELOPED |
CI status | Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Kei Okada
Authors
- Yoshiki Obinata
Google Chat ROS
The ROS wrapper for Google Chat API
- Installation Guide
- Sending the message
- Receiving the message
- Handling the event
- Optional functions
- Helper nodes
1. Installation Guide
1.1 Get the API KEY
At first, you should have the permission to access the Google Chat API.
See Google Official Document. Please ensure to get JSON credetial file and save it. DO NOT LOST IT!
For JSK members, all keys are available at Google Drive. If you make new API keys, please upload them here.
1.2 Select the way how to recieve Google Chat event
The way you recieve Google Chat event from API server depends on your system. If your system has static IP and is allowed to recieve https request with specific port, please see HTTPS mode. If not, please see Pub/Sub mode.
HTTPS mode
When you send the message, the node uses Google REST API. When you recieve the message, Google Chat API sends https request to your machine and the node handles it.
You have to prepare SSL certificate. Self-signed one is not available because of Google security issue. Please use the service like Let’s Encrypt. In Google Cloud console, please choose App URL
as connection settings and fill the URL in the App URL form.
Pub/Sub mode
When you send the message, the node uses Google REST API. When you recieve the message, the node uses Google Pub/Sub API’s subscription. The node has already established its connection to Google Pub/Sub API when you launch it.
The way how to set up in Google Cloud console shows below.
1. Authorize the existing Google Chat API project to access Google Cloud Pub/Sub service
In IAM settings in the console, please add the role Pub/Sub Admin
to service account.
2. Create Pub/Sub topic and subscriber
In Pub/Sub settings in the console, please add the topic and subscriptions.
In the figure, we set the topic name chat
, the subscription name chat-sub
as an example.
Note that if you set the topic name chat
, the full name of it becomes projects/<project_name>/topics/chat
. Please confirm the subsciptions subscribes the full name not short one.
3. Grant publish rigts on your topic
In order for Google Chat to publish messages to your topic, it must have publishing rights to the topic. To grant Google Chat these permissions, assign the Pub/Sub Publisher role to the following service account
chat-api-push@system.gserviceaccount.com
4. Set Google Chat API Connection settings
Please choose Cloud Pub/Sub
as connection settings and fill the full topic name in the Topic Name form.
1.3 Install/Build the ROS node
If you want to build from the source
source /opt/ros/${ROS_DISTRO}/setup.bash
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
git clone https://github.com/jsk-ros-pkg/jsk_3rdparty
rosdep install --ignore-src --from-paths . -y -r
cd ..
catkin build
1.4 Launch the node
HTTPS mode
You have to set rosparams receiving_mode=https
, google_cloud_credentials_json
, host
, port
, ssl_certfile
, ssl_keyfile
.
Pub/Sub mode
You have to set rosparams receiving_mode=pubsub
, google_cloud_credentials_json
, project_id
, subscription_id
. subscription_id
would be chat-sub
if you follow Pub/Sub mode example.
Example
roslaunch google_chat_ros google_chat.launch receiving_mode:=pubsub google_cloud_credentials_json:=/path/to/<project_id>-XXXXXXXX.json project_id:=<project_id> subscription_id:=chat-sub
2. Sending the message
2.1 Understanding Google Chat Room
When you see Google Chat UI with browsers or smartphone’s apps, you may see space
, thread
. If you send new message, you must specify the space or thread you want to send the message to. You can get the space name from chat room’s URL. If it is https://mail.google.com/chat/u/0/#chat/space/XXXXXXXXXXX
, XXXXXXXXXXX
becomes the space name.
2.2 Message format
There are 2 types of messages, text and card. The card basically follows the original json structure. As the node covers all the units in here with ros action msgs, it may be complicated for you if you want to use all of them. So in Examples sections, we’ll show you simple ones.
2.3 Sending the message by actionlib
All you have to do is send Actionlib goal to ~send/goal
.
2.4 Examples
Showing the message examples with rostopic pub -1
command on bash
.
Sending a text message
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Hello!'
space: 'spaces/<space name>'"
Sending a message with KeyValue card
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
text: 'Something FATAL errors have happened in my computer, please fix ASAP'
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'Process ID'
content: '1234'
bottom_label: 'rospy'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'"
Sending an Interactive button
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
header:
title: 'What do you want to eat?'
subtitle: 'Please choose the food shop!'
sections:
-
widgets:
-
buttons:
-
text_button_name: 'STARBUCKS'
text_button_on_click:
action:
action_method_name: 'vote_starbucks'
parameters:
-
key: 'shop'
value: 'starbucks'
-
text_button_name: 'SUBWAY'
text_button_on_click:
action:
action_method_name: 'vote_subway'
parameters:
-
key: 'shop'
value: 'subway'
space: 'spaces/<space name>'"
Sending a message with an image
See Here.
3. Receiving the messages
3.1 ROS Topic
When the bot was mentioned, the node publishes ~message_activity
topic.
3.2 Examples
Receiving a text message
event_time: "2022-04-28T06:25:26.884623Z"
space:
name: "spaces/<space name>"
display_name: ''
room: False
dm: True
message:
name: "spaces/<space name>/messages/<message id>"
sender:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
create_time: "2022-04-28T06:25:26.884623Z"
text: "Hello!"
thread_name: "spaces/<space name>/threads/<thread name>"
annotations: []
argument_text: "Hello!"
attachments: []
user:
name: "users/<user id>"
display_name: "Yoshiki Obinata"
avatar_url: "<avatar url>"
avatar: []
email: "<email>"
bot: False
human: True
Receiving a message with an image or gdrive file and download it
4. Handling the interactive event
If you’ve already sent the interactive card like Interactive card example, you can receive the activity of buttons. Suppose someone pressed the button STARBUCKS
, the node publishes a ~card_activity
topic like
event_time: "2022-05-02T00:23:47.855023Z"
space:
name: "spaces/<space name>"
display_name: "robotroom_with_thread"
room: True
dm: False
message:
name: "spaces/<space name>/messages/Go__sDfIdec.Go__sDfIdec"
sender:
name: "users/100406614699672138585"
display_name: "Fetch1075"
avatar_url: "https://lh4.googleusercontent.com/proxy/hWEAWt6fmHsFAzeiEoV5FMOx5-jmU3OnzQxCtrr9unyt73NNwv0lh7InFzOh-0yO3jOPgtColHBywnZnJvl4SVqqqrYkyT1uf18k_hDIVYrAv87AY7lM0hp5KtQ1m9br-aPFE98QwNnSTYc2LQ"
avatar: []
email: ''
bot: True
human: False
create_time: "2022-05-02T00:23:47.855023Z"
text: ''
thread_name: "spaces/<space name>/threads/Go__sDfIdec"
annotations: []
argument_text: ''
attachments: []
user:
name: "users/103866924487978823908"
display_name: "Yoshiki Obinata"
avatar_url: "https://lh3.googleusercontent.com/a-/AOh14GgexXiq8ImuKMgOq6QG-4geIzz5IC1-xa0Caead=k"
avatar: []
email: "<your email>"
bot: False
human: True
action:
action_method_name: "vote_starbucks"
parameters:
-
key: "shop"
value: "starbucks"
After the node which handles the chat event subscribed the topic, it can respond with text message like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
key_value:
top_label: 'The shop accepted!'
content: 'You choose STARBUCKS!!'
icon: 'DESCRIPTION'
space: 'spaces/<space name>'
thread_name: 'spaces/<space name>/threads/<thread name>'"
The important point is that the client node has to remember the thread_name
which the card event was occured at and send response to it.
5. Optional functions
5.1 Sending a message with an image
To send an image, you have to use card
type message. If you want to add the image uploaded to a storage server available for everyone, you just add its URI like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
image_url: 'https://media-cdn.tripadvisor.com/media/photo-s/11/fb/90/e4/dsc-7314-largejpg.jpg'
space: 'spaces/<your space>'"
If you want to attach image saved at your host, you have to launch (gdrive_ros)[https://github.com/jsk-ros-pkg/jsk_3rdparty/tree/master/gdrive_ros] at first and set ~gdrive_upload_service
param with gdrive_ros/Upload
service name. Then publish topic like
rostopic pub -1 /google_chat_ros/send/goal google_chat_ros/SendMessageActionGoal "goal:
cards:
-
sections:
-
widgets:
-
image:
localpath: '/home/user/Pictures/image.png'
space: 'spaces/<your space>'
5.2 Receiving a message with images or gdrive file
You have to set rosparam ~download_data
True, ~download_directory
. If the node recieved the message with image or google drive file, it automatically downloads to ~donwload_directory
path.
Troubleshoot
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
If you encounter 404 Resource not found (resource=chat-sub).
error on your screen as shown in below.
[INFO] [1680417167.337634]: [/google_chat_ros] Expected to use Google Cloud Pub Sub service
Traceback (most recent call last):
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 473, in <module>
node = GoogleChatROS()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/scripts/google_chat_ros_node.py", line 80,
in __init__
self._pubsub_client.run()
File "/home/k-okada/catkin_ws/ws_3rdparty/src/jsk_3rdparty/google_chat_ros/src/google_chat_ros/google_chat.py", line 135, in run
self._streaming_pull_future.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
google.api_core.exceptions.NotFound: 404 Resource not found (resource=chat-sub).
Please make sure that you have enabled subscription service, as a default it expires in 7 days. We recommend you to set no expiration date.
Changelog for package google_chat_ros
2.1.28 (2023-07-24)
2.1.27 (2023-06-24)
- fix package.xml/CMakeLists.txt to supress catkin_lint errors (#479)
- Contributors: Kei Okada
2.1.26 (2023-06-14)
- add LICENSE files (#476)
- Contributors: Kei Okada
2.1.25 (2023-06-08)
- google_chat_ros_node.py: display project_id, subscription_id (#459)
- add test to check if ros node is loadable,
(#463)
- install python files under CATKIN_PACKAGE_BIN_DESTINATION
- google_chat_ros/test_rospy_node.py: skip healper.py helper.py depends on dialogflow_task_executive. However, when we add this to the <depend> of package.xml, it appempts to build venv using 'dialogflow_task_executive/requirements.txt'. This requires having the same PYTHON_INTERPRETER for both dialogflow and chat ros package. The issue is that dialogflow_task_executive heavily relies on system Python modules, including ROS, making it difficult to use dialogflow with Python3 on Melodic
- add catkin_install_python for test, it is also change installed directory from BIN to SHARE, because we want to have same directory structure between devel and install
- add test to check if ros node is loadable If we use python2 PYTHON_INTERPRETER on 20.04, python2 fails to load rospy in /opt/ros/noetic, because rospy moduels are alraedy updated. If we use python3 PYTHON_INTERPRETER on 18.04, python3 can load rospy in /opt/ros/melodic by chance. c.f. https://github.com/jsk-ros-pkg/jsk_3rdparty/pull/367
- google_chat_ros/README.md: add troubleshooting (#450)
- fix google_chat_ros noetic build errors (#422)
- use same timestamp for one goal
(#403)
- save google chat image in /chat_notification with timestamp
- add google_chat_ros (#392)
- Contributors: Aoi Nakane, Kei Okada, Naoto Tsukamoto, Shingo Kitagawa, Yoshiki Obinata
2.1.24 (2021-07-26)
2.1.23 (2021-07-21)
2.1.22 (2021-06-10)
2.1.21 (2020-08-19)
2.1.20 (2020-08-07)
2.1.19 (2020-07-21)
2.1.18 (2020-07-20)
2.1.17 (2020-04-16 21:51)
2.1.16 (2020-04-16 15:21)
2.1.15 (2019-12-12)
2.1.14 (2019-11-21)
2.1.13 (2019-07-10)
2.1.12 (2019-05-25)
2.1.11 (2018-08-29)
2.1.10 (2018-04-25)
2.1.9 (2018-04-24)
2.1.8 (2018-04-17)
2.1.7 (2018-04-09)
2.1.6 (2017-11-21)
2.1.5 (2017-11-20)
2.1.4 (2017-07-16)
2.1.3 (2017-07-07)
2.1.2 (2017-07-06)
2.1.1 (2017-07-05)
2.1.0 (2017-07-02)
2.0.20 (2017-05-09)
2.0.19 (2017-02-22)
2.0.18 (2016-10-28)
2.0.17 (2016-10-22)
2.0.16 (2016-10-17)
2.0.15 (2016-10-16)
2.0.14 (2016-03-20)
2.0.13 (2015-12-15)
2.0.12 (2015-11-26)
2.0.11 (2015-10-07 14:16)
2.0.10 (2015-10-07 12:47)
2.0.9 (2015-09-26)
2.0.8 (2015-09-15)
2.0.7 (2015-09-14)
2.0.6 (2015-09-08)
2.0.5 (2015-08-23)
2.0.4 (2015-08-18)
2.0.3 (2015-08-01)
2.0.2 (2015-06-29)
2.0.1 (2015-06-19 21:21)
2.0.0 (2015-06-19 10:41)
1.0.71 (2015-05-17)
1.0.70 (2015-05-08)
1.0.69 (2015-05-05 12:28)
1.0.68 (2015-05-05 09:49)
1.0.67 (2015-05-03)
1.0.66 (2015-04-03)
1.0.65 (2015-04-02)
1.0.64 (2015-03-29)
1.0.63 (2015-02-19)
1.0.62 (2015-02-17)
1.0.61 (2015-02-11)
1.0.60 (2015-02-03 10:12)
1.0.59 (2015-02-03 04:05)
1.0.58 (2015-01-07)
1.0.57 (2014-12-23)
1.0.56 (2014-12-17)
1.0.55 (2014-12-09)
1.0.54 (2014-11-15)
1.0.53 (2014-11-01)
1.0.52 (2014-10-23)
1.0.51 (2014-10-20 16:01)
1.0.50 (2014-10-20 01:50)
1.0.49 (2014-10-13)
1.0.48 (2014-10-12)
1.0.47 (2014-10-08)
1.0.46 (2014-10-03)
1.0.45 (2014-09-29)
1.0.44 (2014-09-26 09:17)
1.0.43 (2014-09-26 01:08)
1.0.42 (2014-09-25)
1.0.41 (2014-09-23)
1.0.40 (2014-09-19)
1.0.39 (2014-09-17)
1.0.38 (2014-09-13)
1.0.37 (2014-09-08)
1.0.36 (2014-09-01)
1.0.35 (2014-08-16)
1.0.34 (2014-08-14)
1.0.33 (2014-07-28)
1.0.32 (2014-07-26)
1.0.31 (2014-07-23)
1.0.30 (2014-07-15)
1.0.29 (2014-07-02)
1.0.28 (2014-06-24)
1.0.27 (2014-06-10)
1.0.26 (2014-05-30)
1.0.25 (2014-05-26)
1.0.24 (2014-05-24)
1.0.23 (2014-05-23)
1.0.22 (2014-05-22)
1.0.21 (2014-05-20)
1.0.20 (2014-05-09)
1.0.19 (2014-05-06)
1.0.18 (2014-05-04)
1.0.17 (2014-04-20)
1.0.16 (2014-04-19 23:29)
1.0.15 (2014-04-19 20:19)
1.0.14 (2014-04-19 12:52)
1.0.13 (2014-04-19 11:06)
1.0.12 (2014-04-18 16:58)
1.0.11 (2014-04-18 08:18)
1.0.10 (2014-04-17)
1.0.9 (2014-04-12)
1.0.8 (2014-04-11)
1.0.7 (2014-04-10)
1.0.6 (2014-04-07)
1.0.5 (2014-03-31)
1.0.4 (2014-03-29)
1.0.3 (2014-03-19)
1.0.2 (2014-03-12)
1.0.1 (2014-03-07)
1.0.0 (2014-03-05)
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
message_generation | |
std_msgs | |
actionlib_msgs | |
catkin_virtualenv | |
catkin | |
message_runtime | |
rospy | |
gdrive_ros | |
dialogflow_task_executive | |
rostest |
System Dependencies
Dependant Packages
Name | Deps |
---|---|
jsk_3rdparty |
Launch files
- launch/google_chat.launch
-
- receiving_mode [default: url] — Google Chat API settings. Choose from url, dialogflow, pubsub, none.
- gdrive_upload_service [default: /gdrive_ros/upload] — The ROS service name of gdrive_ros upload
- upload_data_timeout [default: 20]
- download_data [default: true]
- download_data_timeout [default: 10]
- download_directory [default: /tmp]
- download_avatar [default: false]
- google_cloud_credentials_json [default: ]
- use_yaml [default: false] — Whether you use yaml file or not.
- yaml_file [default: ] — Yaml file of web settings.
- respawn [default: true]
- host [default: localhost]
- port [default: 443]
- ssl_certfile [default: default]
- ssl_keyfile [default: default]
- project_id [default: default]
- subscription_id [default: default]
- use_helper [default: true]
- to_dialogflow_client [default: false]
- debug_sound [default: false]
Messages
- msg/FormAction.msg
- msg/KeyValue.msg
- msg/ActionParameter.msg
- msg/Attachment.msg
- msg/Section.msg
- msg/Button.msg
- msg/MessageEvent.msg
- msg/Message.msg
- msg/WidgetMarkup.msg
- msg/CardHeader.msg
- msg/Image.msg
- msg/User.msg
- msg/Space.msg
- msg/SpaceEvent.msg
- msg/CardAction.msg
- msg/OnClick.msg
- msg/Annotation.msg
- msg/CardEvent.msg
- msg/SlashCommand.msg
- msg/Card.msg