Skip to content

Releases: line/line-bot-sdk-ruby

v2.3.0 Add an Option to Skip Webhook Signature Verification

24 Sep 01:53
Immutable release. Only release title and notes can be modified.
9eb91a6
Compare
Choose a tag to compare

What's Changed

✨ Add an Option to Skip Webhook Signature Verification

With this release, developers can now optionally skip signature verification when parsing incoming webhook requests. This new capability is especially useful in scenarios where the channel secret may change, potentially causing temporary signature mismatches.

Example Usage:

def parser
  @parser ||= Line::Bot::V2::WebhookParser.new(
    channel_secret: ENV.fetch("LINE_CHANNEL_SECRET"),
    skip_signature_verification: -> { ENV['SKIP_SIGNATURE_VERIFICATION'] == 'true' }
  )
end

When signature verification is skipped, the signatureValidator will not be invoked. This allows webhook requests to be processed even if their signatures do not match the current channel secret used for verification.

This feature is particularly helpful in high-availability systems where avoiding downtime or message loss during configuration updates is critical.

Dependency updates

  • Update dependency rubocop to v1.80.1 by @renovate[bot] in #651
  • Update ruby/setup-ruby action to v1.257.0 by @renovate[bot] in #653
  • Update dependency rack to v3.2.1 by @renovate[bot] in #654
  • Update dependency rubocop to v1.80.2 by @renovate[bot] in #655
  • Update actions/setup-node action to v5 by @renovate[bot] in #656
  • Update actions/stale action to v10 by @renovate[bot] in #657
  • Update actions/github-script action to v7.1.0 by @renovate[bot] in #658
  • Update actions/github-script action to v8 by @renovate[bot] in #659
  • Update dependency rbs to v3.9.5 by @renovate[bot] in #660
  • Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.6.1 by @renovate[bot] in #662
  • Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.4 by @renovate[bot] in #663
  • Update ruby/setup-ruby action to v1.258.0 by @renovate[bot] in #666

Other Changes

  • Set minimumReleaseAge to 7 days to avoid merge renovate PR quickly by @Yang-33 in #661
  • Use github actor id instead of bot name to avoid renaming issues by @Yang-33 in #665

Full Changelog: v2.2.0...v2.3.0

v2.2.0 Support new AudienceGroupType POP_AD_IMP to Audience Group API

26 Aug 01:48
dee4727
Compare
Choose a tag to compare

What's Changed

Support new AudienceGroupType POP_AD_IMP to Audience Group API

  • Add new AudienceGroupType POP_AD_IMP to Audience Group API by @github-actions[bot] in #650

We have supported for the new audience‑group type POP_AD_IMP (POP ad impression audience) to the OpenAPI schema.

Changes Made

  • Updated AudienceGroupType enumeration

    • New value: POP_AD_IMP
    • Description: Audience groups generated from impressions of LINE Beacon Network (POP) ads.
    • Region: Taiwan‑only at launch

Purpose

This update enables correct identification and handling of audience groups built from POP ad impressions, a feature that will be released for the Taiwan market.

Documents and Reference

For more information, please refer to the links provided above.

