Categories
coding workflow

Taking Google Forms to the Next Level

This originally appeared on the ACRL TechConnect blog.

Many libraries use Google Forms for collecting information from patrons, particularly for functions like registering for a one-time event or filling out a survey. It’s a popular option because these forms are very easy to set up and start using with no overhead. With a little additional effort and a very small amount of code you can make these forms even more functional.

In this post, we’ll look at the process for adapt a simple library workshop registration form to send a confirmation email and introduce you to the Google Apps Scripts documentation. This is adapted from a tutorial for creating a help desk application, which you can see here. I talked about the overall process of creating simple applications for free with minimal coding skills at this year’s LITA Forum, and you can see the complete presentation here. In this post I will focus on the Google Forms tricks.

A few things to keep in mind before you get started. Use a library account when you actually deploy the applications, since that will remain “owned” by the library even if the person who creates it moved on. These instructions are also intended for regular “consumer” Google accounts–there are additional tools available for Google Apps business customers, which I don’t address here.

Creating Your Form

Create a form as you normally would. Here’s an example of a simple workshop registration form.

There are a few potential problems with the way this form is set up, but here’s an even bigger problem. Once the person signing up clicks submit, the form disappears, and he receives a page saying “Thank you for registering!”

If this person did not record the workshop, he now has no real idea of what he signed up for. What he intended to do and what he actually did may not be the same thing!

What comes next? You, the librarian hosting the workshop, goes into the spreadsheet to see if anyone has signed up. If you want to confirm the sign-up, you can copy the patron’s email address into your email program, and then copy in a message to confirm the sign-up. If you only have a few people signed up, this may not take long, but it adds many unnecessary  steps and requires you to remember to do it.

Luckily, Google has provided all the tools you need to add in an email confirmation function, and it’s not hard to use as long as you know some basic Javascript. Let’s look at an example.

Adding in an email confirmation

To access these functions, visit your spreadsheet, and click on Script Editor in the Tools menu.

You will get many options, which you can use, or you can simply create a script for  a Blank Project (first option) You will get this in your blank project:

function myFunction() {

}

Change the name of the function to be something meaningful. Now you can fill in the details for the function. Basically we use the built-in Google Spreadsheet functions to grab the value of each column we want to include and store these in a variable. You just put in the column number–but remember we are starting from 0 (which is the Timestamp column in our current example).

function emailConfirm(e) {
  var userEmail = e.values[3];
  var firstName = e.values[1];
  var lastName = e.values[2];
  var workshopDate = e.values[4];
  MailApp.sendEmail(userEmail, 
                    "Registration confirmation", 
                    "Thanks for registering for the library workshop on " + workshopDate + " nnYou will " +
                    "recieve a reminder email 24 hours prior. nnLibrary",                    
                    {name:"Library"});
}

The MailApp class is another built-in Google Apps script. The sendEmail method takes the following arguments: recipients, subject, body, optAdvancedArgs. You can see in the above example that the userEmail variable (the patron’s email address in the form) is the recipient, the subject is “Registration confirmation”, the body contains a generic thank you plus the date of the workshop, which we’ve stored in workshopDate variable. Then we’ve put in advanced arguments the name “Library”–this is optional, particularly if it’s coming from a library email account.

Note that if a patron hits “reply” to cancel or ask a question, the email will automatically go to the email account that deployed the application. But you may want reply emails to go somewhere else. You can modify the last “advanced” argument to be some other email address with the replyto argument. (Note that this doesn’t always work–and that people can see that the email comes from elsewhere, so make sure that someone is checking the email from which the application is deployed).

 {name:"Library", replyto:"mheller@dom.edu"});
Running the script

Once you’ve filled in your script and hit save (it will do a quick debug when you save), you have to set up when the script should run. Select “Current script’s triggers…” from the Resources menu.

Now select the trigger “On form submit”. While you’re here, also click on notifications.

The notifications will tell you any time your script fails to run. For your first script, choose “immediately” so you can see what went wrong if it didn’t work. In the future you can select daily or weekly.

