Coder Social home page Coder Social logo

hashkanna / cloud-functions-gmail-nodejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/cloud-functions-gmail-nodejs

0.0 1.0 0.0 84 KB

A demo app that processes Gmail messages with Cloud Functions

Home Page: https://cloud.google.com

License: Apache License 2.0

JavaScript 100.00%

cloud-functions-gmail-nodejs's Introduction

Gmail + GCF intelligence demo

This repository demonstrates how to write custom mail processing logic for Gmail using the Gmail API and Cloud Functions. See the blog post for more information.

Obtaining an OAuth 2.0 Client ID

In order for an OAuth 2.0 API to verify our program's identity, we must include an OAuth 2.0 client ID with some of our requests to the API. The following steps show how to enable the Gmail API and download the client ID to your local machine.

  1. Enable the Gmail API using the the Gmail API page in the GCP Console.

  2. Find the GCP region you want to deploy your function to. (In general, response time is quickest for the regions closest to you.) For the rest of this tutorial, replace [YOUR_GCF_REGION] with your selected region's name (for example, us-central1).

  3. Generate a new OAuth 2.0 client ID by visiting the GCP Console credentials page. Configure the fields as indicated below:

    • Application type: Web application
    • Name: an appropriate, memorable name for your client
    • Authorized JavaScript origins: https://[YOUR_GCF_REGION]-[YOUR_GCP_PROJECT_ID].cloudfunctions.net/oauth2callback
  4. Click Create, then close the resulting dialog box and click the Download icon next to your newly created client ID. The resulting file is your Client Secret file.

Configuring local files

  1. Rename your Client Secret file to client_secret.json, and move it to the directory that contains your index.js and package.json files.
  2. In config.json, update the values for GCF_REGION, GCLOUD_PROJECT, and TOPIC_ID.

cloud-functions-gmail-nodejs's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.