GithubHelp home page GithubHelp logo

line / line-bot-sdk-go Goto Github PK

View Code? Open in Web Editor NEW
868.0 55.0 227.0 30.63 MB

LINE Messaging API SDK for Go

Home Page: https://developers.line.biz/en/docs/messaging-api/overview/

License: Apache License 2.0

Go 98.72% Shell 0.21% Python 0.23% Java 0.83%
line bot sdk go golang

line-bot-sdk-go's Introduction

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.20 or later.

Installation

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

Import all packages in your code

import (
	"github.com/line/line-bot-sdk-go/v8/linebot"
	"github.com/line/line-bot-sdk-go/v8/linebot/channel_access_token"
	"github.com/line/line-bot-sdk-go/v8/linebot/insight"
	"github.com/line/line-bot-sdk-go/v8/linebot/liff"
	"github.com/line/line-bot-sdk-go/v8/linebot/manage_audience"
	"github.com/line/line-bot-sdk-go/v8/linebot/messaging_api"
	"github.com/line/line-bot-sdk-go/v8/linebot/module"
	"github.com/line/line-bot-sdk-go/v8/linebot/module_attach"
	"github.com/line/line-bot-sdk-go/v8/linebot/shop"
	"github.com/line/line-bot-sdk-go/v8/linebot/webhook"
)

Configuration

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

func main() {
	bot, err := messaging_api.NewMessagingApiAPI(
		os.Getenv("LINE_CHANNEL_TOKEN"),
	)
	...
}

Configuration with http.Client

Every client application allows configuration with WithHTTPClient and WithEndpoint. (For Blob client, configurations WithBlobHTTPClient and WithBlobEndpoint are also available.)

client := &http.Client{}
bot, err := messaging_api.NewMessagingApiAPI(
	os.Getenv("LINE_CHANNEL_TOKEN"),
	messaging_api.WithHTTPClient(client),
)
...

Getting Started

The LINE Messaging API primarily utilizes the JSON data format. To parse the incoming HTTP requests, the webhook.ParseRequest() method is provided. This method reads the *http.Request content and returns a slice of pointers to Event Objects.

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

cb, err := webhook.ParseRequest(os.Getenv("LINE_CHANNEL_SECRET"), req)
if err != nil {
	// Handle any errors that occur.
}

The LINE Messaging API is capable of handling various event types. The Messaging API SDK automatically unmarshals these events into respective classes like webhook.MessageEvent, webhook.FollowEvent, and so on. You can easily check the type of the event and respond accordingly using a switch statement as shown below:

for _, event := range cb.Events {
	switch e := event.(type) {
		case webhook.MessageEvent:
			// Do Something...
		case webhook.StickerMessageContent:
			// Do Something...
	}
}

We provide code examples.

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.

bot.ReplyMessage(
	&messaging_api.ReplyMessageRequest{
		ReplyToken: e.ReplyToken,
		Messages: []messaging_api.MessageInterface{
			messaging_api.TextMessage{
				Text: replyMessage,
			},
		},
	},
)

Send message

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

bot.PushMessage(
	&messaging_api.PushMessageRequest{
		To: "U.......",
		Messages: []messaging_api.MessageInterface{
			messaging_api.TextMessage{
				Text: replyMessage,
			},
		},
	},
	nil, // x-line-retry-key
)

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

bot.ReplyMessage(
	&messaging_api.ReplyMessageRequest{
		ReplyToken: e.ReplyToken,
		Messages: []messaging_api.MessageInterface{
			messaging_api.TextMessage{
				Text: replyMessage,
			},
		},
	},
)

How to get response header and error message

You may need to store the x-line-request-id header obtained as a response from several APIs. In this case, please use ~WithHttpInfo. You can get headers and status codes. The x-line-accepted-request-id or content-type header can also be obtained in the same way.

