### Install voicebip-go with go get Source: https://docs.voicebip.com/integrations/sdks/go Installation command for the Go SDK module. Requires Go 1.22+. ```bash go get github.com/voicebip/voicebip-go ``` -------------------------------- ### Go GET Call Example Source: https://docs.voicebip.com/api/calls/get-call Go example using net/http to make a GET request. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/calls/call_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK Example for Get Knowledge Base Document Source: https://docs.voicebip.com/api/knowledge-bases/get-knowledge-base-document Go example using the net/http package to send a GET request to the VoiceBip API endpoint for a knowledge base document. Sets the Authorization header and prints the response. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/knowledge-bases/kb_id/documents/doc_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Java SDK example for starting a campaign Source: https://docs.voicebip.com/api/campaigns/start-campaign Uses Unirest to send a POST request to the start campaign endpoint with a Bearer token. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.voicebip.com/v1/campaigns/campaign_id/start") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### List Templates - Go SDK Example Source: https://docs.voicebip.com/api/templates/list-templates Go example using net/http to GET /v1/templates. Requires an Authorization header with a bearer token. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/templates" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby SDK example for starting a campaign Source: https://docs.voicebip.com/api/campaigns/start-campaign Uses net/http to POST to the start campaign endpoint with a Bearer token and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/campaigns/campaign_id/start") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Go SDK Example for Get Workspace Subscription Source: https://docs.voicebip.com/api/workspace/get-subscription Go example using net/http to GET the workspace subscription endpoint with Bearer token authentication. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/workspace/subscription" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### PHP SDK example for starting a campaign Source: https://docs.voicebip.com/api/campaigns/start-campaign Uses GuzzleHttp to POST to the start campaign endpoint with a Bearer token and echoes the response body. ```php request('POST', 'https://api.voicebip.com/v1/campaigns/campaign_id/start', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK Example for Get Conversation Source: https://docs.voicebip.com/api/messages/get-conversation Go example using net/http to GET a conversation with bearer token authentication. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/conversations/conversation_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### C# SDK example for starting a campaign Source: https://docs.voicebip.com/api/campaigns/start-campaign Uses RestSharp to send a POST request to the start campaign endpoint with a Bearer token. ```csharp using RestSharp; var client = new RestClient("https://api.voicebip.com/v1/campaigns/campaign_id/start"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### JavaScript SDK example for starting a campaign Source: https://docs.voicebip.com/api/campaigns/start-campaign Uses fetch to POST to the start campaign endpoint with a Bearer token and logs the response or error. ```javascript const url = 'https://api.voicebip.com/v1/campaigns/campaign_id/start'; const options = {method: 'POST', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Ruby SDK Example for Get Workspace Subscription Source: https://docs.voicebip.com/api/workspace/get-subscription Ruby example using net/http to GET the workspace subscription endpoint with Bearer token authentication. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/workspace/subscription") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### JavaScript SDK Example for Get Knowledge Base Document Source: https://docs.voicebip.com/api/knowledge-bases/get-knowledge-base-document JavaScript example using the fetch API to make a GET request to the VoiceBip API endpoint for a knowledge base document. Includes error handling with try/catch. ```javascript const url = 'https://api.voicebip.com/v1/knowledge-bases/kb_id/documents/doc_id'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Ruby SDK Example for Get Knowledge Base Document Source: https://docs.voicebip.com/api/knowledge-bases/get-knowledge-base-document Ruby example using net/http to perform a GET request to the VoiceBip API endpoint for a knowledge base document. Sets the Authorization header and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/knowledge-bases/kb_id/documents/doc_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Go SDK GET request Source: https://docs.voicebip.com/api/knowledge-bases/list-knowledge-base-documents Go example using net/http to make a GET request to the knowledge base documents endpoint. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/knowledge-bases/kb_id/documents" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### List Templates - Ruby SDK Example Source: https://docs.voicebip.com/api/templates/list-templates Ruby example using net/http to GET /v1/templates. Requires an Authorization header with a bearer token. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/templates") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Ruby GET Call Example Source: https://docs.voicebip.com/api/calls/get-call Ruby example using net/http with SSL to fetch call details. Prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/calls/call_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Java SDK Example for Get Knowledge Base Document Source: https://docs.voicebip.com/api/knowledge-bases/get-knowledge-base-document Java example using Unirest to send a GET request to the VoiceBip API endpoint for a knowledge base document. Sets the Authorization header and retrieves the response as a string. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.voicebip.com/v1/knowledge-bases/kb_id/documents/doc_id") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Ruby SDK Example for Get Knowledge Base Source: https://docs.voicebip.com/api/knowledge-bases/get-knowledge-base Uses net/http to send a GET request with an Authorization header. Prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/knowledge-bases/kb_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Go SDK Example for GET /v1/auth/me Source: https://docs.voicebip.com/api/system/get-auth-me Go code using net/http to make a GET request with Bearer token authorization and print the response. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/auth/me" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Swift SDK Example for Get Knowledge Base Document Source: https://docs.voicebip.com/api/knowledge-bases/get-knowledge-base-document Swift example using URLSession to perform a GET request to the VoiceBip API endpoint for a knowledge base document. Sets the Authorization header and handles the response asynchronously. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.voicebip.com/v1/knowledge-bases/kb_id/documents/doc_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### List Templates - Java SDK Example Source: https://docs.voicebip.com/api/templates/list-templates Java example using Unirest to GET /v1/templates. Requires an Authorization header with a bearer token. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.voicebip.com/v1/templates") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### List Templates - Swift SDK Example Source: https://docs.voicebip.com/api/templates/list-templates Swift example using URLSession to GET /v1/templates. Requires an Authorization header with a bearer token. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.voicebip.com/v1/templates")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Go SDK example for starting a campaign Source: https://docs.voicebip.com/api/campaigns/start-campaign Uses net/http to send a POST request to the start campaign endpoint with a Bearer token and prints the response. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/campaigns/campaign_id/start" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### PHP GET Call Example Source: https://docs.voicebip.com/api/calls/get-call PHP example using GuzzleHttp client to send a GET request. Requires Guzzle installed via Composer. ```php request('GET', 'https://api.voicebip.com/v1/calls/call_id', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK example Source: https://docs.voicebip.com/api/compliance/accept-dpa Go example using net/http to POST to the DPA accept endpoint. Includes setting headers and reading the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/dpa/accept" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### List numbers with PHP Guzzle Source: https://docs.voicebip.com/api/numbers/list-numbers PHP example using Guzzle HTTP client to GET the list numbers endpoint. Requires Guzzle installed via Composer. ```php request('GET', 'https://api.voicebip.com/v1/numbers', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### List Templates - JavaScript SDK Example Source: https://docs.voicebip.com/api/templates/list-templates JavaScript example using fetch to GET /v1/templates. Requires an Authorization header with a bearer token. ```javascript const url = 'https://api.voicebip.com/v1/templates'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Get Message API - PHP Example Source: https://docs.voicebip.com/api/messages/get-message PHP example using GuzzleHttp to send a GET request to the Get Message endpoint with a Bearer token, echoing the response body. ```php request('GET', 'https://api.voicebip.com/v1/messages/id', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### List Templates - PHP SDK Example Source: https://docs.voicebip.com/api/templates/list-templates PHP example using GuzzleHttp to GET /v1/templates. Requires an Authorization header with a bearer token. ```php request('GET', 'https://api.voicebip.com/v1/templates', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Get Message API - Java Example Source: https://docs.voicebip.com/api/messages/get-message Java example using Unirest to send a GET request to the Get Message endpoint with a Bearer token, returning the response as a string. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.voicebip.com/v1/messages/id") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Signup SDK Code in Go Source: https://docs.voicebip.com/api/system/signup Go example using net/http to POST to the signup endpoint. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/auth/signup" payload := strings.NewReader("{\n \"email\": \"founder@startup.ng\",\n \"password\": \"password\",\n \"company_name\": \"Acme Robotics\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Message API - Ruby Example Source: https://docs.voicebip.com/api/messages/get-message Ruby example using net/http to send a GET request to the Get Message endpoint with a Bearer token, printing the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/messages/id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Swift SDK Example for Get Conversation Source: https://docs.voicebip.com/api/messages/get-conversation Swift example using URLSession to GET a conversation with bearer token authentication. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.voicebip.com/v1/conversations/conversation_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### C# SDK Example for Get Conversation Source: https://docs.voicebip.com/api/messages/get-conversation C# example using RestSharp to GET a conversation with bearer token authentication. ```csharp using RestSharp; var client = new RestClient("https://api.voicebip.com/v1/conversations/conversation_id"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### PHP SDK Example for Get Knowledge Base Source: https://docs.voicebip.com/api/knowledge-bases/get-knowledge-base Uses GuzzleHttp to send a GET request with an Authorization header. Echoes the response body. ```php request('GET', 'https://api.voicebip.com/v1/knowledge-bases/kb_id', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Python SDK example for starting a campaign Source: https://docs.voicebip.com/api/campaigns/start-campaign Uses the requests library to POST to the start campaign endpoint with a Bearer token and prints the JSON response. ```python import requests url = "https://api.voicebip.com/v1/campaigns/campaign_id/start" headers = {"Authorization": "Bearer "} response = requests.post(url, headers=headers) print(response.json()) ``` -------------------------------- ### PHP SDK Example for Get Conversation Source: https://docs.voicebip.com/api/messages/get-conversation PHP example using Guzzle to GET a conversation with bearer token authentication. ```php request('GET', 'https://api.voicebip.com/v1/conversations/conversation_id', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Java SDK Example for Get Conversation Source: https://docs.voicebip.com/api/messages/get-conversation Java example using Unirest to GET a conversation with bearer token authentication. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.voicebip.com/v1/conversations/conversation_id") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Ruby SDK Example for Get Conversation Source: https://docs.voicebip.com/api/messages/get-conversation Ruby example using net/http to GET a conversation with bearer token authentication. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/conversations/conversation_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Create API key - Go SDK example Source: https://docs.voicebip.com/api/api-keys/create-api-key Go example using net/http to create an API key. Sends a POST request with an empty JSON body and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/api-keys" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### List Templates - Python SDK Example Source: https://docs.voicebip.com/api/templates/list-templates Python example using the requests library to GET /v1/templates. Requires an Authorization header with a bearer token. ```python import requests url = "https://api.voicebip.com/v1/templates" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Go SDK example for listing API keys Source: https://docs.voicebip.com/api/api-keys/list-api-keys Uses net/http to send a GET request with bearer token authentication and prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/api-keys" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### JavaScript SDK Example for Get Conversation Source: https://docs.voicebip.com/api/messages/get-conversation JavaScript example using fetch to GET a conversation with bearer token authentication. ```javascript const url = 'https://api.voicebip.com/v1/conversations/conversation_id'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Complete Knowledge Base Document - Go SDK Source: https://docs.voicebip.com/api/knowledge-bases/complete-knowledge-base-document Go example using net/http to POST to the complete endpoint. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/knowledge-bases/kb_id/documents/doc_id/complete" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Python SDK Example for Get Conversation Source: https://docs.voicebip.com/api/messages/get-conversation Python example using requests to GET a conversation with bearer token authentication. ```python import requests url = "https://api.voicebip.com/v1/conversations/conversation_id" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Create Knowledge Base with Go net/http Source: https://docs.voicebip.com/api/knowledge-bases/create-knowledge-base Go example using the standard net/http package to send a POST request. Requires a valid bearer token and error handling is omitted for brevity. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/knowledge-bases" payload := strings.NewReader("{\n \"name\": \"name\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Swift GET Call Example Source: https://docs.voicebip.com/api/calls/get-call Swift example using URLSession to perform a GET request. Prints response or error. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.voicebip.com/v1/calls/call_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Get Message API - C# Example Source: https://docs.voicebip.com/api/messages/get-message C# example using RestSharp to send a GET request to the Get Message endpoint with a Bearer token, executing the request and storing the response. ```csharp using RestSharp; var client = new RestClient("https://api.voicebip.com/v1/messages/id"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Signup SDK Code in Python Source: https://docs.voicebip.com/api/system/signup Python example using requests to POST to the signup endpoint. ```python import requests url = "https://api.voicebip.com/v1/auth/signup" payload = { "email": "founder@startup.ng", "password": "password", "company_name": "Acme Robotics" } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` -------------------------------- ### Get Message API - Go Example Source: https://docs.voicebip.com/api/messages/get-message Go example using net/http to send a GET request to the Get Message endpoint with a Bearer token, printing the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/messages/id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK Example for Create WebRTC Offer Source: https://docs.voicebip.com/api/web-rtc/create-web-rtc-offer Uses net/http to POST to the WebRTC offer endpoint. Requires an Authorization bearer token. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/webrtc/offer" payload := strings.NewReader("{\n \"agent_id\": \"agt_WX1Y_abcdef123456\",\n \"sdp\": \"sdp\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Message API - Python Example Source: https://docs.voicebip.com/api/messages/get-message Python example using the requests library to send a GET request to the Get Message endpoint with a Bearer token and print the JSON response. ```python import requests url = "https://api.voicebip.com/v1/messages/id" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Java GET Call Example Source: https://docs.voicebip.com/api/calls/get-call Java example using Unirest HTTP library to make a GET request with an Authorization header. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.voicebip.com/v1/calls/call_id") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Go SDK Example Source: https://docs.voicebip.com/api/webhooks/create-webhook-endpoint Creates a webhook endpoint using the net/http package. Requires an API token and the agent ID. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/agents/agent_id/webhooks/endpoints" payload := strings.NewReader("{\n \"url\": \"https://your-server.example.com/webhooks\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Verify Email SDK Example (Go) Source: https://docs.voicebip.com/api/system/verify-email Go example using net/http to POST to the verify-email endpoint. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/auth/verify-email" payload := strings.NewReader("{\n \"token\": \"token\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Configure VoiceBIP client with API key, base URL, and HTTP client Source: https://docs.voicebip.com/integrations/sdks/go Create a client with option.WithAPIKey, option.WithBaseURL (default is https://api.voicebip.com; change for sandbox), and option.WithHTTPClient with a 30-second timeout. Use pk_test_xxx keys for sandbox to avoid real calls and billing. ```go client := voicebip.NewClient( option.WithAPIKey("pk_live_xxx"), option.WithBaseURL("https://api.voicebip.com"), // default; change for sandbox option.WithHTTPClient(&http.Client{Timeout: 30 * time.Second}), ) ``` -------------------------------- ### Get Message API - JavaScript Example Source: https://docs.voicebip.com/api/messages/get-message JavaScript example using fetch to send a GET request to the Get Message endpoint with a Bearer token, handling the response and logging data or errors. ```javascript const url = 'https://api.voicebip.com/v1/messages/id'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Swift SDK example for starting a campaign Source: https://docs.voicebip.com/api/campaigns/start-campaign Uses URLSession to send a POST request to the start campaign endpoint with a Bearer token and prints the response or error. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.voicebip.com/v1/campaigns/campaign_id/start")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Get Message API - Swift Example Source: https://docs.voicebip.com/api/messages/get-message Swift example using URLSession to send a GET request to the Get Message endpoint with a Bearer token, handling the response and printing errors or the HTTP response. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.voicebip.com/v1/messages/id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Swift SDK Example for Get Workspace Subscription Source: https://docs.voicebip.com/api/workspace/get-subscription Swift example using URLSession to GET the workspace subscription endpoint with Bearer token authentication. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.voicebip.com/v1/workspace/subscription")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### C# SDK Example for Get Workspace Subscription Source: https://docs.voicebip.com/api/workspace/get-subscription C# example using RestSharp to GET the workspace subscription endpoint with Bearer token authentication. ```csharp using RestSharp; var client = new RestClient("https://api.voicebip.com/v1/workspace/subscription"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Configuration Source: https://docs.voicebip.com/integrations/sdks/go Shows how to create a Voicebip client with API key, base URL, and custom HTTP client options. ```APIDOC ## Configuration ### Description Creates a new Voicebip client with configuration options. ### Code Example ```go client := voicebip.NewClient( option.WithAPIKey("pk_live_xxx"), option.WithBaseURL("https://api.voicebip.com"), // default; change for sandbox option.WithHTTPClient(&http.Client{Timeout: 30 * time.Second}), ) ``` ### Notes Use `pk_test_xxx` API keys to hit the sandbox — no real calls, no billing. ``` -------------------------------- ### PHP SDK Example for Get Workspace Subscription Source: https://docs.voicebip.com/api/workspace/get-subscription PHP example using GuzzleHttp to GET the workspace subscription endpoint with Bearer token authentication. ```php request('GET', 'https://api.voicebip.com/v1/workspace/subscription', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Java SDK Example for Get Workspace Subscription Source: https://docs.voicebip.com/api/workspace/get-subscription Java example using Unirest to GET the workspace subscription endpoint with Bearer token authentication. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.voicebip.com/v1/workspace/subscription") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Signup SDK Code in Java Source: https://docs.voicebip.com/api/system/signup Java example using Unirest to POST to the signup endpoint. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.voicebip.com/v1/auth/signup") .header("Content-Type", "application/json") .body("{\n \"email\": \"founder@startup.ng\",\n \"password\": \"password\",\n \"company_name\": \"Acme Robotics\"\n}") .asString(); ``` -------------------------------- ### Quick start: create and manage a VoicebipCall Source: https://docs.voicebip.com/integrations/sdks/web Shows how to fetch a scoped token from your server, create a VoicebipCall, listen for state, transcript, ended, and error events, then start, mute, and hang up the call. ```typescript import { VoicebipCall } from '@voicebip/web'; // 1. Get a scoped token from your server const { token, ice_servers, agent_id } = await fetch('/api/voice-token', { method: 'POST', body: JSON.stringify({ agent_id: 'agt_WX1Y_abcdef123456' }), headers: { 'Content-Type': 'application/json' }, }).then((r) => r.json()); // 2. Create and start the call const call = new VoicebipCall({ token, agentId: agent_id, iceServers: ice_servers }); call.on('state', (s) => console.log('state →', s)); call.on('transcript', (t) => console.log(`[${t.role}] ${t.text}`)); call.on('ended', (ms) => console.log('ended after', ms, 'ms')); call.on('error', (e) => console.error(e)); await call.start(); // resolves once connected; rejects on setup error // Later: call.setMuted(true); await call.hangup(); ``` -------------------------------- ### Go SDK example for get balance Source: https://docs.voicebip.com/api/billing/get-balance Go SDK example using the standard net/http package to call the balance endpoint. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/billing/balance" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby SDK example Source: https://docs.voicebip.com/api/compliance/accept-dpa Ruby example using net/http to POST to the DPA accept endpoint. Sets SSL and headers, then prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/dpa/accept") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` -------------------------------- ### JavaScript SDK Example for Get Workspace Subscription Source: https://docs.voicebip.com/api/workspace/get-subscription JavaScript example using fetch to GET the workspace subscription endpoint with Bearer token authentication. ```javascript const url = 'https://api.voicebip.com/v1/workspace/subscription'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Create Agent SDK Code (Go) Source: https://docs.voicebip.com/api/agents/create-agent Go example using net/http to POST to the /v1/agents endpoint. Prints the response status and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/agents" payload := strings.NewReader("{\n \"display_name\": \"display_name\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### C# GET Call Example Source: https://docs.voicebip.com/api/calls/get-call C# example using RestSharp library to execute a GET request. Adds Authorization header and prints response. ```csharp using RestSharp; var client = new RestClient("https://api.voicebip.com/v1/calls/call_id"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Go SDK Example for Agent Playground Source: https://docs.voicebip.com/api/agents/agent-playground Go example using net/http to POST a message to the Agent Playground API. Requires an Authorization token. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.voicebip.com/v1/agents/agent_id/playground" payload := strings.NewReader("{\n \"message\": \"message\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Python SDK Example for Get Workspace Subscription Source: https://docs.voicebip.com/api/workspace/get-subscription Python example using requests library to GET the workspace subscription endpoint with Bearer token authentication. ```python import requests url = "https://api.voicebip.com/v1/workspace/subscription" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### C# SDK example for get balance Source: https://docs.voicebip.com/api/billing/get-balance C# SDK example using RestSharp to call the balance endpoint. Executes a GET request with the Authorization header. ```csharp using RestSharp; var client = new RestClient("https://api.voicebip.com/v1/billing/balance"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Get balance response example Source: https://docs.voicebip.com/api/billing/get-balance Example response body for a successful GET request to the balance endpoint. Shows the workspace_id, balance_kobo (prepaid balance in minor currency units), and currency fields. ```json { "workspace_id": "workspace_id", "balance_kobo": 1, "currency": "NGN" } ``` -------------------------------- ### Ruby SDK example for listing API keys Source: https://docs.voicebip.com/api/api-keys/list-api-keys Uses net/http with SSL to send a GET request with bearer token authentication and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/api-keys") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Signup SDK Code in Ruby Source: https://docs.voicebip.com/api/system/signup Ruby example using net/http to POST to the signup endpoint. ```ruby require 'uri' require 'net/http' url = URI("https://api.voicebip.com/v1/auth/signup") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"email\": \"founder@startup.ng\",\n \"password\": \"password\",\n \"company_name\": \"Acme Robotics\"\n}" response = http.request(request) puts response.read_body ```