Options
All
  • Public
  • Public/Protected
  • All
Menu

Module line

Line Platform

Receive events and send messages through LINE messaging API.

Install

npm install @sociably/core @sociably/http @sociably/line
# or with yarn
yarn add @sociably/core @sociably/http @sociably/line

Docs

Check the platform document and the package reference.

Setup

import Sociably from '@sociably/core';
import Http from '@sociably/http';
import Line from '@sociably/line';

const {
LINE_PROVIDER_ID,
LINE_CHANNEL_ID,
LINE_ACCESS_TOKEN,
LINE_CHANNEL_SECRET,
} = process.env;

const app = Sociably.createApp({
modules: [
Http.initModule({ /* ... */ }),
],
platforms: [
Line.intiModule({
webhookPath: '/webhook/line',
providerId: LINE_PROVIDER_ID,
channelId: LINE_CHANNEL_ID,
accessToken: LINE_ACCESS_TOKEN,
channelSecret: LINE_CHANNEL_SECRET,
}),
],
});

Index

Event

Other

ApiCallGettable: { [BULK_REQUEST_GETTER]: any; [CHANNEL_REQUEST_GETTER]: any }

Type declaration

  • [BULK_REQUEST_GETTER]:function
    • [BULK_REQUEST_GETTER](ids: string[]): { body: any; method: "GET" | "POST" | "PUT" | "DELETE"; path: string }
    • Parameters

      • ids: string[]

      Returns { body: any; method: "GET" | "POST" | "PUT" | "DELETE"; path: string }

      • body: any
      • method: "GET" | "POST" | "PUT" | "DELETE"
      • path: string
  • [CHANNEL_REQUEST_GETTER]:function
    • [CHANNEL_REQUEST_GETTER](channel: LineChat): { body: any; method: "GET" | "POST" | "PUT" | "DELETE"; path: string }
    • Parameters

      Returns { body: any; method: "GET" | "POST" | "PUT" | "DELETE"; path: string }

      • body: any
      • method: "GET" | "POST" | "PUT" | "DELETE"
      • path: string
AudioSegmentValue: { duration: number; originalContentUrl: string; type: "audio" } & QuickRepliable
FailMessagingApiResult: { details: { message?: string; property?: string }[]; message: string }

Type declaration

  • details: { message?: string; property?: string }[]
  • message: string
FailOAuthApiResult: { error: string; error_description?: string }

Type declaration

  • error: string
  • Optional error_description?: string
FlexSegmentValue: { altText: string; contents: any; type: "flex" } & QuickRepliable
GroupSource: { groupId: string; type: "group"; userId: string }

Type declaration

  • groupId: string
  • type: "group"
  • userId: string
ImageSegmentValue: { originalContentUrl: string; previewImageUrl: string; type: "image" } & QuickRepliable
ImagemapSegmentValue: { actions: any[]; altText: string; baseSize: { height: number; width: 1040 }; type: "imagemap"; video: { area: { height: number; width: number; x: number; y: number }; externalLink: string; label: string; originalContentUrl: string; previewImageUrl: string } } & QuickRepliable
LineComponent<Props, Segment>: NativeComponent<Props, Segment>

Type parameters

LineConfigs: { accessToken: string; channelId: string; channelSecret?: string; dispatchMiddlewares?: MaybeContainer<LineDispatchMiddleware>[]; eventMiddlewares?: MaybeContainer<LineEventMiddleware>[]; liffId?: string; maxRequestConnections?: number; providerId: string; shouldVerifyRequest?: boolean; webhookPath?: string }

Type declaration

  • accessToken: string

    The access token of the messaging API channel

  • channelId: string

    The id of the messaging API channel

  • Optional channelSecret?: string

    The secret of the messaging API channel

  • Optional dispatchMiddlewares?: MaybeContainer<LineDispatchMiddleware>[]
  • Optional eventMiddlewares?: MaybeContainer<LineEventMiddleware>[]
  • Optional liffId?: string

    The LIFF app id. This is required when using webview

  • Optional maxRequestConnections?: number

    The max API request connections at the same time

  • providerId: string

    The LINE

  • Optional shouldVerifyRequest?: boolean

    To verify the webhook request by the signature or not. Default to true

  • Optional webhookPath?: string

    The webhook path to receive events. Default to /

LineDispatchFrame: DispatchFrame<LineChat, LineJob>
LineDispatchResponse: DispatchResponse<LineJob, LineResult>
LineEventContext: { bot: LineBot; event: LineEvent; metadata: WebhookMetadata; platform: "line"; reply: any }

Type declaration

LineEventMiddleware: EventMiddleware<LineEventContext, null>
LineJob: { body: null | LineMessageRequestBody | unknown; executionKey: undefined | string; method: "GET" | "POST" | "PUT" | "DELETE"; path: string }

Type declaration

  • body: null | LineMessageRequestBody | unknown
  • executionKey: undefined | string
  • method: "GET" | "POST" | "PUT" | "DELETE"
  • path: string
LineMessageRequestBody: ReplyRequestBody | PushRequestBody | MulticastRequestBody
LineRawEvent: { beacon: any; joined: any; left: any; link: any; message: any; postback: any; replyToken: string; source: LineSource; things: any; timestamp: number; type: string }

Type declaration

  • beacon: any
  • joined: any
  • left: any
  • link: any
  • message: any
  • postback: any
  • replyToken: string
  • source: LineSource
  • things: any
  • timestamp: number
  • type: string
LineRawUserProfile: { displayName: string; language?: string; pictureUrl?: string; statusMessage?: string; userId: string }

Type declaration

  • displayName: string
  • Optional language?: string
  • Optional pictureUrl?: string
  • Optional statusMessage?: string
  • userId: string
LineResult: { body: MessagingApiResult; code: number; headers: Record<string, string> }

Type declaration

LineWebhookRequestBody: { destination: string; events: LineRawEvent[] }

Type declaration

LocationSegmentValue: { address: string; latitude: number; longitude: number; title: string; type: "location" } & QuickRepliable
MessagingApiResult: Record<string, any>
QuickRepliable: { quickReply?: { items: { action: any; imageUrl: string; type: "action" }[] } }

Type declaration

  • Optional quickReply?: { items: { action: any; imageUrl: string; type: "action" }[] }
    • items: { action: any; imageUrl: string; type: "action" }[]
RoomSource: { roomId: string; type: "room"; userId: string }

Type declaration

  • roomId: string
  • type: "room"
  • userId: string
StickerSegmentValue: { packageId: string; stickerId: string; type: "sticker" } & QuickRepliable
TemplateSegmentValue: { altText: string; template: any; type: "template" } & QuickRepliable
TextSegmentValue: { text: string; type: "text" } & QuickRepliable
UserSource: { type: "user"; userId: string }

Type declaration

  • type: "user"
  • userId: string
VideoSegmentValue: { originalContentUrl: string; previewImageUrl: string; type: "video" } & QuickRepliable
BULK_REQUEST_GETTER: typeof BULK_REQUEST_GETTER = ...
CHANNEL_REQUEST_GETTER: typeof CHANNEL_REQUEST_GETTER = ...

Generated using TypeDoc