linebot-publisher-layer
The simplest message post module to LINE Bot. It works on AWS Lambda Layer.
Example
Set LINE_BOT_ACCESS_TOKEN
environment variable in advance.
# import module
import linebot_publisher
# create instance
publisher = linebot_publisher.LineBotPublisher()
# post
publisher.post_text(
'xxx', # LINEBOT_TO_ID
'test message'
)
Image of post
Required environment variables
LINEBOT_ACCESS_TOKEN
Access token
Methods
LineBotPublisher(access_token=ACCESS_TOKEN, endpoint=ENDPOINT)
- Constructor.
- If
access_token
is not given, module obtains from environment variable namedLINE_BOT_ACCESS_TOKEN
. endpoint
is defined as 'https://api.line.me/v2/bot/message/push' in module.
post_text(to_id, text, notifies=True)
- Post a LINE message with
text
toto_id
. to_id
is <userId>, <roomId> or <groupId>.- It does not notify user(s) when posts if
notifies
is False. - It returns
Response
object with status code 200.