line-bot-sdk: Haskell SDK for LINE Messaging API

[ bsd3, library, network, web ] [ Propose Tags ] [ Report a vulnerability ]

A Servant library for building LINE chatbots. This package is composed of the following modules:

  • A client library for the LINE Messaging API, including the Line monad, which manages the channel credentials.

  • A servant combinator to write safe Line webhooks.

To get started, see the documentation for the Line.Bot.Client and Line.Bot.Webhook modules below.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.2.0.0, 0.3.0.0, 0.4.0.0, 0.5.0.0, 0.5.0.1, 0.5.0.2, 0.5.1.0, 0.5.2, 0.6.0, 0.7.0, 0.7.1, 0.7.2 (info)
Dependencies aeson (>=1.5.6 && <1.6), base (>=4.14.1 && <4.15), base64-bytestring (>=1.1.0 && <1.2), bytestring (>=0.10.12 && <0.11), cryptohash-sha256 (>=0.11.102 && <0.12), deepseq (>=1.4.4 && <1.5), http-api-data (>=0.4.1.1 && <0.5), http-client (>=0.6.4 && <0.7), http-client-tls (>=0.3.5 && <0.4), http-media (>=0.8.0 && <0.9), http-types (>=0.12.3 && <0.13), mtl (>=2.2.2 && <2.3), servant (>=0.18.2 && <0.19), servant-client (>=0.18.2 && <0.19), servant-client-core (>=0.18.2 && <0.19), servant-server (>=0.18.2 && <0.19), string-conversions (>=0.4.0 && <0.5), text (>=1.2.4 && <1.3), time (>=1.9.3 && <1.10), wai (>=3.2.3 && <3.3) [details]
License BSD-3-Clause
Copyright (c) Alexandre Moreno, 2019-2021
Author Alexandre Moreno
Maintainer Alexandre Moreno <alexmorenocano@gmail.com>
Category Network, Web
Home page https://github.com/moleike/line-bot-sdk#readme
Bug tracker https://github.com/moleike/line-bot-sdk/issues
Source repo head: git clone https://github.com/moleike/line-bot-sdk
Uploaded by moleike at 2021-08-25T02:57:33Z
Distributions
Downloads 4612 total (41 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-08-25 [all 1 reports]

Readme for line-bot-sdk-0.7.2

[back to package description]

line-bot-sdk Build Actions

Servant library for building LINE chatbots.

Features:

  • Servant combinator LineReqBody for validation of request signatures using the channel secret. This is required to distinguish legitimate requests sent by LINE from malicious requests

  • Bindings for (most of) the Messaging APIs

Installation

From Hackage

line-bot-sdk is available on Hackage. Using the cabal-install tool:

cabal update
cabal install line-bot-sdk

From source

Building from source can be done using stack or cabal:

git clone github.com/moleike/line-bot-sdk.git
cd line-bot-sdk
stack install # Alternatively, `cabal install`

Documentation

See the official API documentation for more information.

Usage

{-# LANGUAGE DataKinds         #-}
{-# LANGUAGE OverloadedStrings #-}

import           Data.String        (fromString)
import           Line.Bot.Client
import           Line.Bot.Types
import           System.Environment (getEnv)

getProfiles :: Id Room -> Line [Profile]
getProfiles roomId = do
  userIds <- getRoomMemberUserIds roomId
  sequence $ getRoomMemberProfile roomId <$> userIds

main = do
  token  <- fromString <$> getEnv "CHANNEL_TOKEN"
  result <- runLine (getProfiles "U4af4980629...") token
  case result of
    Left err      -> print err
    Right profile -> print profile

See the examples/ directory for more comprehensive examples.

Contribute

Please report bugs via the github issue tracker.

Acknowledgments

Thanks to the authors of servant-github, for inspiration.