Part 1: Inserting Scan Records to Web Apps using Zapier
What does Zapier do? Zapier allows users to create Zaps: automated tasks. Zaps hook up triggers to actions and allow different services to integrate with each other.
Example: Send Scans to a Google Drive Spreadsheet. In this example, we will create a Zap that inserts scan data whenever a CodeREADr scan is made.
Required: You will need a paid plan on codeREADr.com with your API key and a Google Drive account. [If you’re not ready for a codeREADr paid plan please contact support@codeREADr.com to request a demo account.]
Step 1 >> Zapier
Go to Zapier.com and sign up for a Free (or paid) Plan.
Once logged in, click the ‘Make a New Zap!’ link at the top.
Click Choose a trigger app.
Under the dropdown, find and select ‘codeREADr.’
For the trigger select ‘New Postback Receiver Scan’.
For the action select ‘Google Docs’.
Under Google Docs, select ‘Create Spreadsheet Row’ and click Continue.
Step 1 >> codeREADr
a. To add your CodeREADr account, all you need is your codeREADr API key.
b. To obtain your API key, go here on codeREADr.com in a new browser window: https://www.codereadr.com/account/api. Copy your API key and navigate back to the Zapier webpage. Keep the codeREADr webpage open as we will come back to it.
Step 2 >> Zapier
a. Name your connected codeREADr account and add your API key. If the API key ‘Test this Account’ fails, verify that the API key is correct and associated to a Paid Plan on codeREADr.com. If it passes the test it will say ‘Account is working’.
b. To hook up your ‘New Postback Receiver Scan’ trigger to this zap, copy the link under ‘Use this Webhook URL’ by clicking the copy to clipboard button. Then click Continue.
Step 2 >> codeREADr
a. Switch back to the codeREADr.com webpage and click ‘Services’ at the top. Here you can choose to edit an existing service or create a new one. In this example, we will make a new service. Click the ‘Create Service’ button.
b. We will use the ‘Record Scans’ service and select the ‘Online in Real-Time’ option, then click ‘Create Service’.
c. On the next tabs name your Service, then add app Users (you need at least one) and any form or multiple choice Questions (optional).
d. Under the Advanced Tab, check ‘Postback scans after they are received by the server’. Keep the default settings except check ‘Receiver Only’. Paste the Zapier Webhook URL in the text box under ‘Enter your Postback URL’
Choose a template for your POST variables. This template will be based on an Export Template. To learn more about export templates, click . Save and Continue and now this Service is connected for your Zaps! You must make a few scans on your device to verify that the postback is working before moving to the next step.
Step 3 >> Zapier and Google Drive
a. Sign into your Google Drive account and open a Google Drive Spreadsheet. For the purposes of this example, title it ‘My Scans’.
b. Under ‘Select a Google Docs Account’ select or name the Google Drive account you want to connect with Zapier. Zapier will automatically check if you’re signed into that Google Drive account. If you’ve never connected with your Google Drive account, you will be asked to confirm that you want to connect with Zapier.
Step 4 >> Zapier
a. You need to filter your triggers. Specifying the codeREADr app username is optional but a good practice. Using the drop-down menu you must specify the codeREADr Service you created for this Zap.
b. You can ‘Add a custom filter’ here but that’s an advance option for a limited number of applications. We’re going to skip that now so click ‘Continue’.
c. Now we can start designing the Google Drive Document. On Google Drive select the ‘My Scans’ option in the dropdown for the Spreadsheet. [You may need to refresh this page for Zapier to detect any new Spreadsheets.]
d. Under Worksheet select ‘Sheet1’. You’ll see that the My Scans spreadsheet is not formatted. Google Spreadsheet requires a specific format.
e. Navigate back to the My Scans spreadsheet on Google Drive and add the same headers you have in your Export Template. Here we give you an example using just Scan Value, Response Text, Scan Validation Status and Timestamp on the first row. Provide sample data on the next row. The spreadsheet should then look similar to the following:
Scan Value Response Text Scan Validation Status Timestamp
123-ABC John Smith, Member 1 4/22/2014 15:40:43
f. Once your Spreadsheet is properly formatted, refresh the Zapier page and scroll to the bottom of the page. Observe new fields appear – for each of these fields, click the ‘Insert Fields’ button on the right and select the associated field.
scanvalue >> Scan Value
scanresponsetext >> Response Text
scanvalidationstatus >> Scan Validation Status
timestamp >> Timestamp
Note: You don’t have to name your My Scans headers the same as the codeREADr names. We did that here to make the example clearer. Also, the order of appearance in not important.
g. Test the Zap. Since you have no scans made on this service, the trigger will be blank and the Zap will not work for this test since the fields require a value. You can ignore this and continue.
h. Name this Zap (e.g. ‘Demo Scan to Google Drive Spreadsheet’) and turn it on! As long as the Zap is on whenever an app user scans with that codeREADr Service, a new Google Drive Spreadsheet row will be created.
Advanced 1 >> Adding Answers and GPS Location
The pre-populated codeREADr fields shown in Zapier represent the standard scan data captured by the app with each scan. You can use some or all of those fields providing you have a heading on your spreadsheet associated to those fields in Zapier, just like you did above.
To populate your spreadsheet with app user’s answers to prompted Questions or to track their GPS location, you need to do the following.
a) On codeREADr.com, add Questions and/or GPS options when creating your Service. The standard placement of a Question prompting an app user’s answer is before submitting a scan for ‘Record Scans’ Services and after submitting a scan for ‘Validate Scans’ Services. For now, select before submitting a scan. [See below for special instructions for submitting answers after a scan.]
b) Scan once using the codeREADr app, answering each question posed to the app user. When submitted this scan will populate the Question and GPS fields in Zapier. It would look like this:
c) Now you can follow the same instructions as in Step 4 above, namely adding headers to your spreadsheet and associating them to the proper field in Zapier. A typical result of an action could look like this:
Advanced 2 >> Filtering Example – Questions AFTER a Scan is Submitted
As noted above, when creating a Service on codeREADr.com you can add Questions to prompt app users to submit answers. If you want to ask the app user to answer questions after the scan is submitted to the server for validation, you need to create a filter to avoid the postback scan trigger will from triggering twice. In Step 4 of the Zap creation, click the ‘+Add a custom filter’ button. Fill out the form as follows:
Field: Scan Updated (scan_updated)
This will enable Zapier to ignore the initial scan submitted before the questions.
If a Zap using codeREADr actions or triggers did not fire as expected, find out more information:
1. Go to the Zap (on your dashboard).
2. Click the circle gear button on the right of the Zap.
3. Select History. Alternatively you can navigate to the task history panel on the right.
4. A list of the ‘tasks’ made by Zapier is listed.
5. Find the entry with the timestamp of the misfire, if it doesn’t exist then either Zapier’s webhook URL never received its trigger or there is some delay and the zap is still being executed.
6. If it exists, click the task.
7. Examine actions taken by Zapier, if there was a red dot and then examine the error message.
– Invalid input (spaces, special characters) as an input for creating a new Username.
– Required fields with only variables may not execute if the variable is empty or doesn’t exist.
Part 2: Sending IDs from Zapier to a codeREADr Database
Updating a Database with a Google Spreadsheet
Once logged in, click the ‘Make a New Zap!’ link at the top.
Click Choose a trigger app.
Under the dropdown, find and select ‘Google Sheets.’
For the trigger select ‘Updated Spreadsheet Row’.
For the action select ‘codeREADr’.
Under codeREADr, select ‘Insert / Update Database Value and click Continue.
g. Connect both your Google Sheets account and your codeREADr account.
h. Follow the instructions in Step 5 to assign column headers to properties of each entry that will be added to your database in codeREADr.
Test the zap.
Name the zap.
Now you’re all set! Zapier will check to see what changes have been made in Sheets to update your database every 15 minutes (*).
(*) codeREADr is not limiting updates to 15 minute intervals; you may be able to update faster with Sheets, Zapier and other services but you will need to check the settings of the service provider.