SDK in Go for the CALLR API.
Works with Go 1.11+ (this is a go module), using standard packages only.
import callr "github.com/THECALLR/sdk-go"
func main() {
// use Api Key Auth (recommended) - use the customer portal to generate keys
api := callr.NewWithAPIKeyAuth("key")
result, err := api.Call("method", params...)
target := map[string]interface{}{
"number": "+33123456789",
"timeout": 30,
}
messages := []interface{}{
131,
132,
"TTS|TTS_EN-GB_SERENA|Hello world! how are you ? I hope you enjoy this call. good bye."
}
options := map[string]interface{}{
"cdr_field": "userData",
"cli": "BLOCKED",
"loop": 2,
}
result, err := api.Call("calls.broadcast_1", target, messages, options)
target := map[string]interface{}{
"number": "+33123456789",
"timeout": 30,
}
messages := []interface{}{
131,
132,
134,
}
result, err := api.Call("calls.broadcast_1", target, messages, nil)
Method
Objects
options := map[string]interface{}{
"url": "http://yourdomain.com/realtime_callback_url",
}
result, err := api.Call("apps.create", "REALTIME10", "Your app name", options)
Method
Objects
target := map[string]interface{}{
"number": "+33132456789",
"timeout": 30,
}
callOptions := map[string]interface{}{
"cdr_field": "42",
"cli": "BLOCKED",
}
result, err := api.Call("calls.realtime", "appHash", target, callOptions)
Method
Objects
result, err := api.Call("apps.assign_did", "appHash", "DID ID")
Method
Objects
result, err := api.Call("sms.send", "SMS", "+33123456789", "Hello, world", nil)
Method
Your sender must have been authorized and respect the sms_sender format
result, err := api.Call("sms.send", "Your Brand", "+33123456789", "Hello world!", nil)
Method
result, err := api.Call("sms.send", "", "+33123456789", "Hello world!", nil)
Method
optionSMS := map[string]interface{}{
"force_encoding": "GSM",
}
result, err := api.Call("sms.send", "", "+33123456789", "Hello world!", optionSMS)
Method
Objects
var text bytes.Buffer
text.WriteString("Some super mega ultra long text to test message longer than 160 characters ")
text.WriteString("Some super mega ultra long text to test message longer than 160 characters ")
text.WriteString("Some super mega ultra long text to test message longer than 160 characters")
result, err := api.Call("sms.send", "SMS", "+33123456789", text.String(), nil)
Method
optionSMS := map[string]interface{}{
"nature": "ALERTING",
}
result, err := api.Call("sms.send", "SMS", "+33123456789", "Hello world!", optionSMS)
Method
Objects
optionSMS := map[string]interface{}{
"user_data": "42",
}
result, err := api.Call("sms.send", "SMS", "+33123456789", "Hello world!", optionSMS)
Method
Objects
optionSMS := map[string]interface{}{
"webhook": map[string]interface{}{
"endpoint":"http://yourdomain.com/webhook_endpoint",
},
}
result, err := api.Call("sms.send", "SMS", "+33123456789", "Hello world!", optionSMS)
Method
Objects
Do not set a sender if you want to receive replies - we will automatically use a shortcode.
optionSMS := map[string]interface{}{
"webhook": map[string]interface{}{
"endpoint":"http://yourdomain.com/webhook_endpoint",
},
}
result, err := api.Call("sms.send", "", "+33123456789", "Hello world!", optionSMS)
Method
Objects
result, err := api.Call("sms.get", "SMSHASH")
Method
Objects
result, err := api.Call("did/areacode.countries")
Method
Objects
result, err := api.Call("did/areacode.get_list", "US", nil)
Method
Objects
result, err := api.Call("did/areacode.types", "US")
Method
Objects
result, err := api.Call("did/store.buy_order", "OrderToken")
Method
Objects
result, err := api.Call("did/store.cancel_order", "OrderToken")
Method
result, err := api.Call("did/store.cancel_subscription", "DID ID")
Method
result, err := api.Call("did/store.get_quota_status")
Method
Objects
result, err := api.Call("did/store.get_quote", 0, "GOLD", 1)
Method
*Objects/
result, err := api.Call("did/store.reserve", 0, "GOLD", 1, "RANDOM")
Method
Objects
result, err := api.Call("did/store.view_order", "OrderToken")
Method
Objects
result, err := api.Call("media/library.get_list", nil)
Method
result, err := api.Call("media/library.create", "name")
Method
mediaID := 0
result, err := api.Call("media/library.set_content_from_file", mediaID, "imported temporary file name")
Method
mediaID := 0
result, err := api.Call("media/tts.set_content", mediaID, "Hello world!", "TTS-EN-GB_SERENA", nil)
Method