GET /contacts/:uuid/messages
List all messages belonging to the contact. Results are paginated and sorted by createdAt
in descending order.
Optional Parameters
Parameter | Type | Description |
---|---|---|
page | Integer | The page of messages. If not specified it will default to page 1. |
Example Request
- cURL
- Node
- Ruby
- Go
- PHP
- Python
- C#
- Java
- Rust
curl -X GET "https://api.callbell.eu/v1/contacts/efd7d996470e463b89f079be6cf578ed/messages" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json"
import axios from 'axios';
const response = await axios.get('https://api.callbell.eu/v1/contacts/efd7d996470e463b89f079be6cf578ed/messages', {
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
});
require 'net/http'
uri = URI('https://api.callbell.eu/v1/contacts/efd7d996470e463b89f079be6cf578ed/messages')
req = Net::HTTP::Get.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
client := &http.Client{}
req, err := http.NewRequest("GET", "https://api.callbell.eu/v1/contacts/efd7d996470e463b89f079be6cf578ed/messages", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/contacts/efd7d996470e463b89f079be6cf578ed/messages');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
response = requests.get('https://api.callbell.eu/v1/contacts/efd7d996470e463b89f079be6cf578ed/messages', headers=headers)
using System.Net.Http;
using System.Net.Http.Headers;
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.callbell.eu/v1/contacts/efd7d996470e463b89f079be6cf578ed/messages");
request.Headers.Add("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM");
request.Content = new StringContent("");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.callbell.eu/v1/contacts/efd7d996470e463b89f079be6cf578ed/messages");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("GET");
httpConn.setRequestProperty("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM");
httpConn.setRequestProperty("Content-Type", "application/json");
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
extern crate reqwest;
use reqwest::header;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut headers = header::HeaderMap::new();
headers.insert("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM".parse().unwrap());
headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::blocking::Client::builder()
.redirect(reqwest::redirect::Policy::none())
.build()
.unwrap();
let res = client.get("https://api.callbell.eu/v1/contacts/efd7d996470e463b89f079be6cf578ed/messages")
.headers(headers)
.send()?
.text()?;
println!("{}", res);
Ok(())
}
Response
Parameter | Type | Description |
---|---|---|
messages | Messages[] | A list of messages. |
Example Response
response.json
{
"messages": [
{
"text": "Hello there how can I help you?",
"createdAt": "2023-12-12T10:56:36Z",
"uuid": "cf839626ac7949879b88bcffd41d34fe",
"status": "sent",
"channel": "whatsapp",
"from": "391234567890",
"to": "390987654321"
},
{
"text": "Conversation was assigned to John Doe",
"createdAt": "2023-12-12T10:56:35Z",
"status": "note",
"channel": "whatsapp",
"from": "390987654321",
"to": "390987654321"
},
{
"text": "Hello there 👋",
"createdAt": "2023-12-12T10:53:32Z",
"status": "received",
"channel": "whatsapp",
"from": "390987654321",
"to": "391234567890"
}
]
}