All Projects → kevinburke → twilio-go

kevinburke / twilio-go

Licence: MIT license
Twilio Go library

Projects that are alternatives of or similar to twilio-go

fregata
A self hosted REST API for message delivery
Stars: ✭ 19 (-86.03%)
Mutual labels:  twilio
microblog-authy
Microblog application from the Flask Mega-Tutorial with added two-factor push authentication via Authy
Stars: ✭ 26 (-80.88%)
Mutual labels:  twilio
twilio-taskrouter.js
JS SDK v2 for Twilio's TaskRouter skills based routing system.
Stars: ✭ 20 (-85.29%)
Mutual labels:  twilio
wireless-fleet-tracker
Create a Twilio-powered Fleet Tracker that uses off-the-shelf components to track and log: miles driven, hours of uptime and downtime, locations, average speed, and fuel consumption.
Stars: ✭ 21 (-84.56%)
Mutual labels:  twilio
hackathons
A collection of tips and tricks for using Twilio at hackathons
Stars: ✭ 35 (-74.26%)
Mutual labels:  twilio
IEvangelist.VideoChat
Imagine two Twilio SDKs, ASP.NET Core/C#, Angular/TypeScript, SignalR, etc... Yeah, amazing!
Stars: ✭ 66 (-51.47%)
Mutual labels:  twilio
PySMS
Simple Python API that that allows you to send texts via SMTP with a best effort approach and process replies via IMAP
Stars: ✭ 19 (-86.03%)
Mutual labels:  twilio
personal-wealth-portfolio-mgt-bot
WARNING: This repository is no longer maintained ⚠️ This repository will not be updated. This repository will be kept available in read-only mode.
Stars: ✭ 43 (-68.38%)
Mutual labels:  twilio
sms blitz
Send SMS messages through multiple different providers
Stars: ✭ 29 (-78.68%)
Mutual labels:  twilio
wireless-portable-fax
Build a cellular connected portable fax machine
Stars: ✭ 17 (-87.5%)
Mutual labels:  twilio
useful-twilio-functions
A set of useful Twilio Functions.
Stars: ✭ 53 (-61.03%)
Mutual labels:  twilio
jpetstore-kubernetes
Modernize and Extend: JPetStore on IBM Cloud Kubernetes Service
Stars: ✭ 21 (-84.56%)
Mutual labels:  twilio
HotelManagement
🏡 A Hotel Management system in C#
Stars: ✭ 77 (-43.38%)
Mutual labels:  twilio
messages
A python package designed to make sending messages easy and efficient!
Stars: ✭ 38 (-72.06%)
Mutual labels:  twilio
ruby-whatsapp-bots
A repo of WhatsApp bots built in Ruby
Stars: ✭ 18 (-86.76%)
Mutual labels:  twilio
VaporTwilioService
Twilio API provider for all your Vapor needs
Stars: ✭ 19 (-86.03%)
Mutual labels:  twilio
poseparty
A social exercise game you can play while social distancing.
Stars: ✭ 25 (-81.62%)
Mutual labels:  twilio
terraform-provider-twilio
Terraform provider for Twilio. 🌎☎️ Preserved for archaeological fun. Please see the official Twilio TF provider @ https://github.com/twilio/terraform-provider-twilio.
Stars: ✭ 32 (-76.47%)
Mutual labels:  twilio
twilio-chat-demo-android
Chat API Demo Application for Android
Stars: ✭ 64 (-52.94%)
Mutual labels:  twilio
sms-bot
an SMS bot built with Google sheets and Twilio
Stars: ✭ 61 (-55.15%)
Mutual labels:  twilio

twilio-go