resp, _, _ := app.bot.ReplyMessageWithHttpInfo(
	&messaging_api.ReplyMessageRequest{
		ReplyToken: replyToken,
		Messages: []messaging_api.MessageInterface{
			messaging_api.TextMessage{
				Text: "Hello, world",
			},
		},
	}, 
)
log.Printf("status code: (%v), x-line-request-id: (%v)", resp.StatusCode, resp.Header.Get("x-line-request-id"))

Similarly, you can get specific error messages by using ~WithHttpInfo.

resp, _, err := app.bot.ReplyMessageWithHttpInfo(
    &messaging_api.ReplyMessageRequest{
        ReplyToken: replyToken + "invalid",
        Messages: []messaging_api.MessageInterface{
            messaging_api.TextMessage{
                Text: "Hello, world",
            },
        },
    },
)
if err != nil && resp.StatusCode >= 400 && resp.StatusCode < 500 {
    decoder := json.NewDecoder(resp.Body)
    errorResponse := &messaging_api.ErrorResponse{}
    if err := decoder.Decode(&errorResponse); err != nil {
        log.Fatal("failed to decode JSON: %w", err)
    }
    log.Printf("status code: (%v), x-line-request-id: (%v), error response: (%v)", resp.StatusCode, resp.Header.Get("x-line-request-id"), errorResponse)
}

Help and media

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

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

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.

line-bot-sdk-go's People

Contributors

54m avatar clsung avatar david7482 avatar drillbits avatar ethanchoutw avatar github-actions[bot] avatar gotokatsuya avatar hinoguma avatar johanavril avatar justdomepaul avatar k2wanko avatar kawaken avatar kkdai avatar mekpavit avatar mokejp avatar nanato12 avatar nasa9084 avatar oklahomer avatar renovate[bot] avatar s-aska avatar sugyan avatar suzuki-shunsuke avatar thanakorn-ki avatar tokuhirom avatar tonpc64 avatar toyo avatar unnoy avatar wei840222 avatar yang-33 avatar yoshinobc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

line-bot-sdk-go's Issues

proposal: Support for AppEngine

Please support urlfetch.

FYI: https://godoc.org/google.golang.org/appengine/urlfetch

Like this

var bot *linebot.Client

func init() {
    bot = linebot.New(
        os.Getenv("LINE_BOT_CHANNEL_SECRET"),
        os.Getenv("LINE_BOT_CHANNEL_TOKEN"))
}

func handle(w http.ResponseWriter, r *http.Request) {
    ctx := appengine.NewContext(r)
    ...
    if _, err = bot.PushMessage(...).Context(ctx).Do(); err != nil {
        log.Errorf(ctx, "Push Message error: %v", err)
    }
}

サンプルが動作しませんね

https://github.com/line/line-bot-sdk-go/blob/master/examples/echo_bot/server.go
これをmain.goにして、
godepも行い、HEROKUにpushいたしました。

os.Getenv("CHANNEL_SECRET"),
os.Getenv("CHANNEL_TOKEN"),

これらのコードの対応のためにBUISINESS CENTERの自分の設定を行った。

 heroku config:set CHANNEL_SECRET=xxxx
 heroku config:set CHANNEL_TOKEN=xxxx

LINEの管理画面ではWebhook URLには、
https://アカウント.herokuapp.com:443/callbackを設定済み。
heroku logs --tailは問題なし。

Setup Lint

Let's keep the quality of the code.

  • Setup golint
  • Support for CI

Webhook on localhost

Yep I read that I can't use SDK on localhost... but how is possible to develop something without testing? Develop on a production server?
I really don't understand...

Whats the best practice to do a good bot without it?
Thanks!

Build error from GoogleAppEngine Go SDK

Can't build used the golang.org/x/net/context in application.

