Requires Chrome.
- Request access to the flomio/passninja-guestlist-gas Github repository from your passninja contact.
- If you don't have it already, install the Google Apps Scripts GitHub Assistant in chrome.
- Navigate to Google App Scripts
- Now click the + New Project button on the top left of your screen.
- Once the script editor opens click Ctrl+S or Cmd+S to save and name your project.
- Then right click on the file called
Code.gs
and rename it (a collision occurs on GitHub pull without renaming the file). - Log in to GitHub clicking the login SCM button and entering your GitHub Credentials. You may have to generate a GitHub token by following these instructions:
- On any GitHub page, click your profile icon and then click Settings.
- On the sidebar, click Personal access tokens.
- Click Generate new token.
- Add a token description and click Generate token.
- Copy the token to a secure location or password management app. For security reasons, after you leave the page, you can no longer see the token again.
- Enter the token into the github login window back at the Scripts page.
- Now that you are logged in, click the dropdown button that says Repository and select
flomio/passninja-guestlist-gas
from the list (if its not there, ask your passninja rep to double check that was shared, and ensure that you have accepted the invitiation that comes to you in an email from GitHub). - IMPORTANT - on the gear icon next to your repository and branch settings sclick and check the "Manage manifest file"
- Now click the down arrow to the right of the Repository and Branch buttons to bring the code into your editor. Note: Sometimes the extension will pull the files properly but report an error and you will see no changes. In that case please refresh the page (ctrl + f5 if you want to be sure) and the files should appear on the left. Just to be sure press the pull button once more and you should receive an "Everything already up-to-date" notification.
- INSTALLATION
Menu->PassNinja->Create Default Sheet(s)->Create Config Sheet
This will build the Config sheet where you have to enter passType and at least one field to generate the rest of the sheets. I usedgas.coupondemo
and fieldsfullName
,phoneNumber
,email
,discount
and toggledfullName
anddiscount
to Included in Pass? = "Y".Menu->PassNinja->Create Default Sheet(s)->Create/Update Sheets From Config
This will build the Sheets:Form Responses #
,Events
,Contacts
and the connected Form (Menu -> Form -> Edit Form
can help you verify that the form is correct and matches the fields you entered in theConfig
sheet.)
- Check with
Menu -> Form -> Go to Live Form
- Enter all the required field information (I made sure all "In Pass?: Y" fields are set as required)
- When it is submitted it will appear on the
Form Responses
sheet and also a new contact will be added to theContacts
sheet. - This contact will ALSO have an automatically generated pass, so if you sit tight a couple seconds it will appear.
- Once you deploy the Script in the
Script Editor
usingPublish -> Deploy as Web App
and create a new version you should copy the resulting url. - You can enter this Google Sheets API URL as the cognito user callback url (more information once I talk with @blairexico about this) and it should post the event stream for that pass type to the Events sheet. See similar instructions here: https://github.com/flomio/passninja-api/pull/238
- Now you can feel free to manually do POST or GET requests at that url. A GET request, if you add
?serialNumber=<YOUR SERIAL HERE>
will return the matching sheet entry that has that serial number in the Contacts sheetserialNumber
column. The GET request I've been using looks like:
curl --location --request GET 'https://script.google.com/macros/s/AKfycby9as7cTqifeqxU8o5_Hl4Rdy4t7vLLjVw_ZCYvqMsqI3Df8l3I/exec?serialNumber=random'
- The POST request that I've been sending resembles this:
curl --location --request POST 'https://script.google.com/macros/s/AKfycby9as7cTqifeqxU8o5_Hl4Rdy4t7vLLjVw_ZCYvqMsqI3Df8l3I/exec' \
--header 'Content-Type: application/json' \
--data-raw '{
"callback": "https://script.google.com/macros/s/asdf/dev",
"date": "2020-02-08T15:15:13.341Z",
"event": {
"passJson":
"{\"formatVersion\":1,\"description\":\"Pass Entry for Employee Number 232\",\"passTypeIdentifier\":\"pass.com.passninja.passentry.demo\",\"organizationName\":\"PassEntry\",\"teamIdentifier\":\"Q338UYGFZ8\",\"serialNumber\":\"810ce8e0-1f11-4e29-a35e-cdf326fb90c2\",\"backgroundColor\":\"rgb(41, 50, 58)\",\"labelColor\":\"rgb(255, 132, 119)\",\"foregroundColor\":\"rgb(255, 255, 255)\",\"logoText\":\"PassEntry\",\"generic\":{\"headerFields\":[{\"key\":\"passId\",\"label\":\"PASS ID\",\"value\":\"232\"}],\"primaryFields\":[{\"key\":\"staffName\",\"label\":\"NAME\",\"value\":\"Nico Cary\"}],\"secondaryFields\":[{\"key\":\"jobRole\",\"label\":\"JOB ROLE\",\"value\":\"Chief Innovation Officer\"},{\"key\":\"passExpiry\",\"label\":\"PASS EXPIRY\",\"value\":\"23 December 2020\"}]},\"nfc\":{\"message\":\"810ce8e0-1f11-4e29-a35e-cdf326fb90c2\",\"encryptionPublicKey\":\"MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADTkFu6xr9i4GKk1+Jn+UxayuuC+SQLfXA0sE5J5iQx3o=\"},\"webServiceURL\":\"https://api.passninja.com/thumbnail\",\"authenticationToken\":\"8e98126bb7e60666\"}",
"passType": "passentry.demo",
"serialNumber": "810ce8e0-1f11-4e29-a35e-cdf326fb90c2",
"type": "APPLE_CREATE"
},
"id": "#[email protected]#passentry.demo#810ce8e0-1f11-4e29-a35e-cdf326fb90c2"
}'
- In the Contacts sheet, feel free to click anywhere in a row for a specific contact that has all the required fields filled out.
- Go to
Menu -> PassNinja -> Create A Pass
and the script should run. - You will see the resulting pass + pass information output into the contact's fields.
- You can add a field to the Config sheet or remove one (just press delete while highlighting the four columns in the row).
- Go to
Menu -> PassNinja -> Build/Update from Config
and it should run. - The
Events
sheet will remain untouched - The
Contacts
sheet headers will change but the data below will remain untouched (so the user can feel free to reorder them to fit the new headers and also not lose existing passes.) - The
Form Responses
sheet will now be renamed toForm Responses {DATE/TIME}
to indicate it is archived and a newForm Responses
sheet will be created. - The linked Form itself will be updated to the new fields specified in the
Config
sheet.