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 type | Content | Client version |
|---|---|---|
| text | Text | All versions |
| location | Location information | All versions |
| sticker | Sticker | Client v2.3 or later |
| image | Image | Client v2.3 or later |
| file | File | Client v2.9 or later |
| audio | Audio | Client v4.1 or later |
| video | Video | Client v4.1 or later |
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Y | Set this parameter to "message". |
| source | object | Y | The subject that sent a callback message. |
| source.userId | string | Y | The default account of the user who talked with the message bot. |
| source.channelId | string | See the description. | The message room ID to which the user belongs. The 1:1 message room ID is not sent. |
| source.domainId | number | Y | The domain ID to which the user belongs. |
| issuedTime | string | Y | The date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ). |
| content | object | Y | Message content |
| content.type | string | Y | Set this parameter to "text". |
| content.text | string | Y | The message content that the user typed |
| content.postback | string | N | User postback information (using a greeting or template) |
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" }}This message object contains the location information sent from the user.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Y | Set this parameter to "message". |
| source | object | Y | The subject that sent a callback message. |
| source.userId | string | Y | The default account of the user who talked with the message bot. |
| source.channelId | string | See the description. | The message room ID to which the user belongs. The 1:1 message room ID is not sent. |
| source.domainId | number | Y | The domain ID to which the user belongs. |
| issuedTime | string | Y | The date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ). |
| content | object | Y | Message content |
| content.type | string | Y | Set this parameter to "location". |
| content.address | string | Y | The address of the user |
| content.latitude | number | Y | The latitude of the user |
| content.longitude | number | Y | The longitude of the user |
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 }}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.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Y | Set this parameter to "message". |
| source | object | Y | The subject that sent a callback message. |
| source.userId | string | Y | The default account of the user who talked with the message bot. |
| source.channelId | string | See the description. | The message room ID to which the user belongs. The 1:1 message room ID is not sent. |
| source.domainId | number | Y | The domain ID to which the user belongs. |
| issuedTime | string | Y | The date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ). |
| content | object | Y | Message content |
| content.type | string | Y | Set this parameter to "sticker". |
| content.packageId | string | Y | Package ID |
| content.stickerId | string | Y | Sticker ID |
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" }}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.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Y | Set this parameter to "message". |
| source | object | Y | The subject that sent a callback message. |
| source.userId | string | Y | The default account of the user who talked with the message bot. |
| source.channelId | string | See the description. | The message room ID to which the user belongs. The 1:1 message room ID is not sent. |
| source.domainId | number | Y | The domain ID to which the user belongs. |
| issuedTime | string | Y | The date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ). |
| content | object | Y | Message content |
| content.type | string | Y | Set this parameter to "image". |
| content.fileId | string | Y | Resource ID |
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=" }}This message object contains the file data sent from the user.
For how to download file data for a resource ID, see Download Content.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Y | Set this parameter to "message". |
| source | object | Y | The subject that sent a callback message. |
| source.userId | string | Y | The default account of the user who talked with the message bot. |
| source.channelId | string | See the description. | The message room ID to which the user belongs. The 1:1 message room ID is not sent. |
| source.domainId | number | Y | The domain ID to which the user belongs. |
| issuedTime | string | Y | The date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ). |
| content | object | Y | Message content |
| content.type | string | Y | Set this parameter to "file". |
| content.fileId | string | Y | Resource ID |
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=" }}This message object contains the audio data sent from the user.
For how to download audio data for a resource ID, see Download Content.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Y | Set this parameter to "message". |
| source | object | Y | The subject that sent a callback message. |
| source.userId | string | Y | The default account of the user who talked with the message bot. |
| source.channelId | string | See the description. | The message room ID to which the user belongs. The 1:1 message room ID is not sent. |
| source.domainId | number | Y | The domain ID to which the user belongs. |
| issuedTime | string | Y | The date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ). |
| content | object | Y | Message content |
| content.type | string | Y | Set this parameter to "audio". |
| content.fileId | string | Y | Resource ID |
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=" }}This message object contains the video data sent from the user.
For how to download video data for a resource ID, see Download Content.
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Y | Set this parameter to "message". |
| source | object | Y | The subject that sent a callback message. |
| source.userId | string | Y | The default account of the user who talked with the message bot. |
| source.channelId | string | See the description. | The message room ID to which the user belongs. The 1:1 message room ID is not sent. |
| source.domainId | number | Y | The domain ID to which the user belongs. |
| issuedTime | string | Y | The date and time when the event occurred (format: YYYY-MM-DDThh:mm:ss.SSSZ). |
| content | object | Y | Message content |
| content.type | string | Y | Set this parameter to "video". |
| content.fileId | string | Y | Resource ID |
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=" }}It should return HTTP status 200 if successful.
The HTTP request sent by a callback is not resent even if it failed.
HTTP/1.1 200 OKContent-Type: application/jsonServer: YOUR_SERVER_HOST_NAMEContent-Length: 0