Search code examples
javascriptnode.jsgmailgmail-apisignature

How i can get my signatures from my gmail account? NodeJS


Someone can helm me? I need to get(fetch) signature from my gmail in node js,how signature looks like in gmail. Maybe u know some libs or something else


Solution

  • I believe your goal is as follows.

    • You want to retrieve the signature of Gmail as follows. The image is from your question.

    • You want to achieve this using googleapis for Node.js.

    In this case, how about the following sample script?

    Sample script 1:

    Please use auth in your script. This sample script uses the method of users.settings.sendAs.list.

    const gmail = google.gmail({ version: "v1", auth });
    const res1 = await gmail.users.settings.sendAs.list({ userId: "me" }).catch((err) => console.log(err));
    if (!res1) return;
    console.log(res1.data);
    

    Sample script 2:

    Please use auth in your script. This sample script uses the method of users.settings.sendAs.get .

    const gmail = google.gmail({ version: "v1", auth });
    const res2 = await gmail.users.settings.sendAs.get({ userId: "me", sendAsEmail: "### your Email address ###" }).catch((err) => console.log(err));
    if (!res2) return;
    console.log(res2.data);
    

    Note:

    • This answer supposes that you have already been able to get values from Gmail using Gmail API. Please be careful about this.

    References: