cURL
PHP
Node.js
Python
Go
Java
C#
C++
curl -X POST "https://api.veritakibi.com/v1/whatsapp/conversations/<id> /summary" \
-H "Authorization: Bearer <YOUR_API_KEY> " \
-H "Content-Type: application/json" \
-d '{
"agent": {
"external_id": "<VALUE> ",
"name": "<VALUE> "
}
}'
// The key is read from an environment variable, never written into the code
$apiKey = getenv('VERITAKIBI_API_KEY' );
$body = '{
"agent": {
"external_id": "<VALUE> ",
"name": "<VALUE> "
}
}' ;
$ch = curl_init('https://api.veritakibi.com/v1/whatsapp/conversations/<id> /summary' );
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json' ,
],
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// Node 18+: built-in fetch; save as .mjs (import syntax)
// The key is read from an environment variable, never written into the code
const apiKey = process.env.VERITAKIBI_API_KEY;
const res = await fetch('https://api.veritakibi.com/v1/whatsapp/conversations/<id> /summary' , {
method: 'POST' ,
headers: {
'Authorization' : `Bearer ${apiKey}` ,
'Content-Type' : 'application/json' ,
},
body: JSON.stringify({
"agent": {
"external_id": "<VALUE> ",
"name": "<VALUE> "
}
}),
});
const response = await res.json();
const status = res.status;
# Python 3.6+: standard library only (urllib, json)
# The key is read from an environment variable, never written into the code
import json, os, urllib.request
api_key = os.environ['VERITAKIBI_API_KEY' ]
body = '''{
"agent": {
"external_id": "<VALUE> ",
"name": "<VALUE> "
}
}''' .encode()
req = urllib.request.Request(
'https://api.veritakibi.com/v1/whatsapp/conversations/<id> /summary' ,
data=body,
method='POST' ,
headers={
'Authorization' : f'Bearer {api_key}' ,
'Content-Type' : 'application/json' ,
},
)
with urllib.request.urlopen(req) as res:
status = res.status
response = json.load(res)
// Go 1.18+: standard library only (net/http, encoding/json)
// The key is read from an environment variable, never written into the code
package main
import (
"encoding/json"
"net/http"
"os"
"strings"
)
func main() {
apiKey := os.Getenv("VERITAKIBI_API_KEY" )
body := `{
"agent": {
"external_id": "<VALUE> ",
"name": "<VALUE> "
}
}`
req, err := http.NewRequest("POST" , "https://api.veritakibi.com/v1/whatsapp/conversations/<id> /summary" , strings.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Authorization" , "Bearer " +apiKey)
req.Header.Set("Content-Type" , "application/json" )
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
status := res.StatusCode
var response map[string]any
json.NewDecoder(res.Body).Decode(&response)
_, _ = status, response
}
// Java 11+: built-in java.net.http; file name Example.java
// The key is read from an environment variable, never written into the code
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
String apiKey = System.getenv("VERITAKIBI_API_KEY" );
String body = "{\"agent\": {\"external_id\": \"<VALUE> \", \"name\": \"<VALUE> \"}}" ;
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.veritakibi.com/v1/whatsapp/conversations/<id> /summary" ))
.header("Authorization" , "Bearer " + apiKey)
.header("Content-Type" , "application/json" )
.method("POST" , HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> res = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// JSON text; Java has no built-in JSON parser, use a JSON library
String response = res.body();
int status = res.statusCode();
}
}
// .NET 6+: top-level statements; default console template (implicit usings on)
// The key is read from an environment variable, never written into the code
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
var apiKey = Environment.GetEnvironmentVariable("VERITAKIBI_API_KEY" );
var body = "{\"agent\": {\"external_id\": \"<VALUE> \", \"name\": \"<VALUE> \"}}" ;
using var http = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("POST" ), "https://api.veritakibi.com/v1/whatsapp/conversations/<id> /summary" );
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer" , apiKey);
request.Content = new StringContent(body, Encoding.UTF8);
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json" );
var res = await http.SendAsync(request);
var response = JsonDocument.Parse(await res.Content.ReadAsStringAsync());
var status = (int)res.StatusCode;
// C++11+: requires libcurl (link with -lcurl)
// The key is read from an environment variable, never written into the code
#include <curl/curl.h>
#include <cstdlib>
#include <string>
// Collects the response body into a string
static size_t write_body(char* data, size_t size, size_t nmemb, void* out) {
static_cast<std::string*>(out)->append(data, size * nmemb);
return size * nmemb;
}
int main() {
const char* api_key = std::getenv("VERITAKIBI_API_KEY" );
std::string auth = std::string("Authorization: Bearer " ) + (api_key ? api_key : "" );
std::string body = R"({
"agent": {
"external_id": "<VALUE> ",
"name": "<VALUE> "
}
})" ;
std::string response;
long status = 0;
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL* ch = curl_easy_init();
curl_slist* headers = nullptr;
headers = curl_slist_append(headers, auth.c_str());
headers = curl_slist_append(headers, "Content-Type: application/json" );
curl_easy_setopt(ch, CURLOPT_URL, "https://api.veritakibi.com/v1/whatsapp/conversations/<id> /summary" );
curl_easy_setopt(ch, CURLOPT_CUSTOMREQUEST, "POST" );
curl_easy_setopt(ch, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(ch, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, write_body);
curl_easy_setopt(ch, CURLOPT_WRITEDATA, &response);
curl_easy_perform(ch);
curl_easy_getinfo(ch, CURLINFO_RESPONSE_CODE, &status);
curl_slist_free_all(headers);
curl_easy_cleanup(ch);
curl_global_cleanup();
}