$ goapp version
go version go1.6.2 (appengine-1.9.40) darwin/amd64
$ goapp serve
INFO     2016-09-29 08:49:52,683 devappserver2.py:769] Skipping SDK update check.
INFO     2016-09-29 08:49:52,731 api_server.py:205] Starting API server at: http://localhost:62372
INFO     2016-09-29 08:49:52,735 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO     2016-09-29 08:49:52,739 admin_server.py:116] Starting admin server at: http://localhost:8000
/usr/local/Cellar/app-engine-go-64/1.9.40/share/app-engine-go-64/google/appengine/tools/devappserver2/mtime_file_watcher.py:115: UserWarning: There are too many files in your application for changes in all of them to be monitored. You may have to restart the development server to see some changes to your files.
  'There are too many files in your application for '
ERROR    2016-09-29 08:49:53,989 go_runtime.py:181] Failed to build Go application: (Executed command: /usr/local/Cellar/app-engine-go-64/1.9.40/share/app-engine-go-64/goroot/bin/go-app-builder -app_base /Users/kazu/src/github.com/k2wanko/linebot-example -arch 6 -dynamic -goroot /usr/local/Cellar/app-engine-go-64/1.9.40/share/app-engine-go-64/goroot -nobuild_files ^^$ -unsafe -gopath /Users/kazu -print_extras_hash app.go)

2016/09/29 17:49:53 go-app-builder: Failed parsing input: package "golang.org/x/net/context" is imported from multiple locations: "/Users/kazu/src/golang.org/x/net/context" and "/Users/kazu/src/github.com/line/line-bot-sdk-go/linebot/vendor/golang.org/x/net/context"

Proposal

remove linebot/vendor dir.

because golang.org/x/net/context is supported 1.6, 1.7.

Vitha

Do this before creating an issue

  • Check the FAQ for LINE bots
  • Make sure your issue is related to the LINE Bot SDK. For general questions or issues about LINE bots, create an issue on the FAQ repository. Note that we don't provide technical support.

When creating an issue

  • Provide detailed information about the issue you had with the SDK
  • Provide logs if possible

Cannot add bot to group

I have no idea why my bot cannot join some group. I try to invite my bot to a group with 39 members, it stuck on Pending member. But when I add the bot to group with 3 members, the bot join automatically
ss

proposal: Use CodeCov

CodeCov is SaaS to visualize code coverage, and useful to improve code quality.

Note that the below samples refer my personal repositories.

Test

Do this before creating an issue

  • Check the FAQ for LINE bots
  • Make sure your issue is related to the LINE Bot SDK. For general questions or issues about LINE bots, create an issue on the FAQ repository. Note that we don't provide technical support.

When creating an issue

  • Provide detailed information about the issue you had with the SDK
  • Provide logs if possible

Get user ID from group chat message

When receiving a message from a room, only the room ID is given as the source of the message. How do I look up the user ID of the sender?

Webhook example

Hi, I am starting using Line Bot SDK, I want to send message to all Bot's friend. I know that webhook can know IDs of all Bot's friend. Is there any example?

Timeline for dropping Go 1.6?

The linebot package currently pulls in 3rd party context and ctxhttp as its only dependencies.

Those are part of the standard library as of Go 1.7. Almost all packages follow the pattern of supporting current and last releases of Go, so this is currently supporting many more versions than any of my other dependencies.

Are there any plans of moving to standard library context with this SDK? Considering the situation around Go and dependency management I guess it's a good idea to have a dependency less package for others to depend on if possible.

How to set "Imagemap message" image files?

Hello! I read "https://github.com/line/line-bot-sdk-go/blob/master/examples/kitchensink/server.go"
has

			linebot.NewImagemapMessage(
				app.appBaseURL+"/static/rich",
				"Imagemap alt text",
				linebot.ImagemapBaseSize{1040, 1040},
				linebot.NewURIImagemapAction("https://store.line.me/family/manga/en", linebot.ImagemapArea{0, 0, 520, 520}),
				linebot.NewURIImagemapAction("https://store.line.me/family/music/en", linebot.ImagemapArea{520, 0, 520, 520}),
				linebot.NewURIImagemapAction("https://store.line.me/family/play/en", linebot.ImagemapArea{0, 520, 520, 520}),
				linebot.NewMessageImagemapAction("URANAI!", linebot.ImagemapArea{520, 520, 520, 520}),
			),

