Send Emails, Update Trello Using Trolly and Mandrill

Recently, I’ve taken on some additional tasks at work. Chief among them has been reaching out to users for interviews—I ask them about pain points and favorite features, record the sessions, and then write up notes.

The start of every one of those sessions, however, is emailing a user to see if they’d be interested in talking to me. It only took sending a few of those (basically identical) emails for me to wonder if I could automate the process—it turns out I can.

I’ve written a bit of Python that takes a first name, last name, email address, and company name for a user. It then substitutes that information into a stock email script, sends the email through Mandrill, and makes a card on a Trello board containing the user’s name and company (to which I’m assigned as a member). It uses Trolly (a Python wrapper for Trello) and Mandrill’s official Python wrapper.

I’ve uploaded a Gist of the script here (you can ever see the script that I use for the emails):

As you can see, I’m not storing my credentials in another location. That’s because this is running on my local machine, and is really only intended for my personal use for sending four or five requests a week. The variables I’ve anonymized are:

TRELLOAPIKEY – The user’s Trello API key, which you can find by going to while logged in.

TRELLOAPITOKEN – The user’s Trello API token (it needs to have write permissions, not just read). You can generate one in Trolly, or by manually going to,write&expiration=never&name=Interview+Request+Script

in the browser.

MANDRILLAPIKEY – The user’s Mandrill API key, accessed in the Mandrill account.

from_email – Substitute in with your actual from address.

from_name – And the actual from name.

Reply-To – Typically the same as the from_email, but not always.

TRELLOLISTID – To get this, find the board your list is on. Make a GET request to /1/boards/[boardID]/lists, and pull the appropriate list ID from the results you get back.

TRELLOMEMBERID – Assuming this is yourself, you can make a call to /1/members/me and pull the ID from there.

And that’s it! When running the script you’ll be prompted to provide the user info, and off the email goes and onto the board goes the card.

One thought on “Send Emails, Update Trello Using Trolly and Mandrill

  1. […] I finished the class series at my home theatre, and started a class series at a new one. I performed several improv shows in Hapeville.  I quit my old job because it made me cry in my car, and I started a new one, and I’ve just now enrolled in a Ruby hackerschool setup. I learned a bit more Python. Some of it even does things. […]


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s