Options
All
  • Public
  • Public/Protected
  • All
Menu

LINE Notify

Hierarchy

  • LineNotify

Index

Constructors

constructor

Properties

Readonly apiAxios

apiAxios: AxiosInstance

The underlying axios instance for notify-api.line.me APIs.

Readonly axios

axios: AxiosInstance

The underlying axios instance.

Methods

getAuthLink

  • getAuthLink(state: string): string
  • Get Auth Link

    Get The OAuth2 authorization endpoint URI.

    Parameters

    • state: string

      Assigns a token that can be used for responding to CSRF attacks

      CSRF attacks are typically countered by assigning a hash value generated from a user's session ID, and then verifying the state parameter variable when it attempts to access redirect_uri.

      LINE Notify is designed with web applications in mind, and requires state parameter variables.

    Returns string

    The OAuth2 authorization endpoint URI

getStatus

  • getStatus(accessToken: string): Promise<{ message: string; status: number; target: string; targetType: "USER" | "GROUP" }>
  • Get Status

    An API for checking connection status. You can use this API to check the validity of an access token. Acquires the names of related users or groups if acquiring them is possible.

    On the connected service side, it's used to see which groups are configured with a notification and which user the notifications will be sent to. There is no need to check the status with this API before calling /api/notify or /api/revoke.

    If this API receives a status code 401 when called, the access token will be deactivated on LINE Notify (disabled by the user in most cases). Connected services will also delete the connection information.

    Expected use cases

    If a connected service wishes to check the connection status of a certain user

    As LINE Notify also provides the same feature, support for this API is optional.

    Parameters

    • accessToken: string

      the accessToken you want to revoke

    Returns Promise<{ message: string; status: number; target: string; targetType: "USER" | "GROUP" }>

    • status: Value according to HTTP status code.
    • message: Message visible to end-user.
    • targetType: If the notification target is a user: "USER". If the notification target is a group: "GROUP".
    • target: If the notification target is a user, displays user name. If acquisition fails, displays "null". If the notification target is a group, displays group name. If the target user has already left the group, displays "null".

getToken

  • getToken(code: string): Promise<string>
  • Get Token

    The OAuth2 token endpoint.

    Parameters

    • code: string

      Assigns a code parameter value generated during redirection

    Returns Promise<string>

    An access token for authentication.

revokeToken

  • revokeToken(accessToken: string): Promise<{ message: string; status: string }>
  • Revoke Token

    An API used on the connected service side to revoke notification configurations. Using this API will revoke all used access tokens, disabling the access tokens from accessing the API.

    The revocation process on the connected service side is as follows

    1. Call /api/revoke
    2. If step 1 returns status code 200, the request is accepted, revoking all access tokens and ending the process
    3. If step 1 returns status code 401, the access tokens have already been revoked and the connection will be d
    4. If step 1 returns any other status code, the process will end (you can try again at a later time)

    Expected use cases

    When the connected service wishes to end a connection with a user

    As LINE Notify also provides the same feature, support for this API is optional.

    Parameters

    • accessToken: string

      the accessToken you want to revoke

    Returns Promise<{ message: string; status: string }>

    • status: Value according to HTTP status code
    • message: Message visible to end-user

sendNotify

  • sendNotify(accessToken: string, message: string, options?: LineNotifyOptions): Promise<{ message: string; status: string }>
  • Send Notify

    Sends notifications to users or groups that are related to an access token.

    If this API receives a status code 401 when called, the access token will be deactivated on LINE Notify (disabled by the user in most cases). Connected services will also delete the connection information.

    Requests use POST method with application/x-www-form-urlencoded (Identical to the default HTML form transfer type).

    Expected use cases

    When a connected service has an event that needs to send a notification to LINE

    Parameters

    • accessToken: string

      An access token related to users or groups

    • message: string

      The notification content

    • options: LineNotifyOptions = {}

      Other optional parameters

    Returns Promise<{ message: string; status: string }>

    • status: Value according to HTTP status code
    • message: Message visible to end-user

Static connect

Generated using TypeDoc