Code, Tutorials and Hacks

When someone runs for office in the United States of America (U.S.), they have to fulfill certain "Ballot Access Requirements" to become listed on the ballot. One of those requirements could be that you need a certain number of signatures per district. So when volunteers and campaign workers go out to gather signatures, it is instrumental to know which congressional district (CD) the signee belongs to. However, knowing which congressional district you are from is not common knowledge, especially in areas where the district cuts right through counties, cities, and neighborhoods.
States redraw their congressional districts every decade after getting an updated population count from the Census Bureau. Each district is represented by a single U.S. representative in the U.S. House of Representatives. However, the manner in which these districts are drawn often result in unique and odd shapes which can be confusing. This is why constituents living just a …

Nous voilà dans la troisième et dernière partie de notre guide galactique ! Nous avons vu ensemble dans la première partie les fondamentaux des SMS puis comment utiliser les messaging services de Twilio pour implémenter vos campagnes de SMS.
Cette troisième partie est un tutoriel pour vous accompagner, pas à pas, dans l’acquisition de numéros de téléphone avec Twilio.
Acquérir des numéros de téléphones avec Twilio
Twilio vous permet d’acheter des numéros de téléphone (long code, short code, toll free) dans plus de 100 pays.
De la même manière que les SMS, la réglementation sur les numéros de téléphones varie d’un pays à l’autre. Pour connaître les subtilités de chaque pays, Twilio met à disposition une page décrivant ces règles par pays : les phone number guidelines.
Pour chaque pays, il est indiqué les types de ressources que Twilio peut provisionner :
- Numéros locaux : pour la France il …

Email communication is an essential aspect of most businesses. In this post, you will look into the basics of sending emails with the Twilio SendGrid Email API and sending templated emails with the Handlebars templating language. Finally, you will finish by putting it together in a sample project that sends emails based on a template.
Prerequisites
You'll need the following things for this tutorial:
- A free Twilio SendGrid account. Sign up for a SendGrid account here to send up to 100 emails per day completely free of charge
- An OS that supports .NET (Windows/macOS/Linux)
- .NET 6.0 SDK (newer and older versions may work too)
- A code editor or IDE (Recommended: Visual Studio Code with the C# plugin, Visual Studio, or JetBrains Rider)
Set Up SendGrid
API Key
First things first: To use the SendGrid API, you need an API key. Create one by heading over to the …

Mobile donations are one tool you can use to encourage support of your non-profit organization. Supporters can donate directly over the phone using an automated system, powered by Twilio Voice.
In this article, you’ll be building an app that responds to incoming calls by asking callers to enter a donation amount and then their credit card information. This information will be captured by your payment processor to complete the charge.
To start accepting mobile donations, follow along with this article.
Prerequisites
To get started with this tutorial, you’ll need the following:
- A free Twilio account (sign up with this link and get $10 in free credit when you upgrade your account)
- A Twilio phone number
- A pay connector (this is the bridge to your payment processor - Twilio has integrations with several processors such as Stripe, Braintree, etc. If you’re not set up with one of these processors yet, …

Twilio empowers you to build applications using phone numbers, text messaging, and voice calling. You can test these phone network based applications using any phone and phone number, but how do you test these applications without a phone? Maybe you're wondering, why not use your phone, which I'll get to later, but first how?!
Twilio Dev Phone to the rescue
What is the Twilio Dev Phone
The Twilio Dev Phone is a tool built on top of Twilio products that will let you send and receive phone calls and text messages from the browser. The Dev Phone is an open-source project on GitHub so feel free to read the source code and contribute to it. You can learn more about the Twilio Dev Phone in the docs.
Why use Twilio Dev Phone
As promised, here are some good scenarios when you'd want to use the Twilio Dev Phone instead …

It’s important to keep up to date with high-impact bills in your state and across the nation. However, tracking bills and monitoring their status can be difficult if you don’t know where to look.
By utilizing the LegiScan API and Twilio’s Programmable Messaging API, you can create an SMS bill-tracking bot that will search for bills relevant to keywords that you designate within a few guided messages.
LegiScan is a United States legislation tracking and information service with an API that can be used to serve JSON data of a specific or multiple legislation. The free API can search for relevant legislation on both a state and federal level with a generous monthly query limit of 30,000 requests.
Check out the bot in action!
Prerequisites
To follow along with this tutorial, you will need the following:
- A free or paid Twilio account. If you are new to Twilio, click …

You can quickly and intuitively send emails using the FluentEmail library for .NET, but once you send many different emails in your project, you have to be able to organize your email templates in a good way to reuse content and enforce consistency in terms of format and design. Luckily, Razor Layouts can help you reuse parts of your templates like headers and footers.
Prerequisites
You will need the following for your development environment:
- Git CLI
- a .NET IDE (Visual Studio, VS Code with C# plugin, JetBrains Rider, or any editor of your choice)
- .NET 6 SDK (earlier and newer versions should work too)
You can find the source code of this tutorial in this GitHub repository.
Set up an SMTP server
To be able to send emails at scale, you'll need an email sending service like the SendGrid Email API, but for …

Emojis and slang have, not only different nuances, but vastly different interpretations between groups of people. For instance, do your coworkers misappropriate the 🙂 emoji? How is it that 🙃 has more positive sentiment than 🙂?
In this tutorial, you will build a sentiment analyzer with Python and Twilio SMS using Urban Dictionary as a reference for the most recent slang.
Prerequisites
To continue with this tutorial, you will need:
- Python 3.6 or higher installed on your machine.
- A Twilio account. If you haven’t yet, sign up for a free Twilio trial.
- ngrok installed on your machine. ngrok is a useful tool for connecting your local server to a public URL. You can sign up for a free account. Learn how to install ngrok here.
- A phone number to test this project.
Obtain a Twilio Phone Number
If you haven’t obtained a phone number from Twilio already, …

Sending out newsletters is a great way to keep your audience up-to-date on the latest news. There are existing newsletter products like SendGrid Email Marketing, however, in a scenario where the client demands more customization, building a newsletter app yourself using the SendGrid Email API is a great alternative.
The advantage of building your own newsletter application is that you can control the nuts and bolts of the system and still maximize deliverability and measure engagement with SendGrid.
In this tutorial, you will learn how to build a newsletter app using ASP.NET Core Razor Pages and SendGrid.
Solution Overview
Every newsletter application involves two parties: the subscriber of the newsletter, and the author of the newsletter.
The subscriber's journey goes like this: The soon-to-be subscriber fills out a form to subscribe that includes their email address and other details (depending on your business needs). When the subscriber submits the …

Nous voilà dans la seconde partie de notre guide. La partie 1 vous a permis de comprendre le vocabulaire, la réglementation et les bonnes pratiques de l’industrie du SMS.
On l’a vu, le SMS est un univers complexe : type de ressource à utiliser, gestion du consentement, encodage, segments, débit maximum, spam etc.
Heureusement, Twilio vous permet de mettre à l’échelle vos envois de SMS facilement, et ce dans le monde entier grâce aux Messaging Services.
Les Messaging Services ont été conçus pour simplifier l’implémentation de vos envois de SMS.
Les principales fonctionnalités du Messaging Service sont :
- Configurer un Alpha Sender ID
- Configurer les ressources à utiliser pour les pays d’expédition grâce aux Country Geo Match
- Gérer l’Opt-Out
- Distribuer le trafic sur plusieurs ressources : Scaler
- Utiliser le smart encoding
- etc.
Allez, passons aux choses sérieuses, mettons en place notre premier messaging service !
Nous allons dans un …