Message Event

This event object is created when a user sends a message.
The type property is "message", and the message object for each message type is contained in the content property.
The available message types and client versions are as follows:

Message typeContentClient version
textTextAll versions
locationLocation informationAll versions
stickerStickerClient v2.3 or later
imageImageClient v2.3 or later
fileFileClient v2.9 or later
audioAudioClient v4.1 or later
videoVideoClient v4.1 or later

Text {#message-event-text}

This message object contains the text sent from the user.

Caution

  • The "content.postback" property responds to "start" or the postback of the message action. For responses of the postback action, see the description of Postback Event.

Request {#message-event-text-request}

ParameterTypeRequiredDescription
typestringYSet this parameter to "message".
sourceobjectYThe subject that sent a callback message.
source.userIdstringYThe default account of the user who talked with the message bot.
source.channelIdstringSee the description.The message room ID to which the user belongs. The 1:1 message room ID is not sent.
source.domainIdnumberYThe domain ID to which the user belongs.
issuedTimestringYThe date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ).
contentobjectYMessage content
content.typestringYSet this parameter to "text".
content.textstringYThe message content that the user typed
content.postbackstringNUser postback information (using a greeting or template)

Request example {#message-event-text-request-example}

POST /callback HTTP/1.1Host: YOUR_SERVER_HOST_NAMEContent-type: application/json; charset=UTF-8X-WORKS-Signature: 9crxWhZ9aQO/9ruUM4MH3dF/WRGYRhj0vSR4cRyJfHQ=X-WORKS-BotId: 123{  "type": "message",  "source": {    "userId": "c72af563-0f21-4736-11e4-045237113344",    "channelId": "12345",    "domainId": 40029600  },  "issuedTime": "2022-01-04T05:16:05.716Z",  "content": {    "type": "text",    "text": "hello"  }}

Location information {#message-event-location}

This message object contains the location information sent from the user.

Request {#message-event-location-request}

ParameterTypeRequiredDescription
typestringYSet this parameter to "message".
sourceobjectYThe subject that sent a callback message.
source.userIdstringYThe default account of the user who talked with the message bot.
source.channelIdstringSee the description.The message room ID to which the user belongs. The 1:1 message room ID is not sent.
source.domainIdnumberYThe domain ID to which the user belongs.
issuedTimestringYThe date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ).
contentobjectYMessage content
content.typestringYSet this parameter to "location".
content.addressstringYThe address of the user
content.latitudenumberYThe latitude of the user
content.longitudenumberYThe longitude of the user

Request example {#message-event-location-request-example}

POST /callback HTTP/1.1Host: YOUR_SERVER_HOST_NAMEContent-type: application/json; charset=UTF-8X-WORKS-Signature: 9crxWhZ9aQO/9ruUM4MH3dF/WRGYRhj0vSR4cRyJfHQ=X-WORKS-BotId: 123{  "type": "message",  "source": {    "userId": "c72af563-0f21-4736-11e4-045237113344",    "channelId": "12345",    "domainId": 40029600  },  "issuedTime": "2022-01-04T05:16:05.716Z",  "content": {    "type": "location",    "address": "2-15-1 Shibuya, Shibuya-ku, Tokyo 150-0002, Japan"    "latitude": 35.6587750,    "longitude": 139.7052230  }}

Sticker {#message-event-sticker}

This message object contains the sticker information sent from the user.
For more information on basic stickers and sticker IDs of LINE, see Sticker List.

Request {#message-event-sticker-request}

ParameterTypeRequiredDescription
typestringYSet this parameter to "message".
sourceobjectYThe subject that sent a callback message.
source.userIdstringYThe default account of the user who talked with the message bot.
source.channelIdstringSee the description.The message room ID to which the user belongs. The 1:1 message room ID is not sent.
source.domainIdnumberYThe domain ID to which the user belongs.
issuedTimestringYThe date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ).
contentobjectYMessage content
content.typestringYSet this parameter to "sticker".
content.packageIdstringYPackage ID
content.stickerIdstringYSticker ID

Request example {#message-event-sticker-request-example}

POST /callback HTTP/1.1Host: YOUR_SERVER_HOST_NAMEContent-type: application/json; charset=UTF-8X-WORKS-Signature: 9crxWhZ9aQO/9ruUM4MH3dF/WRGYRhj0vSR4cRyJfHQ=X-WORKS-BotId: 123{  "type": "message",  "source": {    "userId": "c72af563-0f21-4736-11e4-045237113344",    "channelId": "12345",    "domainId": 40029600  },  "issuedTime":"2022-01-04T05:16:05.716Z",  "content": {    "type": "sticker",    "packageId": "1",    "stickerId": "1"  }}

Image {#message-event-image}

This message object contains the image data sent from the user.
For how to download binary image data for a resource ID, see Download Content.

Request {#message-event-image-request}

ParameterTypeRequiredDescription
typestringYSet this parameter to "message".
sourceobjectYThe subject that sent a callback message.
source.userIdstringYThe default account of the user who talked with the message bot.
source.channelIdstringSee the description.The message room ID to which the user belongs. The 1:1 message room ID is not sent.
source.domainIdnumberYThe domain ID to which the user belongs.
issuedTimestringYThe date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ).
contentobjectYMessage content
content.typestringYSet this parameter to "image".
content.fileIdstringYResource ID

Request example {#message-event-image-request-example}

POST /callback HTTP/1.1Host: YOUR_SERVER_HOST_NAMEContent-type: application/json; charset=UTF-8X-WORKS-Signature: 9crxWhZ9aQO/9ruUM4MH3dF/WRGYRhj0vSR4cRyJfHQ=X-WORKS-BotId: 123{  "type": "message",  "source": {    "userId": "c72af563-0f21-4736-11e4-045237113344",    "channelId": "12345",    "domainId": 40029600  },  "issuedTime":"2022-01-04T05:16:05.716Z",  "content": {    "type": "image",    "fileId": "WAAAQPwBexX2HnseNvvM9Zyhvp2kIRF3Ul7L7/aMVti8="  }}

File {#message-event-file}

This message object contains the file data sent from the user.
For how to download file data for a resource ID, see Download Content.

Request {#message-event-file-request}

ParameterTypeRequiredDescription
typestringYSet this parameter to "message".
sourceobjectYThe subject that sent a callback message.
source.userIdstringYThe default account of the user who talked with the message bot.
source.channelIdstringSee the description.The message room ID to which the user belongs. The 1:1 message room ID is not sent.
source.domainIdnumberYThe domain ID to which the user belongs.
issuedTimestringYThe date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ).
contentobjectYMessage content
content.typestringYSet this parameter to "file".
content.fileIdstringYResource ID

Request example {#message-event-file-request-example}

POST /callback HTTP/1.1Host: YOUR_SERVER_HOST_NAMEContent-type: application/json; charset=UTF-8X-WORKS-Signature: 9crxWhZ9aQO/9ruUM4MH3dF/WRGYRhj0vSR4cRyJfHQ=X-WORKS-BotId: 123{  "type": "message",  "source": {    "userId": "c72af563-0f21-4736-11e4-045237113344",    "channelId": "12345",    "domainId": 40029600  },  "issuedTime":"2022-01-04T05:16:05.716Z",  "content": {    "type": "file",    "fileId": "WAAAQPwBexX2HnseNvvM9Zyhvp2kIRF3Ul7L7/aMVti8="  }}

Audio {#message-event-audio}

This message object contains the audio data sent from the user.
For how to download audio data for a resource ID, see Download Content.

Request {#message-event-audio-request}

ParameterTypeRequiredDescription
typestringYSet this parameter to "message".
sourceobjectYThe subject that sent a callback message.
source.userIdstringYThe default account of the user who talked with the message bot.
source.channelIdstringSee the description.The message room ID to which the user belongs. The 1:1 message room ID is not sent.
source.domainIdnumberYThe domain ID to which the user belongs.
issuedTimestringYThe date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ).
contentobjectYMessage content
content.typestringYSet this parameter to "audio".
content.fileIdstringYResource ID

Request example {#message-event-audio-request-example}

POST /callback HTTP/1.1Host: YOUR_SERVER_HOST_NAMEContent-type: application/json; charset=UTF-8X-WORKS-Signature: 9crxWhZ9aQO/9ruUM4MH3dF/WRGYRhj0vSR4cRyJfHQ=X-WORKS-BotId: 123{  "type": "message",  "source": {    "userId": "c72af563-0f21-4736-11e4-045237113344",    "channelId": "12345",    "domainId": 40029600  },  "issuedTime":"2022-01-04T05:16:05.716Z",  "content": {    "type": "audio",    "fileId": "WAAAQPwBexX2HnseNvvM9Zyhvp2kIRF3Ul7L7/aMVti8="  }}

Video {#message-event-video}

This message object contains the video data sent from the user.
For how to download video data for a resource ID, see Download Content.

Request {#message-event-video-request}

ParameterTypeRequiredDescription
typestringYSet this parameter to "message".
sourceobjectYThe subject that sent a callback message.
source.userIdstringYThe default account of the user who talked with the message bot.
source.channelIdstringSee the description.The message room ID to which the user belongs. The 1:1 message room ID is not sent.
source.domainIdnumberYThe domain ID to which the user belongs.
issuedTimestringYThe date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ).
contentobjectYMessage content
content.typestringYSet this parameter to "video".
content.fileIdstringYResource ID

Request example {#message-event-video-request-example}

POST /callback HTTP/1.1Host: YOUR_SERVER_HOST_NAMEContent-type: application/json; charset=UTF-8X-WORKS-Signature: 9crxWhZ9aQO/9ruUM4MH3dF/WRGYRhj0vSR4cRyJfHQ=X-WORKS-BotId: 123{  "type": "message",  "source": {    "userId": "c72af563-0f21-4736-11e4-045237113344",    "channelId": "12345",    "domainId": 40029600  },  "issuedTime":"2022-01-04T05:16:05.716Z",  "content": {    "type": "video",    "fileId": "WAAAQPwBexX2HnseNvvM9Zyhvp2kIRF3Ul7L7/aMVti8="  }}

Response (customer's server receiving messages -> message server) {#message-event-response}

It should return HTTP status 200 if successful.
The HTTP request sent by a callback is not resent even if it failed.

Response {#message-event-response-example}

HTTP/1.1 200 OKContent-Type: application/jsonServer: YOUR_SERVER_HOST_NAMEContent-Length: 0