Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/b-lawlor/renewal-notifications
Google Apps Script project that uses Sierra API to send patrons notification e-mails
https://github.com/b-lawlor/renewal-notifications
apps-script google-apps-script sierra-api
Last synced: about 2 months ago
JSON representation
Google Apps Script project that uses Sierra API to send patrons notification e-mails
- Host: GitHub
- URL: https://github.com/b-lawlor/renewal-notifications
- Owner: b-lawlor
- License: mit
- Created: 2020-01-13T19:02:24.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-13T21:20:46.000Z (almost 5 years ago)
- Last Synced: 2023-11-07T02:03:01.111Z (about 1 year ago)
- Topics: apps-script, google-apps-script, sierra-api
- Language: JavaScript
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Google Apps Script project that uses Sierra API to send patrons notification e-mails. Created by Brendan Lawlor for test purposes only. Use at your own risk. Not supported by CLAMS.
# Quickstart
## Install Node.js
https://nodejs.org/en/download/## Install clasp
```
npm install @google/clasp -g
```## Enable the Google Apps Script API
https://script.google.com/home/usersettings## Clone this Repo
```
git clone https://github.com/b-lawlor/Renewal-Notifications
```## Create a New Apps Script Project
```
cd Renewal-Notifications
clasp login
clasp create --title "Renewal Notifications"
```
**choose standalone**
```
clasp push
clasp open
```## Edit Apps Script Code
In auth.gs:
```
getToken_()
var key = "YOUR SIERRA API KEY";
var secret = "YOUR SUPER SECRET API SECRET";
var getTokenUrl = "https://LIBRARY.DOMAIN/iii/sierra-api/v5/token";
```In main.gs:
```
main()
// set limit field to a low number for testing
var url = "https://LIBRARY.DOMAIN/iii/sierra-api/v5/patrons/query?offset=0&limit=3";sendNotifications()
var supportEmail = "[email protected]"
var testEmail = "[email protected]"
// uncomment to send emails to patrons
//GmailApp.sendEmail(patron.emails[0], subject, body, options);getLocations()
var loc = apiGet(token, "https://LIBRARY.DOMAIN/iii/sierra-api/v5/branches/pickupLocations");
```In emailBody.gs:
```
getPlainBody()
var body = "notification plain text"
getHtmlBody()
var body = "notification with html markup"
```## Authorize the Script
1. Run-> Run function -> main
2. Click Allow## Add a Trigger
1. Edit-> Current project's triggers
2. "+" Add Trigger
3. Choose which function to run: **main**
4. Choose which deployment to run: **Head**
5. Select event source: **Time-driven**
6. Select type of time based trigger: **Day timer**
7. Select time of day: **9am to 10am**