New Channel Announcement

Akiva Leffert
DNC Tech Team
Published in
4 min readJul 31, 2017

On the DNC’s tech team, we believe strongly that organizations function better when there’s internal transparency, when people can collaborate, and when there’s a culture of openness. We use Slack for our internal chat and that lets us declare a channel public or private. Historically, all of our tech team’s chat channels were restricted to the team, but secrecy makes all those things more difficult and, sure enough, we found we’d siloed ourselves off from the other teams. Further, much of what our tech team does is not particularly a secret — especially to our coworkers! If you looked at the tech team’s chat channels, you would learn that we prepare for elections and that we care about our deploys being easy and fast. You would learn about our voter empowerment tools at iwillvote.com and that we’re hiring engineers.

As such, the tech team decided to open our locked channels to the rest of the organization. Now if our coworkers are interested in what the tech team is doing, they can just pop into #tech. We also took this opportunity to organize and streamline our team’s channels, including setting up a #tech-outages channel to coordinate any major outages. Instead of spreading communication across a number of locked channels with potentially different members, we now have an easy way for people affected by an outage to coordinate. People not involved can also learn about what is happening and follow an issue, which might inform their own work.

Part of building a culture is communicating about what you’re actually building. To help with this, we took an idea we’d seen elsewhere: Have a bot announce any new chat channels in our Slack. This helps our co-workers become aware of new things that we’re doing, but also gives them implicit permission to check the new channel out, creating a more open and curious culture.

I assumed such a bot was a solved problem — I’d seen it working in other Slacks! But when I went to set something up, all I found were third party integrations and a two year old repo that wanted me to set up a database (which seemed like overkill). I wanted to have something I could run myself so we can improve it or use it as an example for other bots. I decided to write it myself and I’m thrilled to announce our first open source release. I promise it won’t be the last!

The bot is not a lot of code. In fact, here it is in its entirety:

""" Posts a list of channels created in the last day to slack. """
import datetime
import os
import slackclient
def post_new_channels(token, post_channel):
""" Fetches list of slack channels and posts the new ones.
Args:
token (string): Slack API token.
post_channel (string): Channel to post announcements to. """
slack = slackclient.SlackClient(token)
response = slack.api_call('channels.list')
channels = response.get('channels')
for channel in channels:
created = datetime.datetime.utcfromtimestamp(channel['created'])
purpose = channel.get('purpose', {}).get('value', {})
name = channel['name']
descriptor = "<#{}|{}>".format(channel['id'], name)
if created + datetime.timedelta(days=1) > datetime.datetime.now():
if purpose:
text = "New channel {}. Purpose: '{}'".format(
descriptor,
purpose
)
else:
text = "New channel {}".format(descriptor)
response = slack.api_call(
'chat.postMessage',
channel=post_channel,
text=text,
as_user=True
)
if __name__ == "__main__":
post_new_channels(
os.environ.get('SLACK_BOT_TOKEN'),
os.environ.get("SLACK_POST_CHANNEL", "#general")
)

(Find it on GitHub)

This is a small python script that posts the names of any Slack channels created in the last day to the #general channel. We run it automatically every morning. I’m sure there are ways to make this code be more general or clever, but it meets our needs and since it might meet yours we wanted to share it.

Making some channels public may seem like a small thing, but this openness strategy has already paid dividends. As a developer on iwillvote.com, I often make small updates to our user facing strings. Because the Democratic Party cares about and recognizes the diversity of America, we make sure that every piece of text on the site is available in both English and Spanish. My English is passable enough to make small copy changes (and write this blog post), but my 7th grade Spanish is not up to the challenge of translating them. Normally, when we have a big list of strings to translate we’ll send them off to be translated. This process works fine when we’re making a big change, but it takes some time. When I make a small change, I don’t want to wait on a translation, or merge my change with a TODO that we might forget to deal with. Further, following continuous integration best practices, we want any changes we land to be shippable or behind a feature flag. Not having quick translations makes this a hassle.

To solve this problem, we created an open #spanish-translations channel to harness the skills in our organization and get small translations quickly without having to go through a longer offline process. Initially, the channel just had a few people, but because we were comfortable making it open, more are joining and using it. Suddenly, people from different departments, even ones that might not have anything to do with tech, are collaborators invested in what our team does.

These small changes add up. As we build up our team, it’s important to get these little things right or the big picture we’re imagining won’t come together. Our big picture involves a lot more collaboration, not just inside the DNC, but with progressive technologists all over the country. In the coming months we’ll be talking more about those plans.

Interested in helping us build a new culture and a new foundation for tech in the Democratic Party? We’re hiring! Spanish speakers welcome!

--

--