31

Aug

2017

How to Level Up Your Automation with the AWeber API and Tags

By: August 31, 2017

One of the best ways to get new email subscribers is with a sign up form. Forms give you the opportunity to ask every person who visits your website to subscribe to your email list. And this not only allows you to grow your list, it helps you turn casual site visitors into email subscribers you can communicate with over and over again.

And with the release of AWeber's tagging feature, we can automatically give subscribers a tag when they join a list through a sign up form, and then send automated email series or one-time emails to subscribers who have that tag.

This is great! But often, when a subscriber completes a form, you may want to attribute different tags to them based on their interests, preferences or choice. You may even want to add them to different lists depending on their choices!

This can help you send even more targeted and relevant email content to a subscriber, and as a result, improve email engagement.

So, to help you accomplish this and get a glimpse of how powerful the AWeber API is, I’ve created a Python script that shows how to use the AWeber API to not only apply different tags to subscribers based off the selections they make on a sign up form, but also to subscribe them to different email lists! Let’s dive in.

When would you want to use this?

Pretend you’re an online store owner, and each of your email lists is associated with a different department. You have three departments: books, t-shirts and handmade cat bows. And you have an AWeber email list for each department.

You frequently put on sales for items based on popularity, and the upcoming discount will be on the most popular cat bow, The Purple-Spotted Mouse.

You don't want to bother your book readers with an email about cat bows – that wouldn’t make sense!  So you decide to make sure all your incoming subscribers are put on the correct department list and then given a tag that signifies which specific product they expressed interest in when they signed up.

For this scenario, the first thing we need is a sign up form. I am choosing a form that includes a drop down where the subscriber will choose a product they are interested in when they fill out the form. This choice will then correspond to a particular department list and tag.

The code

Before we can run the Python script, there are a few things you need to do first:

  1. Install the following packages: flask, requests and requests_oauthlib.
  2. Copy and paste your account id, list ids (you need three lists!) and OAuth tokens at the top of the script.
  3. Save the code example below as app.py.

Now keep in mind this is in no way production ready and is only shown in a single file for simplicity. To run this app, open a terminal, locate the file and run python app.py.

*This script was tested on python 2.7 and 3.5.

Now you’re ready to level up your automation!

With this new script in place, you are now ready to start your sale on the Purple-Spotted Mouse Cat Bow! The script determines the list and tag to add to the subscriber based on the subscriber’s selection when they sign up.

Now when subscribers fill out your sign up form and choose the cat bow, they will be tagged with “purple-spotted-mouse” and be added to the cat bow department list in your AWeber account.

Once your subscriber is tagged and added to a list, you can then trigger automation series based on that tag or create a segment of subscribers with that specific tag and send a one-time broadcast email to them.

That’s it!

That’s just one of the ways you can use the AWeber API to customize your automation. The options are nearly limitless! If you have any requests for other scenarios where you might use tags, automation and the AWeber API, comment below to let me know.

If you’re having trouble getting the access keys necessary to run this script, please email our Applications Support team. You can also comment here demanding another spectacular blog post about it or check out our php getting started guide.