A client for accessing the Twilio API with several nice features:

  • Easy-to-use helpers for purchasing phone numbers and sending MMS messages

  • E.164 support, times that are parsed into a time.Time, and other smart types.

  • Finer grained control over timeouts with a Context, and the library uses wall-clock HTTP timeouts, not socket timeouts.

  • Easy debugging network traffic by setting DEBUG_HTTP_TRAFFIC=true in your environment.

  • Easily find calls and messages that occurred between a particular set of time.Times, down to the nanosecond, with GetCallsInRange / GetMessagesInRange.

  • It's clear when the library will make a network request, there are no unexpected latency spikes when paging from one resource to the next.

  • Uses threads to fetch resources concurrently; for example, has methods to fetch all Media for a Message concurrently.

  • Usable, one sentence descriptions of Alerts.

Here are some example use cases:

const sid = "AC123"
const token = "456bef"

client := twilio.NewClient(sid, token, nil)

// Send a message
msg, err := client.Messages.SendMessage("+14105551234", "+14105556789", "Sent via go :) ✓", nil)

// Start a phone call
var callURL, _ = url.Parse("https://kevin.burke.dev/zombo/zombocom.mp3")
call, err := client.Calls.MakeCall("+14105551234", "+14105556789", callURL)

// Buy a number
number, err := client.IncomingNumbers.BuyNumber("+14105551234")

// Get all calls from a number
data := url.Values{}
data.Set("From", "+14105551234")
callPage, err := client.Calls.GetPage(context.TODO(), data)

// Iterate over calls
iterator := client.Calls.GetPageIterator(url.Values{})
for {
    page, err := iterator.Next(context.TODO())
    if err == twilio.NoMoreResults {
        break
    }
    fmt.Println("start", page.Start)
}

A complete documentation reference can be found at godoc.org.

In Production

twilio-go is being used by the following applications:

  • Logrole, an open source Twilio log viewer that's faster than the API.

Using twilio-go in production? Let me know!

Supported API's

The API is unlikely to change, and currently covers these resources:

  • Alerts
  • Applications
  • Calls
  • Conferences
  • Faxes
  • Incoming Phone Numbers
  • Available Phone Numbers
  • Keys
  • Messages
  • Media
  • Monitor
  • Outgoing Caller ID's
  • Pricing
  • Queues
  • Recordings
  • Task Router
    • Activities
    • TaskQueues
    • Workers
    • Workflows
  • Transcriptions
  • Wireless
  • Voice Insights
  • Access Tokens for IPMessaging, Video and Programmable Voice SDK

Error Parsing

If the twilio-go client gets an error from the Twilio API, we attempt to convert it to a rest.Error before returning. Here's an example 404.

&rest.Error{
    Title: "The requested resource ... was not found",
    ID: "20404",
    Detail: "",
    Instance: "",
    Type: "https://www.twilio.com/docs/errors/20404",
    StatusCode: 404
}

Not all errors will be a rest.Error however - HTTP timeouts, canceled context.Contexts, and JSON parse errors (HTML error pages, bad gateway responses from proxies) may also be returned as plain Go errors.

Twiml Generation

There are no plans to support Twiml generation in this library. It may be more readable and maintainable to manually write the XML involved in a Twiml response.

Errata

  • Media URL's used to be returned over HTTP. twilio-go rewrites these URL's to be HTTPS before returning them to you.

  • A subset of Notifications returned code 4107, which doesn't exist. These notifications should have error code 14107. We rewrite the error code internally before returning it to you.

  • The only provided API for filtering calls or messages by date grabs all messages for an entire day, and the day ranges are only available for UTC. Use GetCallsInRange or GetMessagesInRange to do timezone-aware, finer-grained date filtering.

  • You can get Alerts for a given Call or MMS by passing ResourceSid=CA123 as a filter to Alerts.GetPage. This functionality is not documented in the API.

Consulting

I'm available for hire, for Twilio work or general-purpose engineering. For more on what I can do for your company, see here: https://burke.services/twilio.html. Contact me: [email protected]

Donating

Donations free up time to review pull requests, respond to bug reports, and add new features. In the absence of donations there are no guarantees about timeliness for reviewing or responding to proposed changes; I don't get paid by anyone else to work on this. You can send donations via Github's "Sponsor" mechanism or Paypal's "Send Money" feature to [email protected]. Donations are not tax deductible in the USA.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].