SAAS Line API send - nxtele/nxcloud-doc-en GitHub Wiki

Send Line Message

Initiate Line message sending via API.

  • URL: https://api-hk.nxlink.ai/saas/line/send
  • Method: POST
  • Content-Type: application/json
  • Requires authentication: Yes

Authentication

Authentication rules: API Invocation Convention

Request Parameters

Header Parameters

Parameter Type Required Example Description
accessKey String Yes fme2na3kdi3ki User identity key
ts String Yes 1655710885431 Timestamp in milliseconds. Max allowed time drift is 60 seconds.
bizType String Yes 7 Line business type, fixed value "7"
action String Yes mt Line action, fixed value "mt"
sign String Yes 6e9506557d1f289501d333ee2c361111 Signature, see common auth rules

Body Parameters

Parameter Type Required Example Description
tenant_id Long Yes 1 Tenant ID
appkey String Yes pem28kje Application appkey
to String Yes U44d64355f3d939f4db74649d82d25xxx Recipient channelId
type Integer Yes 1 Message type: 1 text, 3 image, 4 video, 5 voice
filename String No - Required for image/video/voice
originalContentUrl String No - Required for image/video/voice
content String No - Required for text
previewImageUrl String No - Required for video
duration Long No - Required for voice; milliseconds

Message Types

  • 1: text
  • 3: image
  • 4: video
  • 5: voice

Request Examples

Text

{
    "tenant_id": 123,
    "appkey": "Exxx",
    "to": "U44d64355f3d939f4db74649d82d25xxx",
    "type": 1,
    "content": "Text message"
}

Image

{
    "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

{
    "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

{
    "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 Result data
message String Message
traceId String Trace ID
  • data object parameters:
Parameter Type Description
message_id String Message ID

Response Examples

Success

{
    "code": 0,
    "message": "",
    "data": null,
    "traceId": "56bf81643292cd6a89ecde64ae00db13"
}

Failure

{
    "code": -1,
    "message": "Failure",
    "traceId": "77f8709b545f4fee93fd7f098be9df04"
}

Response Codes

Code Message Solution
0 Success -
-1 Failure Contact support
1000~100X Authentication failed See authentication section
9000 Request parameter error Check required parameters
9001 System business error Contact support
9999 Unknown error Contact support