Skip to content

jmulford-bw/bandwidth.github.io

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

{% raw %}

Try before you buy: How well does your software communicate?

Try before you buy: How well does your software communicate?

Take a look at our code samples below. If your app would benefit from text messaging or dependable phone call capability, look no further. We can solve your problem just like we’ve done for everyone from application start-ups and traditional telecom companies to some of the most demanding Internet giants in the business. Have a look around or Learn more.


Messaging icon Messaging

Communication at its most basic. Adding SMS or MMS is a snap.

Learn more

Voice icon Voice

“Watson, come here—I need Bandwidth!” You can say stuff like that once you add calling.

Learn more

Phone Numbers icon Numbers

We’ve got your number. In fact, we have as many of them as you want.

Learn more
curl js c# ruby python

{% endraw %}

Send a message

client.Message.send({
    from : "+19195551212",
    to   : "+19195551213",
    text : "What is cooler than a unicorn that can shoot lasers? This test message, thats what!"
})
.then(function(message){
    console.log(message.id);
});
var message = await client.Message.SendAsync(new MessageData {
    From = "+19195551212",
    To = "+19195551213",
    Text = "What is cooler than a unicorn that can shoot lasers? This test message, thats what!"
});
message = Message.create(client, {
    :from => "+19195551212",
    :to   => "+19195551213",
    :text => "Thank you for subscribing to Unicorn Enterprises!"
})
curl -v -X POST https://api.catapult.inetwork.com/v1/users/{userId}/messages \
    -u {token}:{secret} \
    -H "Content-type: application/json" \
    -d \
    '
    {
        "from" : "+19195551212",
        "to"   : "+19195551213",
        "text" : "What is cooler than a unicorn that can shoot lasers? This test message, thats what!"
    }'
message_id = messaging_api.send_message(
  from_ = '+19195551212',
  to    = '+19195551213',
  text  = 'What is cooler than a unicorn that can shoot lasers? This test message, thats what!')
print(message_id)
# m-messageId

Make a call

client.Call.create({
    from : "+19195551213",
    to   : "+19195551212"
})
.then(function (call) {
    console.log(call.id);
})
var call = await client.Call.CreateAsync(new CreateCallData{
    From = "+19195551213",
    To   = "+19195551212"
});
call = Call.create(client, {
  :from => "+19195551213",
  :to   => "+19195551212"
})
curl -v -X POST https://api.catapult.inetwork.com/v1/users/{userId}/calls \
    -u {token}:{secret} \
    -H "Content-type: application/json" \
    -d \
    '
    {
        "from" : "+19195551213",
        "to"   : "+19195551212"
    }'
call_id = voice_api.create_call(
  from_        = '+1234567890',
  to           = '+1234567891'
)
print(call_id)
## c-abc123

Buy a telephone number

curl -v -X POST  https://api.catapult.inetwork.com/v1/availableNumbers/local?city=Cary&state=NC&quantity=2 \
  -u {token}:{secret} \
  -H "Content-type: application/json"
// Search available local phone numbers with area code 910
client.AvailableNumber.search("local", { areaCode : "910", quantity : 1 })
.then(function (numbers) {
    return client.PhoneNumber.create({
        number        : numbers[0].number,
        name          : "My 910 Number",
        applicationId : "a-1234"
    });
})
.then(function (number) {
    console.log(number.id);
});
var results = await client.AvailableNumber.SearchLocalAsync(new LocalNumberQuery{ AreaCode = "910", Quantity = 1});
var number = await client.PhoneNumber.CreateAsync(new CreatePhoneNumberData {
    Number        = results[0].number,
    Name          = "My 910 Number",
    ApplicationId = "a-1234"
});
numbers = AvailableNumber.search_local(client, {:area_code => "910", :quantity => 1})
puts("Found numbers: #{(numbers.map {|n| n[:number]}).join(', ')}")
number = PhoneNumber.create(client, {:number => numbers[0][:number]})
puts("Now you are owner of number #{number.number} (id #{number.id})")
numbers     = account_api.search_available_local_numbers(area_code = '910', quantity = 3)
my_number   = api.create_phone_number(numbers[0]['number'])