I know app.appBaseURL+"/static/rich" is JPG or PNG file path.
But how can I use ? filename set index.jpg in app.appBaseURL+"/static/rich" path???
or any file name?
or app.appBaseURL+"/static/rich/xxx" (xxx is int)
or ?????

LINE app (android) can not retrieve the audio file

Hi, I not sure if this is the right platform for me to voice this problem. I used Golang line-bot-sdk-go (Messaging API) send audio to my LINE app through a server (Apache server). But my LINE phone app (android) can not play the audio with error message: "Unknown Error. Please wait a moment and try again." From the Apache SSL log, Apache server replied 400 response code which is bad request. It seem like the LINE audio retrieval code can not establish a proper TLS connection with my Apache server. I also tried replace my Apache server with Golang server (HTTP/1.1 and HTTP2) also can not get a proper connection with the audio request where the Golang ServeHTTP(http.ResponseWriter, *http.Request) is never get call though the TCP connection is there. The audio file I sent actually created from my LINE app which received by my Golang application. Note: the path that I sent using the Messaging API is a correct path because simply using Chrome/curl I can get the audio file with 200 response code. And I don't think is the audio file content issue also because the HTTP connection not reach the code opening the audio file.

I mentioned only audio attachment because image and video attachment both successfully sent to my LINE app. If I am in the wrong place to ask question on this problem then you can point me the right place to do so?

About send-message-object text max characters in Golang

Hello, I read "https://devdocs.line.me/en/#send-message-object" and "https://devdocs.line.me/ja/#send-message-object"

Text of Send Message Object
Type = String
Content = メッセージのテキスト 2000 文字以内

If my string is test_string.

test_string := "あaいbうcえdお"
fmt.Println(len(test_string)) // print 19 https://play.golang.org/p/gaj9bbhwGL

The test_string string var characters is 19 or 9?

In Japanese API Reference is 2000 文字以内, but In English API Reference use 2000 characters.

