Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install @googleapis/workspaceevents with npm #3440

Open
marytal opened this issue Feb 23, 2024 · 2 comments
Open

Can't install @googleapis/workspaceevents with npm #3440

marytal opened this issue Feb 23, 2024 · 2 comments
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@marytal
Copy link

marytal commented Feb 23, 2024

Hey! I'm trying to install npm install @googleapis/workspaceevents as instructed in the README, but I'm getting a 404 error.

Wondering if you have any plans to publish this submodule! :)

Cheers!

@marytal marytal added priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue. labels Feb 23, 2024
@combi-35
Copy link

+1 on this.
I dont even see workspaceevents in googleapis.
Wondering how I can use workspaceevents with this client.
Getting redirected to this client from the offical google docs.

@marytal
Copy link
Author

marytal commented Mar 13, 2024

For anyone else who finds this and is trying to use the workspace events APIs with a service account, hopefully this helps while this client library is not yet available:

Note that you can only subscribe to meetings that were created with the Google Meets REST API.

Also, if you are subscribing to a user resource, make sure your userToImpersonate is the same user that you are subscribing to. You can find the user's ID here.

const createSubscription = async () => {
  try {
    const userToImpersonate = "test@email.com"

    const client = new JWT({
      email: process.env.GOOGLE_AUTH_SERVICE_ACCOUNT,
      key: process.env.GOOGLE_AUTH_PRIVATE_KEY,
      scopes: [
        "https://www.googleapis.com/auth/meetings.space.readonly",
        "https://www.googleapis.com/auth/meetings.space.created",
      ],
      subject: userToImpersonate,
    });

    const body = {
      targetResource:
        "//meet.googleapis.com/spaces/snjnKuejBYUB",
      eventTypes: [
        "google.workspace.meet.conference.v2.started",
        "google.workspace.meet.conference.v2.ended",
        "google.workspace.meet.participant.v2.joined",
        "google.workspace.meet.participant.v2.left",
      ],
      payloadOptions: {
        includeResource: false,
      },
      notificationEndpoint: {
        pubsubTopic:
          "projects/tutored-by-teachers/topics/topic-name",
      },
    };

    const url = `https://workspaceevents.googleapis.com/v1/subscriptions`;

    const res = await client.request({
      method: "POST",
      url,
      body: JSON.stringify(body),
    });

    console.log(res.data);
  } catch (error) {
    console.log(error)
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants