Parse Pollen Alert emails from NAAF (The Norwegian Asthma and Allergy Association) and add the alert to the Google Calendar.
The project uses Google Apps Script together with the Gmail and the Google Calendar services.
- Reads emails with a specific label
- Adds the extracted from the latest email to a calendar with a specific name
- Go to http://www.pollenvarslingen.no/
- Click on the Motta gratis varsel på e-post link
- Login (Endre instillinger) or create new account (Ny bruker)
- Once logged in click in the Rediger (Edit) button
- Check the Motta varsling på e-post: check box to get alerts by email.
- Check all areas (områder) you want alerts for
- Check all Pollen types (Pollentyper) you want alerts for
- Click the Lagre (Save) button to save the changes
- Go to https://mail.google.com/ after the first email from NAAF has been received,
- Check the checkbox next to the email from NAAF that has the subject like Pollenvarsling for*...
- Click on More and select Filter messages like these
- Leave the From field as is
- With the Subject field enter Pollenvarsling for
- Click on the Create filter with this search link
- Check the Apply the label check box
- Then select the Pollenvarsling label (or create it if not already exists)
- As the last step click the Create filter button
- Go to https://calendar.google.com
- Create a new calendar with the exact name Pollenvarsling
The first time you want to create a script from Drive, follow these steps:
- Open Google Drive (https://drive.google.com).
- Click Create.
- Click Connect more apps.
- When the "Connect apps to Drive" window appears, type "script" into the search box and press the Enter key.
- Click Connect next to the listing for Google Apps Script.
- Click OK in the confirmation window.
Now that you've connected the app, you can create a script by following just these steps:
- Open Google Drive (https://drive.google.com).
- Click Create.
- Select Script.
- Select File > Save.
- Enter the name of your project (like Pollenvarsling) and click OK to save it.
- Copy the contents of
Code.gs.js
to the editor - Select the menu item Run > myFunction once to run the function and to initialize the authentication flow to allow the script to access the Gmail and the Google Calendar.
- From the script editor, choose Resources > Current project's triggers.
- Click the link that says: No triggers set up. Click here to add one now.
- Under Run, select the
myFunction
to set up a trigger for it. - Under Events, select Time-driven.
- Select and configure the type of trigger you want to create (for example, an
Hour timer that runs Every hour).
- Make sure that the trigger also runs after the time the alert email usually is received to the Gmail inbox (for example checking every 4 hour may be enough).
- Optionally, click Notifications to configure how and when you will be contacted by email if your triggered function fails.
- Click Save.