Leads
Get messages
Fetches messages sent to and received from a lead
GET
/
leads
/
{leadId}
/
messages
cURL
curl --request GET \
--url https://api.attent.app/v1/leads/{leadId}/messages \
--header 'x-api-key: <api-key>'import requests
url = "https://api.attent.app/v1/leads/{leadId}/messages"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.attent.app/v1/leads/{leadId}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attent.app/v1/leads/{leadId}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.attent.app/v1/leads/{leadId}/messages"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.attent.app/v1/leads/{leadId}/messages")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attent.app/v1/leads/{leadId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"messages": [
{
"content": {
"text": "Hello, how can I help you?"
},
"createdAt": "2024-05-17T21:09:13Z",
"owner": "user"
},
{
"content": {
"text": "I would like to schedule a meeting."
},
"createdAt": "2024-05-17T21:09:13Z",
"owner": "lead"
}
]
}Previous
List events for a leadList interaction events for a lead — messages, calls, emails, tool calls, custom events, compliance blocks, and other types documented in this reference.
Apten may add new `type` values over time without a version bump or prior notice. Clients should treat unknown types as forward-compatible (skip or store opaquely) unless they filter with the `types` query parameter.
Next
⌘I
cURL
curl --request GET \
--url https://api.attent.app/v1/leads/{leadId}/messages \
--header 'x-api-key: <api-key>'import requests
url = "https://api.attent.app/v1/leads/{leadId}/messages"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.attent.app/v1/leads/{leadId}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attent.app/v1/leads/{leadId}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.attent.app/v1/leads/{leadId}/messages"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.attent.app/v1/leads/{leadId}/messages")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attent.app/v1/leads/{leadId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"messages": [
{
"content": {
"text": "Hello, how can I help you?"
},
"createdAt": "2024-05-17T21:09:13Z",
"owner": "user"
},
{
"content": {
"text": "I would like to schedule a meeting."
},
"createdAt": "2024-05-17T21:09:13Z",
"owner": "lead"
}
]
}
