Socket
Socket
Sign inDemoInstall

github.com/dwb/twilio

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/dwb/twilio

Package twilio provides support for interacting with Twilio REST API This example shows the usage of twilio package. You can get your AccountSid and AuthToken on Account Dashboard page.


Version published

Readme

Source

Twilio

Build Status

Simple Twilio API wrapper in Go.

Usage

As usual you can go get the twilio package by issuing:

$ go get github.com/subosito/twilio

Then you can use it on your application:

package main

import (
	"fmt"
	"github.com/subosito/twilio"
)

func main() {
	// Common stuffs
	AccountSid := "ac650108548e09aC2eed18ddb850c20b9"
	AuthToken := "2ecaf74387cbb28456aad6fb57b5ad682"
	from := "+15005550006"
	to := "+62801234567"
	callbackUrl := "http://subosito.com/"

	// Initialize twilio client
	t := twilio.NewTwilio(AccountSid, AuthToken)

	// You can set custom Transport, eg: you're using `appengine/urlfetch` on Google's appengine
	// c := appengine.NewContext(r) // r is a *http.Request
	// t.Transport = &urlfetch.Transport{Context: c}

	// Send SMS
	params := twilio.SMSParams{StatusCallback: callbackUrl}
	s, err := t.SendSMS(from, to, "Hello Go!", params)

	// or, make a voice call
	// params := twilio.CallParams{Url: callbackUrl}
	// s, err := t.MakeCall(from, to, params)

	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Printf("%+v\n", s)
	return
}

Resources

Documentation: http://godoc.org/github.com/subosito/twilio

FAQs

Last updated on 25 Aug 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc