Useful Ecto Validators

Over the past week, I’ve created a couple custom validators for my Elixir projects which use Ecto. Since validators are just functions that take a changeset and return a changeset, they’re very easy to write.

[Read More]

On Keeping Your ETS Tables Alive

In my ongoing quest to make Elixir libraries that integrate with Twilio, I found that I needed a lookup table to store the state of ongoing calls in.

In Rails, this table would probably be a Postgres table or a list key in Redis. But before jumping to one of these familiar solutions, I thought, “What does Elixir/Erlang already have that would meet this need?”

[Read More]

Stream Paginated APIs in Elixir

_This article was recently featured in Elixir Radar. Since it was written, I’ve found a simpler way to implement this kind of Stream. I’ll be writing an updated tutorial in the future, but if you’re interested, you should also check out the current state of ExTwilio.ResultStream._

This past week, as I worked on my new ExTwilio API library for Twilio, I ran into a snag dealing with Twilio’s API pagination.

Twilio paginates its “list” APIs, requiring multiple requests to fetch all of a given resource. However, users of my API library will expect to be able to fetch all of a resource and perform operations on it, like this:

calls = ExTwilio.Call.all
Enum.each calls, fn(call) ->
  # perform some operation

Users won’t want to mess with the details of pagination. They want to get a collection containing everything and then operate on it.

I find that there are two basic ways to achieve this, a blocking way and a non-blocking way.

[Read More]

Manage Environment Variables in Elixir

I love how the Elixir build tool, Mix, has built-in support for configuration settings. It makes configuring packages much simpler by providing a standard interface for config settings.

I’m currently developing a Twilio API client for Elixir. While I develop and test it, I need to store an “Account SID” and “Auth token” to make requests. Naturally, I turned to Mix config.

[Read More]


At LeadSimple, we use Twilio to handle phone call routing. Twilio interacts with regular HTTP endpoints on your server to control calls and SMS messages, through a form of XML they call TwiML.

I’ve been toying recently ideas on how to bring next-generation Erlang (Elixir) and next-generation telephony (Twilio) together. Toward that end, I made a little library this week to make generating TwiML from Elixir easy.

[Read More]