create space/room and send message via google-api in node.js

737 views Asked by At

Case: Google Chat support in node.js using the googleapis library.

I studied the documentation, created a service account and implemented authentication. In first step I used the chat.spaces.list() method and it worked (no error returned).

I want to send a message via chat, so I wanted to create a new space, I found the chat.spaces.create method (https://developers.google.com/chat/api/reference/rest/v1/spaces/create) Unfortunately, this method is not present in "googleapis" for node.js In general, I see that the list of methods in "googleapis" is different than the one in the documentation. Only spaces in the documentation, but spaces and rooms in the library... I'm lost. How to do it? Any tips?

1

There are 1 answers

2
Muhammad Dyas Yaskur On

I see that the list of methods in "googleapis" is different than the one in the documentation

I think you are seeing wrong documentation. Your reference link is REST API documentation. The nodejs googleapis client documentation you can see on https://googleapis.dev/nodejs/googleapis/latest/chat/classes/Resource$Spaces.html.

And also based on the REST API documentation, the API that you looking for(create space) is not general available.

† Supports user authentication in Developer Preview. App authentication isn't available.

You need to join Google Workspace Developer Preview Program to access that feature.