Unable to send message from Line API


I need to send messages to a line user on a particular trigger from my website. I do not need that user to reply. The information that I already have is the LINE ID. I have already added the bot/channel as friend successfully.

  1. Trigger on my webpage is working correctly, but the sending of the message fails.
  2. Unable to verify the Webhook URL.


  1. On trying to send message, we receive error saying there is an issue with the 'To' field. But the 'To' account is active, I can successfully send and receive message from that ID using Line. The issue happens only when using the messaging API. * I found that the 'userid' mentioned in the example is different from the 'LINE ID'. So, how can I get the userid from the LINE id?*
  2. When trying to verify the webhook url, it fails with error code '302 Found' when using the POST method. Using the GET method, the error is '405 Method Not Allowed'.


$bot = app('line-bot');

$textMessageBuilder = new \LINE\LINEBot\MessageBuilder\TextMessageBuilder('Hi');
$response = $bot->pushMessage($line_id, $textMessageBuilder);


Create line developer account. Create messageing api channel. Implement line message api Reference Link : https://qiita.com/sh-ogawa/items/2238e579d7ee538025a0


Php : 7.4 Laravel: 5.8

  • 0
  • 6
  • 2038
  • twitter facebook

I will try to get my own userid from Line Dev console and report back here.

  • 0

Hi, Dinson Damien. As Shiraki-san said "userid also get from LINE Developer Console.", you can get your userid via LINE Developer Console. The prefix of userid is "U". Please check it.

Can you try to get your userid from the page and paste it to your source code for test? What will happen?

  • 1

Can anyone please help me?

  • 0


Can anyone please help me with the issue of how to get the userid from the Line ID (from the app)?

Thank you.

  • 0

Shiraki-san, thank you for the reply.

I do not have any group. I have a list of LINE ID in my website DB. For example, 'Takako', 'Yuuki', 'Jackson' I want to send a different message to them one by one. For example, Takako: "Hello Takako-san, i am sending you this message because trigger1 event was caught on our website." Yuuki: "Hello Yuuki-san. Can you please check your email" etc.

"However it should set userId getting from webhook source user object."→ I have the LINE ID of Takako, Yuuki and Jackson from LINE app. But, I do not have the userId (which you mentioned) for Takako or Yuuki or Jackson. So, how can I get the userId corresponding to Takako, Yuuki or Jackson?

  • 0

That line_id is incorrect. It seems set LINE ID (from LINE app). However it should set userId getting from webhook source user object. It also get from LINE Developer Console.


  • 1

Similar posts

    No similar posts

Are you sure? question.vm