All Projects → line → Line Bot Sdk Go

line / Line Bot Sdk Go

Licence: apache-2.0
LINE Messaging API SDK for Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Line Bot Sdk Go

Line Bot Sdk Nodejs
LINE Messaging API SDK for Node.js
Stars: ✭ 683 (+4.43%)
Mutual labels:  bot, sdk, line
Line Bot Sdk Python
LINE Messaging API SDK for Python
Stars: ✭ 1,198 (+83.18%)
Mutual labels:  bot, sdk, line
Line Bot Sdk Php
LINE Messaging API SDK for PHP
Stars: ✭ 601 (-8.1%)
Mutual labels:  bot, sdk, line
Line Bot Sdk Java
LINE Messaging API SDK for Java
Stars: ✭ 484 (-25.99%)
Mutual labels:  bot, sdk, line
Line Bot Sdk Ruby
LINE Messaging API SDK for Ruby
Stars: ✭ 425 (-35.02%)
Mutual labels:  bot, sdk, line
Line Bot Sdk Perl
LINE Messaging API SDK for Perl
Stars: ✭ 69 (-89.45%)
Mutual labels:  bot, sdk, line
Botbuilder Dotnet
Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
Stars: ✭ 631 (-3.52%)
Mutual labels:  bot, sdk
Botframework Emulator
A desktop application that allows users to locally test and debug chat bots built with the Bot Framework SDK.
Stars: ✭ 1,532 (+134.25%)
Mutual labels:  bot, sdk
Messaging Apis
Messaging APIs for multi-platform
Stars: ✭ 1,754 (+168.2%)
Mutual labels:  bot, line
Line Bot Tutorial
Line bot tutorial.
Stars: ✭ 181 (-72.32%)
Mutual labels:  bot, line
Telegram link line
用Telegram來收發Line的訊息,use telegram to Send and receive messages(from Line)。 或者把它當作Line的訊息備份也是可啦 😛
Stars: ✭ 164 (-74.92%)
Mutual labels:  bot, line
Viber Bot Php
Php bot interface to work with Viber API
Stars: ✭ 202 (-69.11%)
Mutual labels:  bot, sdk
Linesimulator
LINESimulator
Stars: ✭ 103 (-84.25%)
Mutual labels:  bot, line
Botpress
🤖 Dev tools to reliably understand text and automate conversations. Built-in NLU. Connect & deploy on any messaging channel (Slack, MS Teams, website, Telegram, etc).
Stars: ✭ 9,486 (+1350.46%)
Mutual labels:  bot, sdk
Mirai Ts
🔧 Mirai(QQ Bot) JavaScript/TypeScript SDK for Node.js/Browser
Stars: ✭ 86 (-86.85%)
Mutual labels:  bot, sdk
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+238.23%)
Mutual labels:  bot, sdk
Bottender
⚡️ A framework for building conversational user interfaces.
Stars: ✭ 3,803 (+481.5%)
Mutual labels:  bot, line
Botlibre
An open platform for artificial intelligence, chat bots, virtual agents, social media automation, and live chat automation.
Stars: ✭ 412 (-37%)
Mutual labels:  bot, sdk
Matrix Bot Sdk
TypeScript/JavaScript SDK for Matrix bots
Stars: ✭ 63 (-90.37%)
Mutual labels:  bot, sdk
Line Bot Tutorial
line-bot-tutorial use python flask
Stars: ✭ 267 (-59.17%)
Mutual labels:  bot, line

LINE Messaging API SDK for Go

Build Status codecov GoDoc Go Report Card

Introduction

The LINE Messaging API SDK for Go makes it easy to develop bots using LINE Messaging API, and you can create a sample bot within minutes.

Documentation

See the official API documentation for more information.

Requirements

This library requires Go 1.10 or later.

Installation

$ go get github.com/line/line-bot-sdk-go/linebot

Configuration

import (
	"github.com/line/line-bot-sdk-go/linebot"
)

func main() {
	bot, err := linebot.New("<channel secret>", "<channel access token>")
	...
}

Configuration with http.Client

client := &http.Client{}
bot, err := linebot.New("<channel secret>", "<channel accsss token>", linebot.WithHTTPClient(client))
...

How to start

The LINE Messaging API uses the JSON data format. ParseRequest() will help you to parse the *http.Request content and return a slice of Pointer point to Event Object.

events, err := bot.ParseRequest(req)
if err != nil {
	// Do something when something bad happened.
}

The LINE Messaging API defines 7 types of event - EventTypeMessage, EventTypeFollow, EventTypeUnfollow, EventTypeJoin, EventTypeLeave, EventTypePostback, EventTypeBeacon. You can check the event type by using event.Type

for _, event := range events {
	if event.Type == linebot.EventTypeMessage {
		// Do Something...
	}
}

Receiver

To send a message to a user, group, or room, you need either an ID

userID := event.Source.UserID
groupID := event.Source.GroupID
RoomID := event.Source.RoomID

or a reply token.

replyToken := event.ReplyToken

Create message

The LINE Messaging API provides various types of message. To create a message, use New<Type>Message().

leftBtn := linebot.NewMessageAction("left", "left clicked")
rightBtn := linebot.NewMessageAction("right", "right clicked")

template := linebot.NewConfirmTemplate("Hello World", leftBtn, rightBtn)

message := linebot.NewTemplateMessage("Sorry :(, please update your app.", template)

Send message

With an ID, you can send message using PushMessage()

var messages []linebot.SendingMessage

// append some message to messages

_, err := bot.PushMessage(ID, messages...).Do()
if err != nil {
	// Do something when some bad happened
}

With a reply token, you can reply to messages using ReplyMessage()

var messages []linebot.SendingMessage

// append some message to messages

_, err := bot.ReplyMessage(replyToken, messages...).Do()
if err != nil {
	// Do something when some bad happened
}

Help and media

FAQ: https://developers.line.biz/en/faq/

Community Q&A: https://www.line-community.me/questions

News: https://developers.line.biz/en/news/

Twitter: @LINE_DEV

Versioning

This project respects semantic versioning.

See http://semver.org/

Contributing

Please check CONTRIBUTING before making a contribution.

License

Copyright (C) 2016 LINE Corp.
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
 
   http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].