Before you can save either your trigger or failure notifications, you need to authorize that Google can run the script for you.

Now your script will work! Next time a patron fills out your form to register for a workshop, he will receive this email:

Doing More

After working with this very basic script you can explore the Google Apps Script documentation. If you are working with Google Forms, you will find the Spreadsheet Services classes very useful. There are also some helpful tutorials you can work through to learn how to use all the features. This one will teach you how to send emails from the spreadsheet–something you can use when it’s time to remind patrons of which workshops they have signed up for!

Categories
How-to Libraries

Using GVMax with LibraryH3lp

“So you’ve really done it this time,” I said to myself yesterday as I wondered why no one had been using text message reference recently, and then remembered I’d changed the library’s Google password earlier in the semester and had never updated it in LibraryH3lp. “Oh well,” I thought, “I check the Google Voice inbox periodically and didn’t see anything missed in there. I’ll update the password now, and it will all be ok.” Then I deleted the Google Voice gateway in order to add in the correct password and discovered to my horror that I couldn’t add it back. Little did I realize that LibraryH3lp had decided that the Google Voice gateway had reached end of life since the Twilio solution works better. I am sure the people at LibraryH3lp would have helped me out of this, but they suggested using something called GVMax as a solution. I didn’t see anyone talking about how to set this up, so I wanted to show how I did this if anyone else is wondering how it works.

  • Gather your materials. You will need a Google Voice account. I assume you already have one. Note that you don’t need to give GVMax access to your Google account, but you should to use all the functions. You will also want a queue for your Google Voice gateway  in LibraryH3lp that is offline. You can do that by removing all logged in users from the queue. If you forget, that’s ok, just make sure you take the queue offline and then online before testing this out.
  • Type your Google account username and password, and accept terms of service. Refer to the GVMax setup instructions for how to set up your account. Basically you need to set up a filter in your Google Voice email address to forward to a special GVMax email address that will send notifications to your Google Talk. If you had other forwards set up, you should remove them. You can do it all with GVMax. To set up this filter in Gmail requires a confirmation code that GVMax will forward to your Gmail account, so it takes a moment to set up. I would suggest copying the GVMax email address into a text editor since to complete this process requires switching between screens in both Gmail and GVMax.
  • Note that you can have GVMax monitor incoming calls, voice mails, and SMS. For these purposes, SMS only is preferable.
  • Make sure that Google Talk will accept chats from the GVMax account. This doesn’t have to be the same as your Google Voice account. Depending on how you have your IM reference set up you may need to choose a different Google Talk account. We have a different Google Talk address for the very few occasions where a student used an IM client rather than the chat boxes. As far as I know, the main IM client users used the AIM account. Anyway, we were already using that same account in our LibraryH3lp gateway that made sense to me to use the same one. But if you use that account as an IM gateway already, you may want to get a new one to avoid confusion.
  •  GVMax has a feature on the My Account page to send a test SMS. You will use that a lot.
  • At this point, if you send a text to your Google Voice number, you will get a message in Google Talk with the text. When you respond to it, using the magic of Google Voice SMS to Gmail to Talk and back again, the other end will get a response as a text. Test this out and make sure it works before you put it in LibraryH3lp.
  • Now go to your SMS queue in LibraryH3lp. Ours is called domusms. Before it used a Google Voice gateway, now you will pick Google Talk for the gateway. The account and password should be whatever you used with GVMax.
  • This is what the interaction will look like in LibraryH3lp:
  • The blurred out number is my phone number (though it’s more complex than that–I won’t get into it), followed by the GVMax address. There was a wait time of about 1-10 seconds between when I sent the text for it to appear in LibraryH3lp and then for my response to appear on my phone. Not bad!
  • I set up my SMS queue with the picture of the cell phone to remind people that this is the SMS queue. I suggest you do the same.
  • What happens if the queue is offline? This happens a lot. I have yet to see how this works in practice, but the main suggestion I have is to have alerts of text messages sent to an account that someone monitors regularly, such as the reference email. Then that person has to go into Google Voice to send a response. My theory is that there has to be a way to send a notification only if the LibraryH3lp queue is offline and hence the Google Talk account, but haven’t figured this one out yet. Will keep you posted!
