Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
github.com/wyc/utwil
utwil is currently under heavy development, so expect breakage.
Documentation can be found at: https://godoc.org/github.com/wyc/utwil
Made with gojson.
In your terminal:
$ go get github.com/wyc/utwil
In your code:
import "github.com/wyc/utwil"
client := utwil.NewClient(AccoutSID, AuthToken)
// type client.SendSMS func(from, to, msg string) (utwil.Message, error)
msg, err := client.SendSMS("+15551231234", "+15553214321", "Hello, world!")
// type client.SendMMS func(from, to, msg, mediaURL string) (utwil.Message, error)
mediaURL := "http://i.imgur.com/sZPem77.png"
body := "Hello, world!"
msg, err := client.SendMMS("+15551231234", "+15553214321", body, mediaURL)
callbackPostURL := fmt.Sprintf(
"http://twimlets.com/forward?PhoneNumber=%s",
"+15559871234",
)
// type client.Call func(from, to, callbackPostURL string) (utwil.Call, error)
call, err := client.Call("+15551231234", "+15553214321", callbackPostURL)
// type client.RecordedCall func(from, to, callbackURL string) (utwil.Call, error)
call, err := client.RecordedCall("+15551231234", "+15553214321", callbackPostURL)
// type client.Lookup func(phoneNumber string) (utwil.Lookup, error)
lookup, err := client.Lookup("+15551231234")
// handle err
fmt.Println(lookup.Carrier.Type) // "mobile", "landline", or "voip"
For more complicated requests, populate the respective XxxxxReq struct
and call the client.SubmitXxxxx(XxxxxReq) (Xxxxx, error)
method:
msgReq := utwil.MessageReq{
From: "+15559871234",
To: "+15551231234",
Body: "Hello, world!",
StatusCallback: "https://post.here.com/when/msg/status/changes.twiml",
}
msg, err := client.SubmitMessage(msgReq)
weekAgo := time.Now().Add(-7 * 24 * time.Hour)
iter := client.Messages(
utwil.SentBeforeYMD(weekAgo),
utwil.To("+15551231234")).Iter()
var msg utwil.Message
for iter.Next(&msg) {
// do something with utwil.Message
}
if iter.Err() != nil {
// handle err
}
iter := client.Calls(
utwil.From("+15551231234"),
utwil.StartedAfter("2015-04-01")).Iter()
var call utwil.Call
for iter.Next(&call) {
// do something with utwil.Call
}
if iter.Err() != nil {
// handle err
}
First, populate env vars TWILIO_ACCOUNT_SID
, TWILIO_AUTH_TOKEN
,
TWILIO_DEFAULT_TO
, TWILIO_DEFAULT_FROM
.
Then run go test
and expect many annoyances to TWILIO_DEFAULT_TO
:
Run go test -test.v
instead if you want more details to the console.
Feel free to request features by opening an issue.
FAQs
Unknown package
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.