Link an SMS conversation to a donor
Links a donor from this organization, marks routing matched, and backfills inbound/opt-state activity. A nonempty resolved donor phone must match the participant phone; a donor without a resolved phone can be linked. A saved conversation opt-in/opt-out state is applied to donor can_receive_sms while the master communication pause remains effective. Conversations and available lines respect line visibility: restricted lines require assignment to the viewer or sms_inbox_manage/group_all. Requires permission: one of sms_inbox_manage; plus one of beta_features.
curl --request POST \
--url https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"donor_id": 1
}'import requests
url = "https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor"
payload = { "donor_id": 1 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({donor_id: 1})
};
fetch('https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor', 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.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'donor_id' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor"
payload := strings.NewReader("{\n \"donor_id\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"donor_id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"donor_id\": 1\n}"
response = http.request(request)
puts response.read_body{
"conversation": {
"id": 42,
"donor_id": 42,
"donor_name": "Jane Donor",
"participant_phone_e164": "+15551234567",
"routing_status": "matched",
"inbox_status": "open",
"messaging_status": "active",
"assigned_user_id": 42,
"assigned_user_name": "Example",
"sms_line": {
"id": 42,
"phone_number": "+15551234567",
"provider_line_id": "Example",
"label": "Example",
"source": "client_managed_imported",
"status": "active",
"is_default": true,
"line_role": "general",
"assigned_user_id": 42,
"visibility": "shared",
"metadata": {},
"assigned_user_name": "Example"
},
"last_message_at": "2026-10-20T12:00:00Z",
"last_inbound_at": "2026-10-20T12:00:00Z",
"last_outbound_at": "2026-10-20T12:00:00Z",
"last_read_at": "2026-10-20T12:00:00Z",
"unread_count": 0,
"needs_reply": true,
"last_message_preview": "Example",
"last_message_direction": "inbound",
"has_attachments": true,
"messages": [
{
"id": 42,
"direction": "outbound",
"message_kind": "manual",
"user_id": 42,
"sender": {
"id": 42,
"name": "Jane Admin",
"initials": "JA"
},
"content": "Thank you for your support.",
"trigger": "Example",
"provider_status": "QUEUED",
"provider_message_handle": "Example",
"error_code": "Example",
"error_message": "Example",
"to_number": "+15551234567",
"from_number": "+15557654321",
"received_at": "2026-10-20T12:00:00Z",
"created_at": "2026-10-20T12:00:00Z",
"attachments": [
{
"id": 42,
"upload_id": 42,
"original_filename": "school-update.pdf",
"mime_type": "application/pdf",
"file_size_bytes": 10240,
"ingest_status": "ready",
"download_url": "<string>",
"preview_url": "<string>"
}
]
}
]
},
"donor": {
"id": 42,
"name": "Example",
"phone_e164": "+15551234567",
"can_receive_sms": true
},
"messages": [
{
"id": 42,
"direction": "outbound",
"message_kind": "manual",
"user_id": 42,
"sender": {
"id": 42,
"name": "Jane Admin",
"initials": "JA"
},
"content": "Thank you for your support.",
"trigger": "Example",
"provider_status": "QUEUED",
"provider_message_handle": "Example",
"error_code": "Example",
"error_message": "Example",
"to_number": "+15551234567",
"from_number": "+15557654321",
"received_at": "2026-10-20T12:00:00Z",
"created_at": "2026-10-20T12:00:00Z",
"attachments": [
{
"id": 42,
"upload_id": 42,
"original_filename": "school-update.pdf",
"mime_type": "application/pdf",
"file_size_bytes": 10240,
"ingest_status": "ready",
"download_url": "<string>",
"preview_url": "<string>"
}
]
}
],
"pagination": {
"current_page": 1,
"last_page": 1,
"per_page": 50,
"total": 1
},
"reply_eligibility": {
"can_reply": true,
"blocked": true,
"opted_out": true,
"line_active": true
},
"channel": {
"key": "texts",
"label": "Texts"
},
"message": "Conversation linked to donor."
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Not Found",
"status": "error"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}Authorizations
Passport bearer token authentication for legacy admin sessions.
Path Parameters
Conversation id in the current organization.
Body
Validated request fields for this operation.
Donor id. Validation: required, integer.
1
Response
Operation result.
curl --request POST \
--url https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"donor_id": 1
}'import requests
url = "https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor"
payload = { "donor_id": 1 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({donor_id: 1})
};
fetch('https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor', 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.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'donor_id' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor"
payload := strings.NewReader("{\n \"donor_id\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"donor_id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/sms_inbox/conversations/{conversation_id}/link-donor")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"donor_id\": 1\n}"
response = http.request(request)
puts response.read_body{
"conversation": {
"id": 42,
"donor_id": 42,
"donor_name": "Jane Donor",
"participant_phone_e164": "+15551234567",
"routing_status": "matched",
"inbox_status": "open",
"messaging_status": "active",
"assigned_user_id": 42,
"assigned_user_name": "Example",
"sms_line": {
"id": 42,
"phone_number": "+15551234567",
"provider_line_id": "Example",
"label": "Example",
"source": "client_managed_imported",
"status": "active",
"is_default": true,
"line_role": "general",
"assigned_user_id": 42,
"visibility": "shared",
"metadata": {},
"assigned_user_name": "Example"
},
"last_message_at": "2026-10-20T12:00:00Z",
"last_inbound_at": "2026-10-20T12:00:00Z",
"last_outbound_at": "2026-10-20T12:00:00Z",
"last_read_at": "2026-10-20T12:00:00Z",
"unread_count": 0,
"needs_reply": true,
"last_message_preview": "Example",
"last_message_direction": "inbound",
"has_attachments": true,
"messages": [
{
"id": 42,
"direction": "outbound",
"message_kind": "manual",
"user_id": 42,
"sender": {
"id": 42,
"name": "Jane Admin",
"initials": "JA"
},
"content": "Thank you for your support.",
"trigger": "Example",
"provider_status": "QUEUED",
"provider_message_handle": "Example",
"error_code": "Example",
"error_message": "Example",
"to_number": "+15551234567",
"from_number": "+15557654321",
"received_at": "2026-10-20T12:00:00Z",
"created_at": "2026-10-20T12:00:00Z",
"attachments": [
{
"id": 42,
"upload_id": 42,
"original_filename": "school-update.pdf",
"mime_type": "application/pdf",
"file_size_bytes": 10240,
"ingest_status": "ready",
"download_url": "<string>",
"preview_url": "<string>"
}
]
}
]
},
"donor": {
"id": 42,
"name": "Example",
"phone_e164": "+15551234567",
"can_receive_sms": true
},
"messages": [
{
"id": 42,
"direction": "outbound",
"message_kind": "manual",
"user_id": 42,
"sender": {
"id": 42,
"name": "Jane Admin",
"initials": "JA"
},
"content": "Thank you for your support.",
"trigger": "Example",
"provider_status": "QUEUED",
"provider_message_handle": "Example",
"error_code": "Example",
"error_message": "Example",
"to_number": "+15551234567",
"from_number": "+15557654321",
"received_at": "2026-10-20T12:00:00Z",
"created_at": "2026-10-20T12:00:00Z",
"attachments": [
{
"id": 42,
"upload_id": 42,
"original_filename": "school-update.pdf",
"mime_type": "application/pdf",
"file_size_bytes": 10240,
"ingest_status": "ready",
"download_url": "<string>",
"preview_url": "<string>"
}
]
}
],
"pagination": {
"current_page": 1,
"last_page": 1,
"per_page": 50,
"total": 1
},
"reply_eligibility": {
"can_reply": true,
"blocked": true,
"opted_out": true,
"line_active": true
},
"channel": {
"key": "texts",
"label": "Texts"
},
"message": "Conversation linked to donor."
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Not Found",
"status": "error"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}