Download, react, unsend
Find a message ID with line messages CHAT --show-ids or --json:
line download "Alice" --message MESSAGE_ID --output ./received.pdf
line download "Alice" --message IMAGE_MESSAGE_ID --output ./photo.jpg
line download "Weekend Trip" --message ALBUM_MESSAGE_ID --preview 2 --output ./thumb-2.jpg
line react "Alice" --message MESSAGE_ID --reaction love
line react "Alice" --message MESSAGE_ID --remove
line unsend "Alice" --message MY_MESSAGE_IDReactions are like, love, laugh, surprise, sad, and angry. You can
unsend only your own messages, within LINE's rules.
How the message is found#
Downloads, reactions, unsend, and send --reply-to search only the chat you
name, up to 10 pages of 100 messages or 30 seconds, including sign-in recovery.
A shorter --timeout wins. The message must belong to that chat, and unsend
also checks that it's yours. A reply must find its target before any upload,
group-key registration, or send. This is not a global ID search.
| Result | Meaning |
|---|---|
message_not_found | An older page came back empty. |
lookup_incomplete | The 10-page limit was reached. |
deadline_exceeded | The time limit was reached. |
None of these prove the message never existed. Interactive choosers show only
the latest 100 messages; give an older message ID directly to search further.
messages --page can reach further back than this lookup.
Downloads#
download saves image, video, audio, file, and same-chat Album preview
messages up to 20 MiB. Its default deadline is two minutes (--timeout changes
it). The bytes are saved unchanged, so a different output extension doesn't
convert the format. Downloads verify encrypted data before saving, never
overwrite an existing file, and never let the message choose the output path.
Reading or downloading never registers a group encryption key.
For Album posts with preview thumbnails, --preview N picks the thumbnail
(1-based, default 1). Interactive line download marks multi-preview Albums
with (N previews) and asks which one. Notes, Albums shared from another chat,
and Albums without downloadable previews fail with unsupported_content;
--preview on any other attachment fails with invalid_arguments.
Non-encrypted messages that point to external media through a DOWNLOAD_URL
(such as official-account or CDN media) are downloaded from a separate, locked
down connection. It:
- blocks loopback, private, link-local, CGNAT, documentation, reserved, and NAT64-mapped private addresses;
- rejects non-standard ports, user info, and URL fragments;
- follows at most 3 redirects and enforces the 20 MiB limit;
- never sends LINE sign-in headers to external hosts.
Encrypted messages with a DOWNLOAD_URL are rejected, never downloaded without
encryption.
Album previews in scripts#
To find downloadable Album previews, check content.post.preview_count > 0 in
messages --details --json. This covers native type 16 and plaintext type-0
wrappers:
line --error-format=json messages CHAT_ID --details --json --limit 100 |
jq -c '.messages[] | select(.content.post.type == "album" and .content.post.preview_count > 0) |
{chat_id, message_id: .id, title: .content.post.title, preview_count: .content.post.preview_count}'
line --error-format=json download CHAT_ID --message ALBUM_MESSAGE_ID \
--preview 1 --output ./thumb-1.jpg --jsonSend a download to another program#
Use an explicit chat and message ID:
# In Bash or another shell that supports pipefail:
set -o pipefail
line download CHAT_ID --message MESSAGE_ID --output - | consumerReplace consumer with your program. Stdout then carries only the attachment
bytes; diagnostics go to stderr. Prompts and --json aren't available, and the
CLI won't write binary data to a terminal. Use --output ./- for a file
actually named -.
Encrypted media is verified before the first byte is written, so a download or
verification failure produces no output. A broken pipe or cancellation after
output starts can leave partial data, so check the exit status and use
pipefail. To save a file, prefer --output PATH: shell redirection with >
can empty an existing file before the CLI runs.