Coder Social home page Coder Social logo

scriptburn / apps-script-gmail-push-notifications-v2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spencer-easton/apps-script-gmail-push-notifications-v2

0.0 1.0 0.0 4 KB

An updated version of Gmail Push Notifications in Apps Script

JavaScript 100.00%

apps-script-gmail-push-notifications-v2's Introduction

Apps-Script-Gmail-Push-Notifications-v2

An updated version of Gmail Push Notifications in Apps Script

This sample project shows how to setup your Apps Script project to register a Gmail account for push notifications and how to programmatically set up the the proper pubsub publishing channels and subscriptions.

###Setup

  1. Create a new Apps Script project using the two .gs files in this repo.
  2. Add the following libraries:
        PubSubApp - 1BX8k4tkiA3CZGIZ0hHccfiF7o-EvjqLCt3hoU3osDQBhnGlQTRnawOGE
        GSApp - 1wkfv_Mm0IyruEZyPZsrctcSmc1T9y0-bArl2gIzMd6RVYJAwWeJ5gpDu
  3. Publish the project as a web app
  4. Register the web app in the Chrome web store leaving it in draft mode. This will verifiy ownership of the script.
  5. Run the script from the cuurrent web app URL. (the /exec one). You will get an error about no doGet(). Copy the URL it redirected you toward.
  6. Add the URL to the WEBHOOK_URL var in main.gs
  7. Open up the project developers console:
        a) Under Credentials -> Domain Verification: Add the url you copied in WEBHOOK_URL in step 6 ommiting the exec from the end
        b) Create a new service account. Download the credentials as json.
        c) Under Overview: Enable the PubSub API and the Gmail API
        d) Copy the json credentials and paste it into script properties under the key jsonKey.
  8. Copy the developers console project Id to PROJECTID var in main.gs
  9. Create a spreadsheet. Create a sheet called Log. Copy the file Id and paste it in SpreadsheetApp.openById() of doPost().
  10. Update the webapp version to pick up changes made to the project.

###Running the sample code

  1. Run setupPubSub()
  2. Run enrollEmail() to start listening to your Gmail notifications. They will be logged to the spreadsheet set up in step 9.
  3. Run disEnrollEmail() to stop listening to your Gmail notifications.

apps-script-gmail-push-notifications-v2's People

Contributors

spencer-easton avatar

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.