Message Drafts
Manage pre-written message templates (drafts) for quick sending.
List Drafts
GET
/messaging/drafts
Get list of saved message drafts.
Query Parameters
| Parameter | Type | Constraints | Description |
|---|---|---|---|
page | number | Integer ≥ 1 (default 1) | Page index. |
pageSize | number | Integer 1–100 (default 20) | Rows per page. |
groupId | number | Positive integer (list category / ListCode) | Filter drafts in one group. |
search | string | Substring search | Matches Title or Message. |
Example
curl -G "https://www.HomaCRM.com/api/v1/external/messaging/drafts" \
-H "Authorization: a1B2c3D4e5F6g7H8-i9J0k1L2m3N4o5P6-q7R8s9T0u1V2w3X4" \
-H "Accept: application/json" \
--data-urlencode "page=1" \
--data-urlencode "pageSize=20" \
--data-urlencode "groupId=3" \
--data-urlencode "search=تخفیف"
Create Draft
POST
/messaging/drafts
Create a new message draft.
Request Body
| Field | Type | Required | Valid values / constraints | Description |
|---|---|---|---|---|
title | string | Yes | Max 500 characters | Draft title. |
message | string | Yes | Max 1000 characters | Template text (SMS page count derived on save). |
groupId | number | No | Positive integer or omit | ListCode / category. |
language | number | No | 1 = Persian, 2 = English (default: auto-detect from message text) | Stored language flag. |
Example
curl -X POST "https://www.HomaCRM.com/api/v1/external/messaging/drafts" \
-H "Authorization: a1B2c3D4e5F6g7H8-i9J0k1L2m3N4o5P6-q7R8s9T0u1V2w3X4" \
-H "Content-Type: application/json" \
-d '{
"title": "یادآوری قرار ملاقات",
"message": "کاربر گرامی، قرار شما فردا ساعت ۱۰ صبح در دفتر مرکزی است. اگر به تأخیر افتادید حتماً اطلاع دهید.",
"groupId": 3,
"language": 1
}'
Get Draft
GET
/messaging/drafts/{id}
Get a specific draft by ID.
Path
| Segment | Constraints | Description |
|---|---|---|
id | Positive integer (e.g. 10042) | Draft primary key in Portal_Messages. |
Example
curl -X GET "https://www.HomaCRM.com/api/v1/external/messaging/drafts/10042" \
-H "Authorization: a1B2c3D4e5F6g7H8-i9J0k1L2m3N4o5P6-q7R8s9T0u1V2w3X4" \
-H "Accept: application/json"
Update Draft
PUT
/messaging/drafts/{id}
Request Body (partial update)
| Field | Type | Required | Valid values / constraints | Description |
|---|---|---|---|---|
title | string | No | Max 500 chars if present | New title. |
message | string | No | Max 1000 chars; updates SMS page count | New body. |
groupId | number | No | Positive integer | ListCode. |
language | number | No | 1 or 2 | Override language when updating message. |
At least one field must be supplied; otherwise the API returns “No fields to update”.
Example
curl -X PUT "https://www.HomaCRM.com/api/v1/external/messaging/drafts/10042" \
-H "Authorization: a1B2c3D4e5F6g7H8-i9J0k1L2m3N4o5P6-q7R8s9T0u1V2w3X4" \
-H "Content-Type: application/json" \
-d '{
"title": "یادآوری قرار ملاقات (ویرایش)",
"message": "قرار شما روز پنجشنبه ساعت ۹ بهجای ۱۰ برگزار میشود.",
"groupId": 3,
"language": 1
}'
Delete Draft
DELETE
/messaging/drafts/{id}
Delete a draft permanently.
Example
curl -X DELETE "https://www.HomaCRM.com/api/v1/external/messaging/drafts/10042" \
-H "Authorization: a1B2c3D4e5F6g7H8-i9J0k1L2m3N4o5P6-q7R8s9T0u1V2w3X4" \
-H "Accept: application/json"