My question is whether he is based on "Golang len ()" to determine the max characters? or not?
If "日本語" = 3? or =9? (https://play.golang.org/p/HtFde0Tbs9)

Suppose today API set Max: 3 characters
test_string:= "日本語" is OK to sent?
Or because len("日本語") == 9 , go to error?


I have a string is Japanese and words over 2000.
I find this way (http://ashitani.jp/golangtips/tips_string.html#string_Extract) to split display.

test_string[0:2000]

But the way is use byte? words will lose. Less than 2000 words.
And I try test_string[0:6000], get error "linebot: APIError 400 The request body has 1 error(s)\n[messages[0].text] Length must be between 0 and 2000" again.


I solved.
I found that the problem is UTF-8.

I refer to the following three sites:

Https://blog.golang.org/strings
Http://stackoverflow.com/questions/15018545/how-to-index-characters-in-a-golang-string
Https://golang.org/ref/spec#Conversions

Finally, in this way solution
Https://play.golang.org/p/S96z8w1xcb

// Used to LINE API send-message
Fmt.Println ("ONE LINE")
Fmt.Println (string ([] rune (test_string) [0: 2000]))
Fmt.Println ("TWO LINE")
Fmt.Println (string ([] rune (test_string) [2000: len ([] rune (test_string))]))

This will solve the long message.

[event.go] doesn't support event of message with file type.

At first, [message.go] doesn't have [MessageTypeFile MessageType = "file"] in MessageType constants.
And MarshalJSON method in [event.go] doesn't have case with file message.
So, linebot can't parse the event of message with file type.

Unexpect callback information on Operation message

Because I use Line-Go-Bot SDK, so I file issue here.

I find the Line Server is not provide expect callback for operation (expecially on opType=4 (Added as friend))

When I try to get opType message on JSON, I get as follow:

{
  "result": [
    {
      "content": {
        "params": [
          "XXX",
          null,
          null
        ],
        "message": null,
        "reqSeq": 0,
        "revision": 932,
        "opType": 4
      },
      "createdTime": 1462860363348,
      "eventType": "138311609100106403",
      "from": "XXX",
      "fromChannel": 1341301815,
      "id": "SOME_ID",
      "to": [
        "MSGID"
      ],
      "toChannel": 1462189304
    }
  ]
}

It missing some data under content so I cannot get any From information by using result.Content() also content.OperationContent().

Here is example from Line Document.

{"result":[
  {
    "from":"u2ddf2eb3c959e561f6c9fa2ea732e7eb8",
    "fromChannel":1341301815,
    "to":["u0cc15697597f61dd8b01cea8b027050e"],
    "toChannel":1441301333,
    "eventType":"138311609000106303",
    "id":"ABCDEF-12345678901",
    "content": {
      "location":null,
      "id":"325708",
      "contentType":1,
      "from":"uff2aec188e58752ee1fb0f9507c6529a",
      "createdTime":1332394961610,
      "to":["u0a556cffd4da0dd89c94fb36e36e1cdc"],
      "toType":1,
      "contentMetadata":null,
      "text":"Hello, BOT API Server!"
    }
  },
  ...
]}

What I should expect is from , id, to under content but we could not get from Line Server callback.

The only way I get user information from Operation Callback is result.RawContent.Params[0] and I don't think it is expected by document.

Please let me know if you need any more detail.

Would it be an option to change the visibility of the private methods in interfaces that embed json.Marshaler?

I am dealing with the current scenario: I am building a proxy that connects multiple messenger services including LINE to an NLP backend (api.ai in that case). For some messages the backend will send something called "custom payload" which is basically a messenger specific JSON string that could be passed through to the messenger without touching.

When using package linebot I will unfortunately have to deparse this Message and construct a new Message (which ends up being the very same) using the supplied methods, which works but is very tedious.

The easiest option would be if I could simply implement interfaces like Message myself. This is not possible due to the fact that the library attaches empty, invisible methods like message() or template() to these interfaces. The fact that they are lowercased/invisible currently makes it impossible to have anything outside of package linebot implement these interfaces.

Is there any reason this is being done? Would you accept a PR (basically consisting of this commit) that changes the visibility of these interface members, thus allowing 3rd parties to implement the libraries interfaces?

something wrong with X-LINE-ChannelSignature?

I always get ErrInvalidSignature. I not sure what I can provide but here is a sample of the failure:

Receiving a message of 'Oiii':

{"result":[{"content":{"toType":1,"createdTime":1462516912667,"from":"u6c618ac3c60c51d4f095afaf45c66613","location":null,"id":"4275142935574","to":["u847398b275fbc83c492eb7a21f26bd94"],"text":"Oiii","contentMetadata":{"AT_RECV_MODE":"2","SKIP_BADGE_COUNT":"true"},"deliveredTime":0,"contentType":1,"seq":null},"createdTime":1462516912718,"eventType":"138311609000106303","from":"u206d25c2ea6bd87c17655609a1c37cb8","fromChannel":1341301815,"id":"WB1519-3426467455","to":["u847398b275fbc83c492eb7a21f26bd94"],"toChannel":1461808908}]}
My secret:
  • d805537ef1a3857ced678b1492e9c0ad
Signature from HTTP header X-LINE-ChannelSignature:
  • DEglPdcEvnIEK1g9I9mx5bBv9OeyLubpmLtU/mbKnN0=
Calculated signature (after encode with base64):
  • l1KIDjDktJNO1khXWtGu3nUgR+/IKhyRRc9HVRXTLPM=

proposal: bot.HandleFunc

Currently, response handler seems to be redundancy to handle events like below.

    http.HandleFunc("/callback", func(w http.ResponseWriter, req *http.Request) {
        events, err := bot.ParseRequest(req)
        if err != nil {
            if err == linebot.ErrInvalidSignature {
                w.WriteHeader(400)
            } else {
                w.WriteHeader(500)
            }
            return
        }
        // code here
    }

So I suggest to add new method client.HandleFunc like below.

diff --git a/linebot/receive.go b/linebot/receive.go
index 5354c8f..92068cb 100644
--- a/linebot/receive.go
+++ b/linebot/receive.go
@@ -279,6 +279,21 @@ func (client *Client) ParseRequest(r *http.Request) (events *ReceivedResults, e
    return
 }

+func (client *Client) HandleFunc(handler func(requests *ReceivedResults)) http.HandlerFunc {
+   return func(w http.ResponseWriter, req *http.Request) {
+       events, err := client.ParseRequest(req)
+       if err != nil {
+           if err == ErrInvalidSignature {
+               w.WriteHeader(400)
+           } else {
+               w.WriteHeader(500)
+           }
+           return
+       }
+       handler(events)
+   }
+}
+
 func (client *Client) validateSignature(signature string, body []byte) bool {
    decoded, err := base64.StdEncoding.DecodeString(signature)
    if err != nil {

Using this method, this part will be shorter.

func main() {
    bot, err := linebot.New(
        os.Getenv("CHANNEL_SECRET"),
        os.Getenv("CHANNEL_TOKEN"),
    )
    if err != nil {
        log.Fatal(err)
    }

    // Setup HTTP Server for receiving requests from LINE platform
    http.HandleFunc("/callback", bot.HandleFunc(events *linebot.ReceivedResults) {
        for _, event := range events {
            if event.Type == linebot.EventTypeMessage {
                switch message := event.Message.(type) {
                case *linebot.TextMessage:
                    source := event.Source
                    if source.Type == linebot.EventSourceTypeUser {
                        if _, err = bot.PushMessage(source.UserID, linebot.NewTextMessage(message.Text)).Do(); err != nil {
                            log.Print(err)
                        }
                    }
                }
            }
        }
    })
    if err := http.ListenAndServe(":"+os.Getenv("PORT"), nil); err != nil {
        log.Fatal(err)
    }
}

Please make thumbnail image optional with NewButtonsTemplate method.

Hi. I want to use NewButtonsTemplate() without thumbnail. I heard other language SDK support without thumbnail. Can you support? Thank you!

APIError 400 A message (messages[0]) in the request body is invalid
[template[@type=buttons].thumbnailImageUrl] must be non-empty text
[template[@type=buttons].thumbnailImageUrl] invalid uri scheme

New LIFF API PR

my new PR: #83

I PR a latest version, please code review and merge to master.

Please close my Before issue: #84

Thanks.

Missing STKVER from webhooks event in API v2

In bot API v1 we can get following sticker info.
{ ... "STKVER": "100", "STKID": "1", "STKPKGID": "1" }

But in v2 it only has stickerId and packageId from webhooks event.
{ ... "packageId": "1", "stickerId": "1" }

Could you please tell me how to get the version of sticker sent by user?

How to use PushMessage with event.Source.UserID

Hi,

I can get the event.Source.UserID from this example but got the following message using PushMessage func.

if _, err = bot.PushMessage(event.Source.UserID, linebot.NewTextMessage(message.Text)).Do(); err != nil {
  log.Print(err)
}

Error Message: linebot: APIError 403 Access to this API is not available for your account

Any thoughts about this issue? Thanks.

sazz

Do this before creating an issue

  • Check the FAQ for LINE bots
  • Make sure your issue is related to the LINE Bot SDK. For general questions or issues about LINE bots, create an issue on the FAQ repository. Note that we don't provide technical support.

When creating an issue

  • Provide detailed information about the issue you had with the SDK
  • Provide logs if possible

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.