# Check Gmail via API

**URL:** <https://discourse.nodered.org/t/check-gmail-via-api/72800>\
**Category:** General\
**Created:** [28 December 2022 05:51 UTC](https://discourse.nodered.org/t/check-gmail-via-api/72800 "2022-12-28T05:51:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yedd](https://avatars.discourse-cdn.com/v4/letter/y/a6a055/32.png) [@yedd](https://discourse.nodered.org/u/yedd)\
**Post date:** [28 December 2022 05:51 UTC](https://discourse.nodered.org/t/check-gmail-via-api/72800/1 "2022-12-28T05:51:27Z")

</div>

Hey, all.  
I'm working on a flow to check my inbox for new emails from certain domains and notify based on that. I tried the Email node, but it hangs on fetching by IMAP since my inbox has a LOT of messages. I figured using the native Google API would give better control. I found the node @martip/node-red-google-apis, which seems to be working much better, but I am having a hard time figuring out how to pass the userId information to the node. I'm a Node Red noob, but work in IT and am fairly savvy. I'm pretty sure I'm missing something simple here.

```auto
[
    {
        "id": "0edb0f715a371ae1",
        "type": "tab",
        "label": "Mail check test",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "5cb654ae71cca214",
        "type": "debug",
        "z": "0edb0f715a371ae1",
        "name": "debug 11",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 680,
        "y": 400,
        "wires": []
    },
    {
        "id": "8b1ba8f87915ae5f",
        "type": "google-apis",
        "z": "0edb0f715a371ae1",
        "name": "List Messages",
        "authentication": "1234123412341234",
        "api": "gmail:v1",
        "method": "users.messages.list",
        "x": 520,
        "y": 400,
        "wires": [
            [
                "5cb654ae71cca214"
            ]
        ]
    },
    {
        "id": "95b8e6687aed3618",
        "type": "inject",
        "z": "0edb0f715a371ae1",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"userId\":\"xxx@xxx.com\"}",
        "payloadType": "json",
        "x": 370,
        "y": 400,
        "wires": [
            [
                "8b1ba8f87915ae5f"
            ]
        ]
    },
    {
        "id": "49622f9b8567887e",
        "type": "google-apis-authentication",
        "name": "Google APIs Authentication",
        "key": "{\n \"type\": \"service_account\",\n \"project_id\": \"nodered-ad-notify\",\n \"private_key_id\": \"1234123412341234123412341234123412341234\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nasdfasdfasdfasdfasdfasdfasdfasdf==\\n-----END PRIVATE KEY-----\\n\",\n \"client_email\": \"nrad-asdf-asdf@nodered-asdf-asdf.iam.gserviceaccount.com\",\n \"client_id\": \"123412341234123412341\",\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/nrad-asdf-asdf%40nodered-asdf-asdf.iam.gserviceaccount.com\"\n}\n",
        "scopes": "https://mail.google.com/"
    }
]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 February 2023 05:51 UTC](https://discourse.nodered.org/t/check-gmail-via-api/72800/2 "2023-02-26T05:51:45Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
