Welcome to Bandwidth's Developer Docs Welcome to Bandwidth's Developer Docs Click and play around to learn more about Bandwidth's APIs



curl js c# ruby python java php

Send a message

var body = new BandwidthMessaging.MessageRequest({ "applicationId" : applicationId , "to" : [ "+19999999999" ], "from" : "+18888888888" , "text" : "The quick brown fox jumps over a lazy dog." }); var response = await messagingController.createMessage(msgUserId, body); console .log(response);

MessageRequest msgReq = new MessageRequest(); List<String> toNumbers = new ArrayList<>(); toNumbers.add( "+19999999999" ); msgReq.setTo( toNumbers ); msgReq.setFrom( "+18888888888" ); msgReq.setApplicationId( "1-2-3" ); msgReq.setText( "Hello World" ); try { ApiResponse<BandwidthMessage> response = msgController.createMessage(accountId, messageRequest); System.out.println(response.getResult().getId()); } catch (ApiException | IOException e){ }

MessageRequest msgRequest = new MessageRequest(); msgRequest.ApplicationId = applicationId; msgRequest.From = "+18888888888" ; msgRequest.To = new string [ 1 ] { "9199199999" }; msgRequest.Text = "The quick brown fox jumps over a lazy dog." ; msgController.CreateMessage(msgUserId, msgRequest);

account_id = "1" body = MessageRequest.new body.application_id = "1-2-3" body.to = [ "+17777777777" ] body.from = "+18888888888" body.text = "Hello from Bandwidth" result = message_controller.create_message(account_id, :body => body)

curl -X POST \ --url 'https://messaging.bandwidth.com/api/v2/users/{accountId}/messages' \ -u '{apiToken}:{apiSecret}' \ -H 'Content-type: application/json' \ --data-raw ' { "to" : ["+12345678902"], "from" : "+12345678901", "text" : "Hey, check this out!", "applicationId" : "93de2206-9669-4e07-948d-329f4b722ee2", "tag" : "test message" } '

account_id = "123" body = MessageRequest() body.application_id = "1-d-b" body.to = [ "+17777777777" ] body.mfrom = "+18888888888" body.text = "Greetings!" result = messaging_client.create_message(account_id, body=body)

$body = new BandwidthLib\Messaging\Models\MessageRequest(); $body->applicationId = "93de2206-9669-4e07-948d-329f4b722ee2" ; $body->to = array ( "+12345678902" ); $body->from = "+12345678901" ; $body->text = "Hey, check this out!" ; $response = $messagingClient->createMessage($messagingAccountId, $body);

Make a call

var body = new BandwidthVoice.ApiCreateCallRequest({ "from" : "+19999999999" , "to" : "+18888888888" , "applicationId" : "123" , "answerUrl" : "https://test.com" , "answerMethod" : "POST" , "callTimeout" : 30 }); var response = await voiceController.createCall(accountId, body); console .log(response);

ApiCreateCallRequest callRequest = new ApiCreateCallRequest(); callRequest.setApplicationId( "3-d-4-b-5" ); callRequest.setFrom( "+17777777777" ); callRequest.setTo( "+19999999999" ); callRequest.setAnswerUrl( "https://test.com" ); try { ApiResponse<ApiCallResponse> response = voiceController.createCall(accountId, callRequest); System.out.println(response.getResult().getCallId()); } catch (IOException | ApiException e) { }

callRequest.ApplicationId = "3-d-4-b-5" ; callRequest.To= "+19999999999" ; callRequest.AnswerUrl= "https://test.com" ; callRequest.From= "+17777777777" ; voiceController.CreateCall(accountId, callRequest);

account_id = '1' body = ApiCreateCallRequest.new body.from = '+16666666666' body.to = '+17777777777' body.answer_url = 'https://test.com' body.application_id = '3-d-4-b-5' result = voice_client.create_call(account_id, :body => body)

curl -X POST \ --url 'https://voice.bandwidth.com/api/v2/accounts/{accountId}/calls' \ -u '{username}:{password}' \ -H 'Content-type: application/json' \ --data-raw ' { "from" : "+19195551212", "to" : "+19195551313", "answerUrl" : "http://www.myapp.com/hello", "applicationId" : "7fc9698a-b04a-468b-9e8f-91238c0d0086" }'

account_id = "123" body = ApiCreateCallRequest() body.mfrom = "+17777777777" body.to = "+16666666666" body.application_id = "3-d-4-b-5" body.answer_url = "https://test.com" result = voice_client.create_call(account_id, body=body)

$body = new BandwidthLib\Voice\Models\ApiCreateCallRequest(); $body->from = "+15554442222" ; $body->to = "+15554443333" ; $body->answerUrl = "https://test.com" ; $body->applicationId = "3-6-4-a" ; $response = $voiceClient->createCall($accountId, $body);

Buy a telephone number