Saltar al contenido principal

Integración domótica line-messaging, gratuita y de código abierto

Integración line-messaging para Gladys Assistant

Unofficial: send LINE messages from your scenes through your LINE Official Account.

info

La documentación de esta integración la escribe su autor y, por ahora, solo está disponible en inglés.

Unofficial integration, not affiliated with LY Corporation (LINE). Your Gladys scenes send LINE text messages from your own LINE Official Account, through the official LINE Messaging API (https://api.line.me). Messages go only to the recipients you list in the configuration.

Never tested with a real LINE account yet: the module was built from the official documentation and tested against a fake server that answers as the documentation says.

What you need​

  1. A LINE Official Account with the Messaging API turned on: create a Messaging API channel in the LINE Developers Console.
  2. A long-lived channel access token: Messaging API tab of the channel, "Channel access token", Issue.
  3. The ids of the recipients:
    • your own user id is shown as "Your user ID" in the Basic settings tab of the channel (U followed by 32 characters);
    • another person's user id, a group id (C…) or a room id (R…) are only given by LINE to a webhook (this module does not receive one): read them with a tool of your own, for example the webhook log of the console. A person must have added the account as a friend; the account must be a member of a group.

Configuration​

FieldMeaning
Channel access tokenKept by Gladys in its database, never shown again, sent only to LINE (Authorization header).
Allowed recipientsUp to 10 ids, separated by commas. No message ever goes to another id.
Maximum messages per 24 hours1 to 200, 6 by default. One per recipient, over a rolling 24 hours, kept in /data across a restart.
Maximum text length20 to 5000 characters (LINE's maximum; an emoji counts two). A longer text is cut and ends with "…".
Silent messagesOff by default. When on, the recipients get no push notification.

The monthly quota​

Every message counts in the monthly message quota of your LINE plan. The free quota depends on the country of the account (for example 200 messages a month on the free Communication plan in Japan; see the plans of your country on LINE's business site). A message to a group or a room counts once per member in LINE's quota, but once in this module's cap. When the quota is used up, LINE refuses the messages (429 "monthly limit"): the module then sends nothing for 6 hours and says so in the status; "Check the channel" lifts this pause as soon as LINE reports messages left.

The default cap (6 per 24 hours, about 180 a month) stays under the smallest free quota known; raise it if your plan allows more.

Scene action "Send a LINE message"​

  • Text: the message (variables of the scene allowed).
  • Recipients: empty sends to every allowed recipient; otherwise ids of the allowed list only, separated by commas. An id outside the list refuses the whole action, nothing sent.

Outputs for the next actions: sent (messages accepted by LINE), not_sent (recipients not reached), message_ids (LINE ids, separated by commas), truncated (the text was cut).

Buttons​

  • Check the channel: asks LINE whether the token is accepted, the bot name and the messages used this month. Sends no message.
  • Send a test message: one message (counted in the cap and in the LINE quota) to the recipient typed, or to the first allowed one.

Safety​

  • A message leaves only from the scene action or the test button: nothing at start, on a reconnection, nor when the configuration is saved.
  • One request at a time; at most 20 waiting.
  • A message that may have left (no answer in time, connection cut, 5xx, 409, an undocumented 4xx) is never sent again: a second try could be a second message counted in the quota. The scene log says "sent without confirmation".
  • A message LINE surely refused (400, 401, 403, 404, 413, 429) gives its place in the cap back.
  • A refused token (401) is no longer used by scenes until you type another one, or until a button succeeds with it. Only two 8-bit fingerprints of it are kept in /data.
  • After a 429 rate limit: a pause (Retry-After when given, 60 s to 6 hours); after a 5xx: 60 s, doubled on repeat, 6 hours at most. Kept in /data.
  • While /data cannot be read or written, at most 2 messages per 24 hours leave, since their count could not survive a restart.
  • The token, whole recipient ids and the texts are never written to the logs, the status nor /data (ids are shown as U1a2b…).

Not included​

Receiving messages (webhook), images and other message types, broadcast to every friend, the LINE Notify service (closed by LINE in 2025).

Parámetros de configuración​

Estos son los parámetros que line-messaging te pide en su pantalla de configuración en Gladys.

ParámetroTipoObligatorioDescripción
LINE messages through the Messaging APIsectionNoUnofficial connector, not affiliated with LY Corporation. Your scenes send text messages with the "Send a LINE message" action, from your own LINE Official Account (Messaging API channel) to the allowed recipients below. Every message counts in the monthly message quota of your LINE plan (free quota by country: for example 200 per month on the Japanese free plan); past it, LINE refuses the messages. Messages leave only within the cap per 24 hours below; nothing is ever sent at another time (nothing at start, nor when you save this page), and nothing is received. Create a Messaging API channel in the LINE Developers Console, then issue a long-lived channel access token (Messaging API tab).
Channel access tokensecretSíThe long-lived channel access token of the Messaging API channel. Kept by Gladys in its database, never shown again, sent only to LINE (Authorization header).
Allowed recipientsstringSíThe only LINE ids messages may go to, separated by commas, 10 at most: a user id (U followed by 32 characters; yours is shown as "Your user ID" in the Basic settings of the channel), a group id (C…) or a room id (R…). The person must have added the account as a friend, the account must be in the group. A scene action without recipients sends to all of them.
Maximum messages per 24 hoursnumberNoSafety cap against a runaway scene and the monthly quota: the messages sent over the last 24 hours, one per recipient, 1 to 200 (6 by default, about 200 per month). A message to a group counts here once, but once per member in the LINE quota. Beyond it, nothing is sent and the scene action fails.
Maximum text lengthnumberNoIn characters (an emoji counts two), 20 to 5000 (LINE's maximum). A longer text is cut and ends with "…".
Silent messagesbooleanNoWhen on, the recipients get no push notification for these messages.

Cómo instalar line-messaging en Gladys​

  1. En Gladys, abre Integraciones: line-messaging aparece en el catálogo junto a las integraciones nativas, con una insignia de comunidad.
  2. Haz clic en Instalar. Gladys descarga la imagen Docker (ghcr.io/lm1lc3n7/gladys-line-messaging:0.1.1), la ejecuta en un entorno aislado del núcleo y genera la interfaz de la integración (dispositivos, descubrimiento y configuración).
  3. Abre la pantalla de Configuración de la integración, rellena los parámetros y guarda.
  4. También puedes instalarla directamente desde la URL de su repositorio: https://github.com/LM1LC3N7/gladys-line-messaging.

line-messaging requiere Gladys >=5.1.0. El catálogo de Gladys se actualiza cada hora, así que una nueva versión está disponible como máximo una hora después de publicarse.

¿Todavía no usas Gladys? Es gratuito y de código abierto: sigue la guía de instalación para empezar.

Sobre las integraciones externas​

line-messaging es una integración externa: una integración comunitaria empaquetada como contenedor Docker y publicada en GitHub. Gladys la instala con un clic y la ejecuta en un entorno aislado del núcleo. La publica y mantiene LM1LC3N7, no el equipo principal de Gladys.

Suscríbete a la newsletter de Gladys Assistant

Unos pocos correos al mes sobre nuevas versiones y novedades del proyecto. Enviados por Pierre-Gilles Leymarie, fundador del proyecto. Puedes darte de baja cuando quieras 🙂