LINENotify

LINE API Integration is used for sending a message to LINE Group.

Utilities · LINENotify

Details

IDLINENotify
ProviderLY Corporation
CategoryUtilities
From Version6.0.0
Docker Imagedemisto/python3:3.12.8.3296088
Supported ModulesAgentix XSIAM

README

The LINE API Integration is used for sending a message to LINE Group.

This integration was integrated and tested with LINE version 7.0.3 of LINENotify

Configure LINENotify in Cortex

Parameter Required
Token of LINE Group True

Commands

You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

LINE-send-message


Send message/notification to LINE Group

Base Command

LINE-send-message

Input

Argument Name Description Required
message Message to be sent. Required

Context Output

There is no context output for this command.

Command Example

!line-send-message messgae="Hello World"

Configuration parameters

  • apitoken — Token of LINE Group (required)

Commands (1)

  • line-send-message

    Send message/notification to LINE Group

import demistomock as demisto  # noqa: F401
import requests
from CommonServerPython import *  # noqa: F401

""" MAIN FUNCTION """


def main() -> None:
    api_token = demisto.params().get("apitoken")
    try:
        if demisto.command() == "line-send-message":
            # This is for sending LINE notification to specific group
            headers = {"Authorization": "Bearer " + api_token, "Content-Type": "application/x-www-form-urlencoded"}
            linemsg = demisto.args().get("message")
            payload = {"message": linemsg}
            r = requests.post("https://notify-api.line.me/api/notify", headers=headers, params=payload)
            return_results(r)

        elif demisto.command() == "test-module":
            headers = {"Authorization": "Bearer " + api_token, "Content-Type": "application/x-www-form-urlencoded"}

            result = requests.get("https://notify-api.line.me/api/status", headers=headers)
            if "200" not in str(result):
                return_results(result)
            else:
                return_results("ok")

    # Log exceptions and return errors
    except Exception as e:
        demisto.error(traceback.format_exc())  # print the traceback
        return_error(f"Failed to execute {demisto.command()} command.\nError:\n{e!s}")


""" ENTRY POINT """

if __name__ in ("__main__", "__builtin__", "builtins"):
    main()