Skip to main content

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 & Last-Mile / Customer Communications
GET/delivery/customer-communications

Get 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

ParameterTypeDescription
pagestring

Page number for pagination

Example: 1

limitstring

Number of items per page

Example: 10

customer_idOptionalstring

Filter by customer ID (optional - if not provided and user is a customer, returns their own communications)

delivery_idstring

Filter by delivery ID

typestring

Filter by communication type (sms, email, push_notification, call)

statusstring

Filter by status (sent, delivered, failed, read)

tenant_idOptionalstring

Filter by tenant ID (optional if in auth token)

languagestring

Preferred language for response messages

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Staging
Request
curl
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

200OK
Response body
json
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 & Last-Mile / Customer Communications
POST/delivery/customer-communications

Create 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

ParameterTypeDescription
tenant_idOptionalstring

Tenant ID (optional if in auth token)

languagestring

Preferred language for response messages

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
customer_idstring—
delivery_idstring—
typestring—
directionstring—
statusstring—
contentstring—
communication_detailsobject—
communication_details.senderobject—
communication_details.sender.user_idstring—
communication_details.sender.system_componentstring—
communication_details.sender.phonestring—
communication_details.recipientobject—
Show 11 more body fields

Additional body parameters

ParameterTypeDescription
communication_details.recipient.phonestring—
communication_details.recipient.namestring—
communication_details.template_idstring—
communication_details.template_variablesobject—
communication_details.template_variables.delivery_idstring—
communication_details.template_variables.delivery_windowstring—
communication_details.attachmentsarray<object>—
communication_details.attachments.namestring—
communication_details.attachments.typestring—
communication_details.attachments.urlstring—
communication_details.attachments.sizenumber—
Staging
Request
curl
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

201Created
Response body
json
1{2  "success": true,3  "message": "Communication created successfully",4  "id": "uuid"5}