Yesterday I had a great discussion on QR codes with the founder of Tourtek. This sparked some ideas on how to use QR codes as promotional materials but still track the response using Infusionsoft. While this does require some API code, it is pretty straightforward and I will provide the code to make life easier on everyone.
Here’s how it works. We are going to generate a QR code using Google’s Charts API and insert an Action Set ID and Contact ID into the QR code. Then when each person scans the QR code, it will redirect to an API processing page which runs the actions on the corresponding contact and then redirects them as desired. If that is a little too techy for you, don’t worry. It’s not as hard as it sounds.
First we need to create our API script to parse the QR code info and run the actions. The following code is PHP written for use with the Infusionsoft iSDK.
//Get info from QR code
$actionId = $_REQUEST['as'];
$conId = $_REQUEST['cid'];
//Run action set on person
$result = $app->runAS((int)$conId, (int)$actionId);
//Redirect them to desired page
header( 'Location: http://www.yoursite.com' ) ;
For more information on setting up or using the Infusionsoft API, checkout the Infusionsoft Developers Site.
Next, we are going to generate the custom QR code. I have already done the hard part here and formatted the URL appropriately. All you need to do is add you custom data. The URL for the custom QR codes is:
You will want to replace “XX ” with your action set Id. You will want the URL to be pointing at your API script that we created above. You will also notice that we added an Infusionsoft merge field at the end of the URL. This will allow the QR code to automatically be set to the appropriate contact.
Now that we have our link, we can insert it into an Email or Letter template inside Infusionsoft.
For email, go to:
Click to make larger
Setup -> Template Library -> Add a Template -> Email. Edit the email body using code builder. You can add the QR code image by inserting it into the desired location in the code. The highlighted area of the screenshot below shows the exact syntax required.
That’s it! You can now send emails and letters from Infusionsoft that contain automated QR codes. For added security, you can insert more merge fields (such as First and/or Last Name) and have the API script validate that it’s a match with the ID. If you appreciated this tutorial, please leave a comment and let me know. Thanks!