Categories
Productivity Writing

November Writing Plan

Well, it’s that time of year again, when the internet explodes with mustaches and writing. I actually can’t remember what the mustache thing is about. Cancer? I am sure I will remember by the end of the month.

Now, it looks like I’ve not been writing at all in months, but that couldn’t be further from the truth. I’ve been doing lots of writing, just for other venues. But I need to remember that I can work on some not well understood or fleshed out ideas on my blog. I think that’s the point of Digital Writing Month. I personally am choosing Academic Writing Month, since basically all the writing I want to do is for traditional academic venues, such as double blind peer reviewed print journals, books, and so on. This is unusual for me, but strangely not terrifying.

And so, the plan:

  • Finish my portion of the final draft for a column DUE TOMORROW that will be published in Reference User Services Quarterly. I expect this will take 5 Pomodoros minimum, and obviously is VERY TIME SENSITIVE. (Caps for my own benefit). Update 11/2: Turned in, and done in 5 Pomodoros plus a bit of extra time.
  • Write a Call for Proposals for an internal researchy project. This I promised to deliver by the end of last week. Oops. This will take probably 1 Pomodoro if I get my act together. Update 11/2: Done, but did without benefit of Pomodoroing in until 25 minutes.
  • Write ACRL 2013 Cyber Shed proposal, due November 9. 2 Pomodoros, let’s say. Update 11/9: Done with 1 Pomodoro and one bout of checking Twitter incessantly. Also may do a poster proposal for another project, which is probably an additional 2 Pomodoros.Update 11/9: Wishful thinking knows no bounds
  • Book review for the Journal of Electronic Resources Librarianship, due November 15. This will be challenging since it’s a strange hybrid sort of book. So while it’s probably doable in 3 Pomodoros, this is probably underestimating the time I will spend staring in horror at the blank page. Update 11/14: 3 was about right, though I only tracked one. Turned out to be pretty easy to write, and turned in a day early.
  • Revisions for a provisionally accepted article for Information Technology in Libraries that peer reviewers had some good suggestions for that are also challenging to follow. However, they are right and the article won’t be good unless I follow them. This really needs to be done as soon as possible, and will take I have no idea how long. Let’s say 10-15 Pomodoros.
  • Abstract for a paper the Media in Transition conference, which is due on a rolling basis starting in early November. I had an amazingly brilliant idea in the shower one day, which I immediately wrote up whilst in my bathrobe. I would think I could do this in 3 Pomodoros, assuming the idea is still brilliant.
  • Write a solid (and hopefully complete) draft of an article that an editor from a journal asked for based on a conference presentation from very early 2011. This should be about 1500 words I think, and should be doable in 5 Pomodoros if I really get into it. This is a co-written project as well.
  • Write a rough draft of  a mysterious book project that will be something like 25,000 words. I will say more once I feel less weird about this. 1 billion Pomodoros? Ok, this one I will just whale on day by day until it is looking like something. Will base this one on word count alone.
  • Oh yeah, I have an ACRL Tech Connect post due as usual near the end of November. 2000 words, got to get this one done soon. Let’s say 10 Pomodoros.

In terms of strategy I write best in the very early morning, or very quiet late afternoons when the office is empty. Until November 12 it will generally be empty in my office after 2:30, so will aim to get lots of this done then. Weekends are doable if I have a deadline to force me to work. It was also pointed out to me that I have to take some vacation days soon or lose them (but I took a vacation in June! How could this be happening already!) so that might be a good strategy.

That’s the plan! I was sick in bed for nearly 2 days this week, so lots of other stuff to catch up on that has nothing to do with writing. Plus all the other currents of life that keep me trying to keep calm and… well, you know the rest.