(original PR is line/line-openapi#113)

Dependency updates

  • Update actions/upload-pages-artifact action to v4 by @renovate[bot] in #645
  • Update ruby/setup-ruby action to v1.256.0 by @renovate[bot] in #646
  • Update actions/setup-java action to v5 by @renovate[bot] in #647
  • Update dependency rubocop to '~> 1.80.0' by @renovate[bot] in #648
  • Update openapi-generator-version to v7.15.0 by @renovate[bot] in #649

Full Changelog: v2.1.1...v2.2.0


This release is prepared by @eucyt

v2.1.1 Clean up webhook code for line things

13 Aug 01:03
a2dc45e
Compare
Choose a tag to compare

What's Changed

LINE Things has been closed. In this release we removed the following LINE Things related webhook code

  • ThingsEvent
  • ThingsContent
  • LinkThingsContent
  • UnlinkThingsContent
  • ScenarioResultThingsContent
  • ScenarioResult
  • ActionResult

As noted in the README, deletions tied to a business shutdown are shipped as a patch version, not a major version. If your code still references any of these code, they will never be emitted again, so you should remove them.

  • Bye line things by @github-actions[bot] in #644
  • Bye line things by @Yang-33 in #643

Dependency updates

Full Changelog: v2.1.0...v2.1.1


This release is prepared by @Yang-33

v2.1.0 Add Coupon API Support to Messaging API

06 Aug 09:39
70cde7f
Compare
Choose a tag to compare

What's Changed

This release introduces Coupon API support to the Messaging API, enabling developers to create, manage, and deliver coupons directly through bot integrations. These new features mirror capabilities previously only available through the LINE Official Account Manager, offering greater flexibility in automating coupon workflows via the Messaging API.

✨ New API Endpoints

💬 Messaging API Enhancements

  • Added support for a new message type: type=coupon
    You can now send coupons directly to users using the Messaging API, similar to sending text, image, or template messages.

📌 Example Use Cases

  • Create a 1000 yen off coupon
  • Send the coupon to a user using the new coupon message type

For detailed usage examples, see the official documentation.

📢 Official Announcement:

LINE Developers News — Coupon API Released (2025/08/06)

line-openapi updates

  • Update line-openapi digest to 69a12e8 by @renovate[bot] in #607
  • Update line-openapi digest to 92f9320 by @renovate[bot] in #610
  • Add Coupon API Support to Messaging API by @github-actions[bot] in #637

Dependency updates

  • Update ruby/setup-ruby action to v1.239.0 by @renovate[bot] in #598
  • Update dependency rubocop to v1.75.6 by @renovate[bot] in #600
  • Update dependency rbs to v3.9.4 by @renovate[bot] in #599
  • Update ruby/setup-ruby action to v1.240.0 by @renovate[bot] in #602
  • Update ruby/setup-ruby action to v1.241.0 by @renovate[bot] in #603
  • Update dependency rack to v3.1.15 by @renovate[bot] in #604
  • Update ruby/setup-ruby action to v1.242.0 by @renovate[bot] in #605
  • Update ruby/setup-ruby action to v1.243.0 by @renovate[bot] in #606
  • Update ruby/setup-ruby action to v1.244.0 by @renovate[bot] in #608
  • Update dependency rubocop to v1.75.7 by @renovate[bot] in #609
  • Update dependency rspec to v3.13.1 by @renovate[bot] in #612
  • Update dependency rubocop to v1.75.8 by @renovate[bot] in #613
  • Update dependency rake to v13.3.0 by @renovate[bot] in #614
  • Update dependency rubocop to '~> 1.76.0' by @renovate[bot] in #615
  • Update dependency org.codehaus.mojo:build-helper-maven-plugin to v3.6.1 by @renovate[bot] in #616
  • Update dependency rack to v3.1.16 by @renovate[bot] in #617
  • Update dependency rubocop to v1.76.1 by @renovate[bot] in #618
  • Update ruby/setup-ruby action to v1.245.0 by @renovate[bot] in #619
  • Update dependency rubocop to v1.76.2 by @renovate[bot] in #620
  • Update dependency rubocop to '~> 1.77.0' by @renovate[bot] in #621
  • Update openapi-generator-version to v7.14.0 by @renovate[bot] in #622
  • Update dependency org.apache.maven.plugins:maven-enforcer-plugin to v3.6.0 by @renovate[bot] in #623
  • Update dependency rubocop to '~> 1.78.0' by @renovate[bot] in #624
  • Update dependency org.apache.maven.plugins:maven-enforcer-plugin to v3.6.1 by @renovate[bot] in #625
  • Update ruby/setup-ruby action to v1.246.0 by @renovate[bot] in #626
  • Update ruby/setup-ruby action to v1.247.0 by @renovate[bot] in #627
  • Update ruby/setup-ruby action to v1.248.0 by @renovate[bot] in #628
  • Update dependency rubocop to '~> 1.79.0' by @renovate[bot] in #629
  • Update ruby/setup-ruby action to v1.249.0 by @renovate[bot] in #630
  • Update ruby/setup-ruby action to v1.252.0 by @renovate[bot] in #631
  • Update ruby/setup-ruby action to v1.253.0 by @renovate[bot] in #632
  • Update ruby/setup-ruby action to v1.254.0 by @renovate[bot] in #633
  • Update dependency rack to v3.2.0 by @renovate[bot] in #634
  • Update dependency rubocop to v1.79.1 by @renovate[bot] in #635
  • Update dependency rubocop to v1.79.2 by @renovate[bot] in #636

Other Changes

New Contributors

Full Changelog: v2.0.0...v2.1.0

v2.0.0 Support All Messaging API Features and RBS

12 May 09:58
6e5663f
Compare
Choose a tag to compare

Overview

v2.0.0 is a completely new version.

  • The previous code released up to v1.29.1 will be called "v1",
  • The new code released as v2.0.0 and later versions will be called "v2".

v2 has significant breaking changes because it's a completely new implementation with an entirely different interface.
As a result, any implementation based on the previous codebase will no longer function.

If you already use v1, please use the transitional version v1.30.0 and do the migration.
Migration guide: https://github.com/line/line-bot-sdk-ruby/releases/tag/v1.30.0

New users should always use v2.
And we strongly recommend migrating to v2.

Why you should use v2

Support All Messaging API Features

v2 now supports every API endpoints and Webhook event types that were previously unimplemented.
Future API additions will be rapidly integrated, ensuring your application always stays up-to-date with the latest features by using line-bot-api gem.

Because v2 is automatically generated from https://github.com/line/line-openapi, same with SDKs provided for other programming languages.

RBS Support for Enhanced Development Experience

v2 comes with RBS (Ruby Signature) support, enabling you to leverage type checking and other type-based development features for a more robust coding experience.

Examples

There are several examples available for v2 to assist you in your implementation.

Feedbacks & Contributions

We welcome feedback and contributions.

v1.30.0 Transitional release for v2

12 May 04:14
f8da531
Compare
Choose a tag to compare

Overview

v1.30.0 is a transitional version for v2.0.0.

  • The previous code released up to v1.29.1 will be called "v1",
  • The new code released as v2.0.0 and later versions will be called "v2".

v1.30.0 includes both the v1 and v2 codebases.

v2 has significant breaking changes because it's a completely new implementation with an entirely different interface.
As a result, any implementation based on the previous codebase will no longer function.

New users should always use v2.
And we strongly recommend migrating to v2.

Why you should use v2

Support All Messaging API Features

v2 now supports every API endpoints and Webhook event types that were previously unimplemented.
Future API additions will be rapidly integrated, ensuring your application always stays up-to-date with the latest features by using line-bot-api gem.

Because v2 is automatically generated from https://github.com/line/line-openapi, same with SDKs provided for other programming languages.

RBS Support for Enhanced Development Experience

v2 comes with RBS (Ruby Signature) support, enabling you to leverage type checking and other type-based development features for a more robust coding experience.

Migration Guide: From v1 to v2

Users can perform the migration step at their own pace. Follow these steps:

  1. Upgrade the line-bot-api gem to 1.30.0.
  2. Migrate v1 code to v2 code. All v1 code issues deprecation warnings, so please migrate until they are gone. Since v1.30.0 includes all v1 and v2 code, you don't have to replace everything at once. You can switch gradually.
  3. Once all code is switched, upgrade line-bot-api to 2.0.0 or above.

Change all v1 implementations to v2 implementations in v1.30.0

v1.30.0 includes both the v1 and v2 codebases.

When you use the v1 code in v1.30.0, you will see deprecation warnings such as:

[DEPRECATION] Line::Bot::Client#push_message is deprecated. Please use Line::Bot::V2::MessagingApi::ApiClient#push_message instead.

These warnings indicate which methods to use in the new v2 code.

Alternatively, the YARD documentation/comments also clearly indicate where to migrate.

# https://github.com/line/line-bot-sdk-ruby/blob/fb449ba19201a57c5f58dcd19ea67c5a53b0a0fe/lib/line/bot/v1/client.rb#L277-L288

# @deprecated
# This is deprecated.
# Please use {Line::Bot::V2::MessagingApi::ApiClient#push_message} instead.
#
# Push messages to a user using user_id.
#
# @param user_id [String] User Id
# @param messages [Hash, Array] Message Objects
# @param headers [Hash] HTTP Headers
# @param payload [Hash] Additional request body
# @return [Net::HTTPResponse]
def push_message(user_id, messages, headers: {}, payload: {})

Once v1 code usage is completely removed in v1.30.0, please switch to v2.0.0 >= version immediately.
Starting with v2.0.0, v1 code is not included.

Suppress deprecation warnings

You can suppress the deprecation warning by setting any value to ENV['SUPRESS_V1_DEPRECATION_WARNINGS'].

However, it's not recommended to always use it as it could lead to migration errors.

Clients

There are several types of API clients.
Depending on the classification of the API, there are several types of clients.

  • MassagingAPI.
  • ManageAudience
  • Inshight
  • ChannelAccessToken
  • Liff
  • Shop
    and so on.

In addition, the same MessagingApi is divided into ApiBlobClient for APIs that use https://api-data.line.me to upload and download files.

  • Line::Bot::V2::MessagingApi::ApiClient.
  • Line::Bot::V2::MessagingApi::ApiBlobClient.

These are planned to be integrated in the future, but this has not yet been accomplished.

Migration examples

Only typical examples are shown here.
Please refer to Examples in the next chapter for more examples.

Calling API

v1

client = Line::Bot::Client.new do |config|
  config.channel_token = ENV.fetch("LINE_CHANNEL_ACCESS_TOKEN")
end

response = client.push_message(
  'U1234567890abcdef1234567890abcdef',
  [
    {
      type: 'text',
      text: 'Hello, this is a test message!'
    }
  ]
)

puts response.class # => Net::HTTPResponse

v2 (with class)

client = Line::Bot::V2::MessagingApi::ApiClient.new(
  channel_access_token: ENV.fetch("LINE_CHANNEL_ACCESS_TOKEN")
)

message = Line::Bot::V2::MessagingApi::TextMessage.new( # No need to pass `type: "text"`
  text: 'Hello, this is a test message!'
)

request = Line::Bot::V2::MessagingApi::PushMessageRequest.new(
  to: 'U1234567890abcdef1234567890abcdef',
  messages: [
    message
  ]
)

response, status_code, response_headers = client.push_message_with_http_info(
  push_message_request: request
)

puts response.class # => Line::Bot::V2::MessagingApi::PushMessageResponse

v2 (with Hash)

This is not a recommended way.
Please use one of the above methods if possible.

However, this method makes migration from v1 easier.

client = Line::Bot::V2::MessagingApi::ApiClient.new(
  channel_access_token: ENV.fetch("LINE_CHANNEL_ACCESS_TOKEN")
)

request = Line::Bot::V2::MessagingApi::PushMessageRequest.new(
  to: 'U1234567890abcdef1234567890abcdef',
  messages: [
    {
      type: 'text',
      text: 'Hello, this is a test message!'
    }
  ]
)

response, status_code, response_headers = client.push_message_with_http_info(
  push_message_request: request
)

puts response.class # => Line::Bot::V2::MessagingApi::PushMessageResponse

Handling Webhook

v1

require 'sinatra' 
require 'line/bot' 

def client
  @client ||= Line::Bot::Client.new { |config|
    config.channel_secret = ENV["LINE_CHANNEL_SECRET"]
    config.channel_token = ENV["LINE_CHANNEL_TOKEN"]
  }
end

post '/callback' do
  body = request.body.read

  signature = request.env['HTTP_X_LINE_SIGNATURE']
  unless client.validate_signature(body, signature)
    halt 400, {'Content-Type' => 'text/plain'}, 'Bad Request'
  end

  events = client.parse_events_from(body)

  events.each do |event|
    case event
    when Line::Bot::Event::Message
      case event.type
      when Line::Bot::Event::MessageType::Text
        message = {
          type: 'text',
          text: event.message['text']
        }
        client.reply_message(event['replyToken'], message)
      end
    end
  end

  "OK"
end

v2

require 'sinatra'
require 'line-bot-api'

set :environment, :production

def client
  @client ||= Line::Bot::V2::MessagingApi::ApiClient.new(
    channel_access_token: ENV.fetch("LINE_CHANNEL_ACCESS_TOKEN")
  )
end

def parser
  @parser ||= Line::Bot::V2::WebhookParser.new(channel_secret: ENV.fetch("LINE_CHANNEL_SECRET"))
end

post '/callback' do
  body = request.body.read
  signature = request.env['HTTP_X_LINE_SIGNATURE']

  begin
    events = parser.parse(body: body, signature: signature)
  rescue Line::Bot::V2::WebhookParser::InvalidSignatureError
    halt 400, { 'Content-Type' => 'text/plain' }, 'Bad Request'
  end

  events.each do |event|
    case event
    when Line::Bot::V2::Webhook::MessageEvent
      case event.message
      when Line::Bot::V2::Webhook::TextMessageContent
        message = event.message.text
        request = Line::Bot::V2::MessagingApi::ReplyMessageRequest.new(
          reply_token: event.reply_token,
          messages: [
            Line::Bot::V2::MessagingApi::TextMessage.new(text: message)
          ]
        )
        client.reply_message(reply_message_request: request)
      end
    end
  end

  "OK"
end

Examples

There are several examples available for v2 to assist you in your implementation.

Feedbacks & Contributions

We welcome feedback and contributions.

v1.29.1 Update dependencies

15 Nov 05:15
Compare
Choose a tag to compare

What's Changed

Library(line-bot-api) itself is not changed.

Dependency updates

  • chore(deps): update dependency rubocop to '~> 1.65.0' by @renovate in #330
  • chore(deps): update dependency rubocop to '~> 1.66.0' by @renovate in #331
  • chore(deps): update actions/checkout digest to eef6144 by @renovate in #334
  • chore(deps): update dependency rubocop to '~> 1.67.0' by @renovate in #335
  • chore(deps): update actions/checkout digest to 11bd719 by @renovate in #336
  • chore(deps): update dependency rubocop to '~> 1.68.0' by @renovate in #338

Other Changes

  • chore(deps): update dependency rubocop to '~> 1.49.0' by @renovate in #286
  • chore(deps): update dependency rubocop to '~> 1.50.0' by @renovate in #287
  • chore(deps): update dependency rubocop to '~> 1.51.0' by @renovate in #288
  • chore(deps): update dependency rubocop to '~> 1.52.0' by @renovate in #289
  • chore(deps): update dependency rubocop to '~> 1.53.0' by @renovate in #290
  • chore(deps): update dependency rubocop to '~> 1.54.0' by @renovate in #293
  • chore(deps): update dependency rubocop to '~> 1.55.0' by @renovate in #297
  • chore(deps): update actions/checkout action to v4 by @renovate in #300
  • chore(deps): update dependency rubocop to '~> 1.56.0' by @renovate in #298
  • chore(deps): update dependency rubocop to '~> 1.57.0' by @renovate in #305
  • chore(deps): update actions/checkout digest to b4ffde6 by @renovate in #303
  • Close stale issue automatically by @Yang-33 in #306
  • Enable merge queue by @Yang-33 in #307
  • Import release.yml to generate release note automatically based on label by @Yang-33 in #308
  • chore(deps): update actions/stale action to v9 by @renovate in #310
  • Drop Ruby 2.7 and support Ruby 3.2 & 3.3 by @Yang-33 in #313
  • chore(deps): update dependency rubocop to '~> 1.60.0' by @renovate in #309
  • Remove unnecessary urls from README by @Yang-33 in #315
  • chore(deps): update dependency rubocop to '~> 1.62.0' by @renovate in #316
  • Drop Ruby 3.0 support by @Yang-33 in #317
  • Delete unused travis-ci url from README.md by @Yang-33 in #318
  • chore(deps): update dependency rubocop to '~> 1.63.0' by @renovate in #319
  • chore(deps): update actions/checkout digest to 1d96c77 by @renovate in #321
  • chore(deps): update actions/checkout digest to 0ad4b8f by @renovate in #322
  • chore(deps): update actions/checkout digest to a5ac7e5 by @renovate in #324
  • chore(deps): update dependency rubocop to '~> 1.64.0' by @renovate in #325
  • feat: Support LINE notification messages API by @linhnv in #326
  • v1.29.0 by @zenizh in #327
  • chore(deps): update actions/checkout digest to 692973e by @renovate in #328
  • Update renovate.json by @Yang-33 in #329
  • Automate publish by @Yang-33 in #339

New Contributors

Full Changelog: v1.28.0...v1.29.1

Release v1.29.0

10 Jun 22:52
Compare
Choose a tag to compare

v1.29.0 (2024-06-10)

Full Changelog

Closed issues:

  • Write supported ruby version explicitly #311
  • Bug Report #291

Merged pull requests:

Release v1.28.0

14 Mar 03:58
43e6102
Compare
Choose a tag to compare

v1.28.0 (2023-03-14)

Full Changelog

Merged pull requests:

Release v1.27.0

08 Feb 05:25
7beb5bc
Compare
Choose a tag to compare

v1.27.0 (2023-02-08)

Full Changelog

Closed issues:

  • Create chat bot with conversation loop and save message to database #272
  • Messaging API - January 2021 update #215

Merged pull requests: