line-bot-helper

description

License

License

GroupId

GroupId

org.riversun
ArtifactId

ArtifactId

line-bot-helper
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

line-bot-helper
description
Project URL

Project URL

https://github.com/riversun/line-bot-helper
Source Code Management

Source Code Management

https://github.com/riversun/line-bot-helper

Download line-bot-helper

How to add to project

<!-- https://jarcasting.com/artifacts/org.riversun/line-bot-helper/ -->
<dependency>
    <groupId>org.riversun</groupId>
    <artifactId>line-bot-helper</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.riversun/line-bot-helper/
implementation 'org.riversun:line-bot-helper:1.0.0'
// https://jarcasting.com/artifacts/org.riversun/line-bot-helper/
implementation ("org.riversun:line-bot-helper:1.0.0")
'org.riversun:line-bot-helper:jar:1.0.0'
<dependency org="org.riversun" name="line-bot-helper" rev="1.0.0">
  <artifact name="line-bot-helper" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.riversun', module='line-bot-helper', version='1.0.0')
)
libraryDependencies += "org.riversun" % "line-bot-helper" % "1.0.0"
[org.riversun/line-bot-helper "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.linecorp.bot : line-bot-servlet jar 1.6.0
org.json : json jar 20160810

provided (1)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.1.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.7

Project Modules

There are no modules declared in this project.

Overview

Java library for creating "LINE BOT" as HttpServlet.

It is licensed under MIT.

Maven Central

Example for HttpServlet

@SuppressWarnings("serial")
public class LineBotExample01Servlet extends LineBotServlet {

	private static final String CHANNEL_SECRET ="[YOUR_CHANNEL_SECRET_HERE]" ;
	private static final String CHANNEL_ACCESS_TOKEN ="[YOUR_CHANNEL_ACCESS_TOKEN_HERE]";
	@Override
	protected ReplyMessage handleTextMessageEvent(MessageEvent<TextMessageContent> event) throws IOException {

		TextMessageContent userMessage = event.getMessage();

		// Get user profile
		UserProfileResponse userProfile = getUserProfile(event.getSource().getUserId());


		String botResponseText = "Hi,"+userProfile.getDisplayName() + ","
				+ "You say '" + userMessage.getText() + "' !";

		TextMessage textMessage = new TextMessage(botResponseText);

		return new ReplyMessage(event.getReplyToken(), Arrays.asList(textMessage));
	}

	@Override
	protected ReplyMessage handleDefaultMessageEvent(Event event) {
		//When other messages not overridden as handle* is received, do nothing (returns null)
		return null;
	}

	@Override
	public String getChannelSecret() {
		return CHANNEL_SECRET;
	}

	@Override
	public String getChannelAccessToken() {
		return CHANNEL_ACCESS_TOKEN;
	}

Versions

Version
1.0.0