DEV Community 👩‍💻👨‍💻

Cover image for QR Code Engagement Workflows Using a Python SDK
Birinder Lobana
Birinder Lobana

Posted on • Updated on

QR Code Engagement Workflows Using a Python SDK

Since the beginning of the pandemic, we have seen QR Codes pop-up virtually everywhere. In fact, there has been a 94% growth in QR code usage since 2018!

According to eMarketer, the number of US smartphone users scanning QR codes will increase from 83.4 million in 2022 to a projected 99.5 million by 2025. This is an excellent opportunity for customer engagement agencies to adopt QR Code engagement solutions.

Openscreen's QR Engage

Openscreen is an end-to-end engagement and insights platform to drive revenue and client loyalty. Openscreen offers a comprehensive python SDK which can help you create powerful customer engagement workflows.

In the example below, we will create a Dynamic QR code which would lead to a web-form, and enter submissions into a draw. A random winner is chosen and an SMS is sent to the winner.
Openscreen's QR Engage at the Gatineau Olympiques Minor League Hockey game
Here's what you will need for this workflow:

  • A free Openscreen account
  • Python 3.10+
  • Openscreen's Python SDK
  • A custom webform to capture customer's contact information

Environment Set-up

Before we begin implementing our workflow, we will store the following identifiers in a .env file. They are available on your Openscreen Dashboard:

ACCOUNT_ID='xxxxxxxxxxxxxxxxxxxxxx'
OS_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxxxx'
OS_ACCESS_SECRET='xxxxxxxxxxxxxxxxxxxxxx'
PROJECT_ID='xxxxxxxxxxxxxxxxxxxxxx'
Enter fullscreen mode Exit fullscreen mode

The following code will authenticate your application:

Create A Dynamic QR Code

Openscreen's python SDK uses several core objects to ensure the scalability of QR code enabled workflows.

An Asset is a core object that stores information about a physical or a digital object. The Asset object represents the QR Code. One Asset can have several QR codes associated with it - think of a lottery ticket (the asset) with multiple QR Codes.

Creating an Asset and associating a dynamic QR code can be done in a single call. In the code below, I am creating a billboard (Asset) for a real-estate listing. A person scanning this QR code should be led to your web-form requesting information about the customer. After the form is submitted, you can display the information about the listing.

Capturing QR Code Scans

One unique advantage of using Dynamic QR Codes is that they are traceable. Openscreen's SDK generates a scan object, identified by a scanId each time a dynamic QR is scanned. Additionally, this scanId can be appended as a query string parameter to the destination URL of the QR code. This allows us to create workflows surrounding a single QR code scan!

The following flag sets the scanId in the query string parameter of the QR code destination URL:

dynamic_redirect_type: 'SCAN_ID_IN_QUERY_STRING_PARAMETER'
Enter fullscreen mode Exit fullscreen mode

Creating a Contact

Once the QR code is scanned, a scan object is generated, while the user is led to your custom web form. After the user submits the form, your application should fetch the user-details and the scanId from the URL. This will allow you to create a contact against the scanId:

Note: Openscreen requires contacts to have a consent before you can communicate with the contact.

Be sure to store this scanId which was used to create this contact. In the above code, I am storing the scanId as one of the custom attributes in the contact object.

This is the extent of your campaign, where you are able to capture consented customer contacts. You can choose to export these contacts to a CRM tool, or to a CSV file.

Send SMS

To choose a winner of your campaign, you can find a random contact from your list of contacts. You can fetch all your contacts in this project by calling the GetContactsByProjectId function. In order to send SMS to this contact, you will need to fetch the scanId. In our case, it is available as one of the custom attributes:

Conclusion

The above workflow is an excellent example of how QR code enabled solutions can boost customer engagement. In this case, there was a prize incentive, but the model can be reused to showcase new products while providing unique coupon codes, communicate about upcoming events and incentivize ticket purchases, and much more. At the end of the campaigns, you receive a list of consented customer contacts for your future campaigns.

Read more: How to Add CRM to Your QR Code Application, Scan to Cart QR Codes

Latest comments (0)

🌚 Life is too short to browse without dark mode