print(my_number)
#+19104440230

{% raw %}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script> $(document).ready(function landing(){ if ($(window).width() >= 980) { // Adding classes for sms, voice and pns $('#send-a-message').nextUntil('h3').addClass('smstut'); $('#send-a-message').addClass('smstut'); $('#make-a-call').nextUntil('h3').addClass('voicetut'); $('#make-a-call').addClass('voicetut'); $('#buy-a-telephone-number').nextUntil('div').addClass('pntut'); $('#buy-a-telephone-number').addClass('pntut'); // Access to parent div on this page only $('#hero').parent().addClass('landingpage'); // Setting default language $('.lang-bash').parent().addClass('active'); // Toggle between languages $('code').not('.lang-bash').parent().hide(); $('li pre').show(); $('.trigger').click(function() { $('code').parent().removeClass('active'); $('.' + $(this).data('rel')).parent().addClass('active'); if ($('#voicecard').hasClass('active')){ tuts.hide(); $('.voicetut.active').show(); } if ($('#smscard').hasClass('active')){ tuts.hide(); $('.smstut.active').show(); } else if ($('#pncard').hasClass('active')){ tuts.hide(); $('.pntut.active').show(); } }); // Showing proper code sample or sms, voice and pns var tuts = $('.voicetut, .smstut, .pntut'); tuts.hide(); // Disable buttons on cards that are inactive $('.devCards.active').find('.fulltut').prop("disabled",false); $('#smsexpand').click(function(){ tuts.hide(); $('.smstut.active').show(); $('.devCards').removeClass('active'); $(this).parent().addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('#voiceexpand').click(function(){ tuts.hide(); $('.voicetut.active').show(); $('.devCards').removeClass('active'); $(this).parent().addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('#pnexpand').click(function(){ tuts.hide(); $('.pntut.active').show(); $('.devCards').removeClass('active'); $(this).parent().addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('.smstut.active').show(); // Mobile } else { // Adding classes for sms, voice and pns $('#send-a-message').nextUntil('h3').addClass('smstut'); $('#send-a-message').addClass('smstut'); $('#make-a-call').nextUntil('h3').addClass('voicetut'); $('#make-a-call').addClass('voicetut'); $('#buy-a-telephone-number').nextUntil('div').addClass('pntut'); $('#buy-a-telephone-number').addClass('pntut'); // Access to parent div on this page only $('#hero').parent().addClass('landingpage'); // Setting default language $('.lang-bash').parent().addClass('active'); // Toggle between languages $('code').not('.lang-bash').parent().hide(); $('li pre').show(); $('.trigger').click(function() { $('code').parent().removeClass('active'); $('.' + $(this).data('rel')).parent().addClass('active'); if ($('#voicecard').hasClass('active')){ tuts.hide(); $('.voicetut.active').show(); } if ($('#smscard').hasClass('active')){ tuts.hide(); $('.smstut.active').show(); } else if ($('#pncard').hasClass('active')){ tuts.hide(); $('.pntut.active').show(); } }); // Showing proper code sample or sms, voice and pns var tuts = $('.voicetut, .smstut, .pntut'); tuts.hide(); // Disable buttons on cards that are inactive $('.devCards.active').find('.fulltut').prop("disabled",false); $('#smscard').click(function(){ tuts.hide(); $('.smstut.active').show(); $('.devCards').removeClass('active'); $(this).addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('#voicecard').click(function(){ tuts.hide(); $('.voicetut.active').show(); $('.devCards').removeClass('active'); $(this).addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('#pncard').click(function(){ tuts.hide(); $('.pntut.active').show(); $('.devCards').removeClass('active'); $(this).addClass('active'); $('.devCards').find('.fulltut').prop("disabled",true); $('.devCards.active').find('.fulltut').prop("disabled",false); }); $('.smstut.active').show(); } }); </script>

{% endraw %}

About

Sample code using Bandwidth Voice and Messaging APIs

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 44.3%
  • HTML 21.5%
  • JavaScript 21.1%
  • Shell 12.0%
  • Makefile 1.1%