Send Message
Initiate the Line number messaging service via API
- URL:
https://api.nxcloud.com/saas/line/send
- Method:
POST
- Content-Type:
application/json
- Authentication Required:
Yes
Authentication Mechanism
For authentication rules, please refer to: API Interface Call Conventions
Request Parameters
Header Parameters:
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
accessKey | String | Yes | fme2na3kdi3ki | User identity identifier |
ts | String | Yes | 1655710885431 | Current request timestamp (in milliseconds); the service allows a max time difference of 60 seconds |
bizType | String | Yes | 7 | Line business type, fixed value “7” |
action | String | Yes | mt | Line business operation, fixed value “mt” |
sign | String | Yes | 6e9506557d1f289501d333ee2c361111 | Signature for the API parameters, public convention |
Body Parameters:
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
tenant_id | Long | Yes | 1 | Tenant ID |
appkey | String | Yes | pem28kje | Application appkey |
to | String | Yes | U44d64355f3d939f4db74649d82d25xxx | The recipient's channelId, e.g., U44d64355f3d939f4db74649d82d25xxx |
type | Integer | Yes | 1 | Message types supported: 1: Text 3: Image 4: Video 5: Voice |
filename | String | No | - | Required for image, video, or voice messages only |
originalContentUrl | String | No | - | Media file URL, required for image, video, or voice messages |
content | String | No | - | Required for text messages only |
previewImageUrl | String | No | - | Preview image, required for video messages |
duration | Long | No | - | Duration in milliseconds, required for voice messages |
Message Types:
- 1: Text
- 3: Image
- 4: Video
- 5: Voice
Request Examples
Text Message
{
"tenant_id": 123,
"appkey": "Exxx",
"to": "U44d64355f3d939f4db74649d82d25xxx",
"type": 1,
"content": "Regular text"
}
Image Message
{
"tenant_id": 123,
"appkey": "Exxx",
"to": "U44d64355f3d939f4db74649d82d25xxx",
"type": 3,
"filename": "7PSg8pGsIuWfHJZ.jpg",
"originalContentUrl": "https://nxtele-hk.oss-cn-hongkong.aliyuncs.com/6.5M.jpeg?Expires=1706089776&OSSAccessKeyId=TMP.3KhCyAyQVWhZt6N1prT69KjWMhXRDFQ5Ad5bj4BNkAx8TC3RuvXofqDdgunV9gQtDJk91X8n7kuypNJRBTJPhtqTcViaa5&Signature=%2FHvdJziTm2eaeqvTW7Y5VVxA5ZA%3D"
}
Video Message
{
"tenant_id": 123,
"appkey": "Exxx",
"to": "U44d64355f3d939f4db74649d82d25xxx",
"type": 4,
"filename": "7PSg8pGsIuWfHJZ.mp4",
"originalContentUrl": "https://goss.oss-cn-hongkong.aliyuncs.com/0c803030-17e2-11ef-ae66-d9bd85096f5b?Expires=1716870105&OSSAccessKeyId=LTAI5tBrjWM5EyDe6MA5uc7z&Signature=GoKsgcTERGGG3UNv06plqo84Zw2SI%3D",
"previewImageUrl": "https://nxtele-hk.oss-cn-hongkong.aliyuncs.com/6.5M.jpeg?Expires=1706089776&OSSAccessKeyId=TMP.3KhCyAyQVWhZt6N1prT69KjWMhXRDFQ5Ad5bj4BNkAx8TC3RuvXofqDdgunV9gQtDJk91X8n7kuypNJRBTJPhtqTcViaa5&Signature=%2FHvdJziTm2eaeqvTW7Y5VVxA5ZA%3D"
}
Voice Message
{
"tenant_id": 123,
"appkey": "Exxx",
"to": "U44d64355f3d939f4db74649d82d25xxx",
"type": 5,
"filename": "7PSg8pGsIuWfHJZ.m4a",
"originalContentUrl": "https://goss.oss-cn-hongkong.aliyuncs.com/0c803030-17e2-11ef-ae66-d9bd85096f5b?Expires=1716870105&OSSAccessKeyId=LTAI5tBrjWM5EyDe6MA5uc7z&Signature=GoKsgcTERGGG3UNv06plqo84Zw2SI%3D",
"duration": 12000
}
Response Parameters
Parameter | Type | Description |
---|---|---|
code | Integer | Result code |
data | JsonObject | Request result |
message | String | Request result message |
traceId | String | Trace ID |
- Data object parameters:
Parameter | Type | Description |
---|---|---|
message_id | String | Message ID |
Response Examples
Success Example
{
"code": 0,
"message": "",
"data": null,
"traceId": "56bf81643292cd6a89ecde64ae00db13"
}
Failure Example
{
"code": -1,
"message": "Failure",
"traceId": "77f8709b545f4fee93fd7f098be9df04"
}
Response Code Descriptions
Code | Message | Solution |
---|---|---|
0 | Success | - |
-1 | Failure | Contact support to troubleshoot |
1000~100X | Authentication failed | See the API authentication section |
9000 | Request parameter error | Missing parameters, check required inputs |
9001 | System business error | System error, contact support |
9999 | Unknown error | Contact support to troubleshoot |