Skip to content

Invalid topicName on Gmail watch() method #1301

@willsnake

Description

@willsnake

Hi!
I'm using the latest version of googleapis and I think the function watch() for the gmail api is not working properly.
I have created a topic on my project, as shown in the image below.

captura de pantalla 2018-08-20 a la s 13 44 03

Once I have the name of the topic, I try to call the watch function of the gmail api as shown on the README here

The code that I'm trying is here:

subscribeAccount: async () => {
      try {
        // Connect to gmail API
        const gmail = await google.gmail({
          version: 'v1',
          auth: oauth2Client,
        });

        const result = await gmail.users.watch({
          userId: 'me',
          requestBody: {
            topicName: `projects/metal-figure-210815/topics/gmail`,
          },
        });
        console.log('subscribeAccount result', result);
        return null;
      } catch (e) {
        console.error('subscribeAccount error', e);
        return null;
      }
    },

So far I've only get an error:

{ Error: Invalid topicName does not match projects/robotic-idiom-205921/topics/*
...}

I checked the issues closed on the github for the googleapis and I found this one:

Gmail API: users.watch - topicName required

I've tried everything on that issue, but it still not wotking.
Also I've searched on the stackoverflow section for issues, here but I can't seem to find any help anywhere.

That's why I decided to create a new issues, cause I'm lost, I don't know what to do.
Could you help me?

Thanks!

Metadata

Metadata

Assignees

Labels

type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions