Scaling Your Twitter Support, Part 1: Adding a “Night Service” via Tropo.com
May 7th, 2010 by Dan York
What do you do if your use of Twitter for customer interaction is wildly successful? How do you scale your support for using Twitter for customer service, customer support or other topics? Do you hire a bunch of extra people? like Staples did? Or do you look at using tools and services to help your existing staff through automation and/or augmentation of the staff’s efforts?
If you have been reading previous posts about Tropo and Twitter or if you follow me on Twitter, you’ll know I’m a wee bit passionate about the service… and this particular question continues to intrigue me:
“How do you scale your Twitter support?“
Obviously you can hire a bunch of people to help with responding to tweets, like Staples and Comcast (which once upon a time had only Frank Eliason on Twitter but now has a whole crew). You can have them work different shifts or be in different parts of the world to help with coverage. You can do all that, if you can afford to do so.
But for many companies, that may not be an option… and so ever since we introduced support for developing Twitter applications in Tropo.com, I’ve been thinking about how you could use Tropo to automate and augment your Twitter support. In a couple of presentations about Unified Self-Service, I’ve mentioned having a couple of people who support Twitter interaction and asked the question:
What do you do when those employees go home for the evening?
Do you:
- Wait to respond to all Twitter inquiries until the next business morning?
- Require your staff to check every few hours to respond?
- Require your staff to work off hours to have 24×7 coverage?
Many companies probably treat Twitter messages like email or phone… “we’ll get back to you tomorrow”… but what if you want to provide a higher level of service? What if you want to help people by pointing them to your website?
A SOLUTION?
One solution that came to my mind was to resurrect the “night service” idea from the telephony days… create an automated agent attached to your Twitter account that only replies to Twitter messages during certain hours.
This turns out to be ridiculously simple in Tropo! Here’s a VERY basic implementation in python:
from datetime import *
answer()
if datetime.now().hour not in range(12,21) :
say("Our offices are currently closed. We will reply to your tweet as soon as we can but in the meantime, please visit http://www.tropo.com")
hangup()
That’s it.
NOTE: Time on Tropo servers is in UTC/GMT, so you need to adjust offset accordingly. US Eastern Daylight Savings Time is +4 hours, so 5pm is 17:00 EDT = 21:00 UTC. My example code, therefore, does NOT respond between the hours of 8:00 am and 5:00 pm US Eastern time.
MAKING IT SMARTER
Now, this example is exceedingly dumb. It simply fires back a single tweet as an “@” response to any mention of the Twitter account. This is probably not what you want, given that it doesn’t differentiate between a “reply” to your Twitter account (where the “@username” is at the very beginning) and just a reference to your Twitter account in the body of a tweet.
So how do you tell the difference?
It turns out that there is a simple way (and yes, we need to document this better). If the Twitter message is a “reply” with your “@username” at the beginning of the tweet, your Twitter username is removed before the tweet text is sent to your app. If the Twitter message mentions your Twitter username, it is just included in the message text. The rationale here is that a reply is pretty much like an instant message or SMS … and so we are making it easy for your app to treat IM, SMS and Twitter replies in the same way. Regardless, the “currentCall.initialText” variable is loaded with the text that was sent to your account – your Twitter username is just stripped out if it is a reply message.
The end result is that you can determine if the message is a “reply” (or “public message”) to your twitter account by testing for the absence of your Twitter name.
Modifying the code above to respond to only messages versus mentions, it looks like this in Python:
from datetime import *
answer()
if datetime.now().hour not in range(12,21) :
if currentCall.initialText.find("@stratohelp") == -1:
say("Our offices are currently closed. We will reply to your tweet as soon as we can but in the meantime, please visit our web site at www.tropo.com")
hangup()
In this case, the python string function “find” returns a “-1″ if the string is not found. The Twitter username I’m showing here is “@stratohelp”, which you obviously need to replace with your own account name.
Now, again, I’m still sending out only a very basic message. I could start adding more functionality to this to make it smarter. Features like:
- Scanning the “initialText” for keywords and responding back with specific URLs. For instance, pointing people to a FAQ entry for particular phrases.
- Performing other actions based on keywords in the tweet, like sending email or a SMS to a certain person within your company.
- Using the Twitter ID (found in currentCall.callerID) to personalize the message back, perhaps by doing a dip into a database to retrieve info.
There are many more actions you can take… and I’ll look at some of those in the next posts in this series.
TRYING IT OUT
To try this yourself, just:
- Login to your Tropo.com account (or sign up for a free developer account).
- Create a new application and set it to only respond during certain hours (remembering the UTC offset). If you copy/paste my code above, name the file ending in “.py”.
- Follow these steps to link a Twitter account to your Tropo app.
- Try out sending tweets to that Twitter account during both the time the app should respond and when it shouldn’t.
Note: When you are developing and testing an app, please do remember the restrictions on duplicate tweets… your app will not be able to keep sending the identical response to the identical Twitter account, so you may want to have multiple Twitter IDs for your testing.
Have fun with it… and please do let me know if you do anything cool with a Twitter app. I’d love to write about other fun uses here. Also, if you have examples similar to the code I’ve done above in languages other than python, please let me know as a comment here or as an email and I’d be glad to add them here as additional examples.
Related posts:
- Scaling Your Twitter Support, Part 2: Triggering Alerts on Keywords
- Scaling Your Twitter Support, Part 1a: Tweaking the “Night Service” app a wee bit
- How to Add Twitter Support to a Tropo.com App – Step by Step
- Testing a Tropo app with Twitter? Remember that Twitter rejects duplicate tweets…
- Want to play with building Twitter apps on Tropo? Here’s source code for 5 sample apps.

How do you scale your company’s Twitter interaction? Automation can help……
If you are successful in establishing Twitter as a channel to interact with your customers… for customer support, service, general inquiries, whatever… if it really works and customers start to view Twitter as a regular channel to contact you on……
How to create an automated Twitter self-service “RSVP” app using Tropo.com…
Do you want an application that lets your customers interact with you via Twitter – but to do so via “self-service”? i.e. without a person having to help them? What if you wanted to make it so that people could……
you say here that the initial.text of a true reply (@username messagebody) strips out your @username – but in my testing, that doesn’t seem to be the case. I have an app set up to echo their message with a thank you – using initial.text – however, it sends it with my @username intact – am I missing something?