Not able to get userId of certain people in group chat.

Hello everyone, Hope you are having a good day!

I am making simple bot that gets user information from Postgres DB and display it to them.Bot is hosted on Heroku. Only problem is it requires userId of user to make sure each user gets what the information related to him.

However for certain users I notifced they don't have userId entry in their webhook requests: For Example: Request Body below:

    destination: "X",
    events: [
            type: "message",
            message: {
                type: "text",
                id: "X",
                text: "!test"
            timestamp: 1627146600103,
            source: {
                type: "group",
                groupId: "X"
            replyToken: "X",
            mode: "active"

while others have userId in source section. Is there any other way to get userId ?

Here's the minimal code that I use to get userID and GroupId:

	body2 = request.get_json()
	app.logger.info("Request body: " + body2)
except KeyError:

Above works perfectly if there are both field in request body. **I read about getting user consent however all the users who didn't had userId don't have any option to consent to chat in their privacy>provide usage option.If there is other way to get consent please let me know. ** Also their every other settings option is same as mine. That's why I am confused why I can acquire some userID and some I cannot. I wanted to add my unique identifier(of my own) to get my code to work but I didn't find any parameter I could re-use from above request. Any Help would be highly appreciated!

Environment: I am using Python linebot SDK : python==3.9.6 line-bot-sdk==1.19.0

  • 0
  • 1
  • 1348
  • twitter facebook


userId: Only users of LINE for iOS and LINE for Android are included in userId. For more information, see Consent on getting user profile information.

  • 0

Similar posts

    No similar posts

Are you sure? question.vm