Customer Communications
2 API calls in this section.
Endpoints for managing and tracking communications with customers, including notifications about their deliveries through various channels (SMS, email, push notifications, calls).
List Customer Communications
/delivery/customer-communicationsGet a list of customer communications with filtering and pagination. Customers can only view their own communications, while admin users can view all communications.
Query parameters
| Parameter | Type | Description |
|---|---|---|
page | string | Page number for pagination Example: |
limit | string | Number of items per page Example: |
customer_idOptional | string | Filter by customer ID (optional - if not provided and user is a customer, returns their own communications) |
delivery_id | string | Filter by delivery ID |
type | string | Filter by communication type (sms, email, |
status | string | Filter by status (sent, delivered, failed, read) |
tenant_idOptional | string | Filter by tenant ID (optional if in auth token) |
language | string | Preferred language for response messages Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/delivery/customer-communications?page=1&limit=10&customer_id=&delivery_id=&type=&status=&tenant_id=&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"Response examples
1{2 "success": true,3 "message": "Communications retrieved successfully",4 "communications": [5 {6 "id": "uuid",7 "tenant_id": "uuid",8 "customer_id": "uuid",9 "delivery_id": "uuid",10 "type": "sms",11 "direction": "outbound",12 "status": "delivered",13 "content": "Your delivery #1234 is on its way and will arrive between 2-4pm today.",14 "communication_details": {15 "sender": {16 "system_component": "delivery_notifications",17 "phone": "+15551234567"18 },19 "recipient": {20 "phone": "+19876543210",21 "name": "John Doe"22 },23 "delivery_status": [24 {25 "status": "sent",26 "timestamp": "2023-08-01T14:30:00Z",27 "gateway_reference": "sms-ref-123456"28 },29 {30 "status": "delivered",31 "timestamp": "2023-08-01T14:31:00Z",32 "gateway_reference": "sms-ref-123456"33 }34 ],35 "template_id": "delivery-on-way",36 "template_variables": {37 "delivery_id": "1234",38 "delivery_window": "2-4pm"39 }40 },41 "sent_at": "2023-08-01T14:30:00Z",42 "created_at": "2023-08-01T14:30:00Z",43 "updated_at": "2023-08-01T14:31:00Z",44 "tenant_users": {45 "id": "uuid",46 "user_id": "uuid",47 "tenant_id": "uuid",48 "status": "active"49 },50 "deliveries": {51 "id": "uuid",52 "status": "in_transit",53 "scheduled_delivery_time": "2023-08-01T16:00:00Z"54 }55 }56 ],57 "page": 1,58 "limit": 10,59 "total": 2560}Create Customer Communication
/delivery/customer-communicationsCreate a new customer communication. This requires admin permissions with manage:operations:tenant. Automatically records outbound communications and can be used to log inbound communications.
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idOptional | string | Tenant ID (optional if in auth token) |
language | string | Preferred language for response messages Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
customer_id | string | — |
delivery_id | string | — |
type | string | — |
direction | string | — |
status | string | — |
content | string | — |
communication_details | object | — |
communication_details.sender | object | — |
communication_details.sender.user_id | string | — |
communication_details.sender.system_component | string | — |
communication_details.sender.phone | string | — |
communication_details.recipient | object | — |
Show 11 more body fields
Additional body parameters
| Parameter | Type | Description |
|---|---|---|
communication_details.recipient.phone | string | — |
communication_details.recipient.name | string | — |
communication_details.template_id | string | — |
communication_details.template_variables | object | — |
communication_details.template_variables.delivery_id | string | — |
communication_details.template_variables.delivery_window | string | — |
communication_details.attachments | array<object> | — |
communication_details.attachments.name | string | — |
communication_details.attachments.type | string | — |
communication_details.attachments.url | string | — |
communication_details.attachments.size | number | — |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/delivery/customer-communications?tenant_id=&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "customer_id": "uuid",6 "delivery_id": "uuid",7 "type": "sms",8 "direction": "outbound",9 "status": "sent",10 "content": "Your delivery #1234 is on its way and will arrive between 2-4pm today.",11 "communication_details": {12 "sender": {13 "user_id": "uuid",14 "system_component": "delivery_notifications",15 "phone": "+15551234567"16 },17 "recipient": {18 "phone": "+19876543210",19 "name": "John Doe"20 },21 "template_id": "delivery-on-way",22 "template_variables": {23 "delivery_id": "1234",24 "delivery_window": "2-4pm"25 },26 "attachments": [27 {28 "name": "delivery_details.pdf",29 "type": "application/pdf",30 "url": "https://example.com/attachments/delivery_details.pdf",31 "size": 24567832 }33 ]34 }35}'Response examples
1{2 "success": true,3 "message": "Communication created successfully",4 "id": "uuid"5}