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

[ bsd3, library, network, web ] [ Propose Tags ]

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.4.2 && <1.5), base (>=4.7 && <5), base64-bytestring (>=1.0.0 && <1.1), bytestring (>=0.10.8 && <0.11), cryptohash-sha256 (>=0.11.101 && <0.12), deepseq (>=1.4.2.0 && <1.5), http-api-data (>=0.4 && <0.5), http-client (>=0.5.14 && <0.7), http-client-tls (>=0.3.5 && <0.4), http-media, http-types (>=0.12.2 && <0.13), line-bot-sdk, mtl (>=2.2.2 && <2.3), scientific (>=0.3.6 && <0.4), servant (>=0.16.2 && <0.17), servant-client (>=0.16.0.1 && <0.17), servant-client-core (>=0.16 && <0.17), servant-server (>=0.16.2 && <0.17), string-conversions (>=0.4.0 && <0.5), text (>=1.2.3 && <1.3), time (>=1.8.0 && <1.9), transformers (>=0.5.5 && <0.6), wai (>=3.2.2 && <3.3), wai-extra (>=3.0.25 && <3.1), warp (>=3.2.26 && <3.3) [details]
License BSD-3-Clause
Copyright (c) 2018 Alexandre Moreno
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 2020-02-05T04:50:01Z
Distributions
Executables echo-server
Downloads 4595 total (42 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 2020-02-05 [all 1 reports]

Readme for line-bot-sdk-0.5.2

[back to package description]

line-bot-sdk Build Status

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

The documentation for the latest release is available on Hackage.

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.