linebot.models package

linebot.models.actions module

linebot.models.actions module.

class linebot.models.actions.Action(**kwargs)[source]

Bases: Base

Abstract base class of Action.

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.actions.PostbackAction(label=None, data=None, display_text=None, text=None, input_option=None, fill_in_text=None, **kwargs)[source]

Bases: Action

PostbackAction.

https://developers.line.me/en/docs/messaging-api/reference/#postback-action

When a control associated with this action is tapped, a postback event is returned via webhook with the specified string in the data property.

__init__(label=None, data=None, display_text=None, text=None, input_option=None, fill_in_text=None, **kwargs)[source]

__init__ method.

Parameters
  • label (str) – Label for the action.

  • data (str) – String returned via webhook in the postback.data property of the postback event.

  • display_text (str) – Text displayed in the chat as a message sent by the user when the action is performed.

  • text (str) – Deprecated. Text displayed in the chat as a message sent by the user when the action is performed. Returned from the server through a webhook.

  • kwargs

class linebot.models.actions.MessageAction(label=None, text=None, **kwargs)[source]

Bases: Action

MessageAction.

https://developers.line.me/en/docs/messaging-api/reference/#message-action

When a control associated with this action is tapped, the string in the text property is sent as a message from the user.

__init__(label=None, text=None, **kwargs)[source]

__init__ method.

Parameters
  • label (str) – Label for the action.

  • text (str) – Text sent when the action is performed.

  • kwargs

class linebot.models.actions.URIAction(label=None, uri=None, alt_uri=None, **kwargs)[source]

Bases: Action

URIAction.

https://developers.line.me/en/docs/messaging-api/reference/#uri-action

When a control associated with this action is tapped, the URI specified in the uri property is opened.

__init__(label=None, uri=None, alt_uri=None, **kwargs)[source]

__init__ method.

Parameters
  • label (str) – Label for the action Max: 20 characters

  • uri (str) – URI opened when the action is performed.

  • alt_uri (T <= linebot.models.actions.AltUri) – URI opened when the desktop app.

  • kwargs

class linebot.models.actions.AltUri(desktop=None, **kwargs)[source]

Bases: Base

AltUri.

https://github.com/line/line-bot-sdk-python/issues/155

URI opened when the desktop app.

__init__(desktop=None, **kwargs)[source]

__init__ method.

Parameters
  • desktop (str) – URI opened on LINE for macOS and Windows when the action is performed. If the altUri.desktop property is set, the uri property is ignored on LINE for macOS and Windows.

  • kwargs

class linebot.models.actions.DatetimePickerAction(label=None, data=None, mode=None, initial=None, max=None, min=None, **kwargs)[source]

Bases: Action

DatetimePickerAction.

https://developers.line.me/en/docs/messaging-api/reference/#datetime-picker-action

When a control associated with this action is tapped, a postback event is returned via webhook with the date and time selected by the user from the date and time selection dialog. The datetime picker action does not support time zones.

__init__(label=None, data=None, mode=None, initial=None, max=None, min=None, **kwargs)[source]

__init__ method.

Parameters
  • label (str) – Label for the action

  • data (str) – String returned via webhook in the postback.data property of the postback event

  • mode (str) – Action mode date: Pick date time: Pick time datetime: Pick date and time

  • initial (str) – Initial value of date or time

  • max (str) – Largest date or time value that can be selected. Must be greater than the min value.

  • min (str) – Smallest date or time value that can be selected. Must be less than the max value.

  • kwargs

class linebot.models.actions.CameraAction(label=None, **kwargs)[source]

Bases: Action

CameraAction.

https://developers.line.me/en/reference/messaging-api/#camera-action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the camera screen in the LINE app is opened.

__init__(label=None, **kwargs)[source]

__init__ method.

Parameters
  • label (str) – Label for the action

  • kwargs

class linebot.models.actions.CameraRollAction(label=None, **kwargs)[source]

Bases: Action

CameraRollAction.

https://developers.line.me/en/reference/messaging-api/#camera-roll-action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the camera roll screen in the LINE app is opened.

__init__(label=None, **kwargs)[source]

__init__ method.

Parameters
  • label (str) – Label for the action

  • kwargs

class linebot.models.actions.LocationAction(label=None, **kwargs)[source]

Bases: Action

LocationRollAction.

https://developers.line.me/en/reference/messaging-api/#location-action

This action can be configured only with quick reply buttons. When a button associated with this action is tapped, the location screen in the LINE app is opened.

__init__(label=None, **kwargs)[source]

__init__ method.

Parameters
  • label (str) – Label for the action

  • kwargs

class linebot.models.actions.RichMenuSwitchAction(label=None, rich_menu_alias_id=None, data=None, **kwargs)[source]

Bases: Action

RichMenuSwitchAction.

https://developers.line.biz/en/reference/messaging-api/#richmenu-switch-action

This action can be configured only with rich menus. It can’t be used for Flex Messages or quick replies. When you tap a rich menu associated with this action, you can switch between rich menus, and a postback event including the rich menu alias ID selected

by the user is returned via a webhook.

__init__(label=None, rich_menu_alias_id=None, data=None, **kwargs)[source]

__init__ method.

Parameters
  • label (str) – Label for the action

  • rich_menu_alias_id (str) – Rich menu alias ID to switch to.

  • data (str) – String returned by the postback.data property of the postback event via a webhook

  • kwargs

linebot.models.base module

linebot.models.base module.

class linebot.models.base.Base(**kwargs)[source]

Bases: object

Base class of model.

Suitable for JSON base data.

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

as_json_string()[source]

Return JSON string from this object.

Return type

str

as_json_dict()[source]

Return dictionary from this object.

Returns

dict

classmethod new_from_json_dict(data)[source]

Create a new instance from a dict.

Parameters

data – JSON dict

static get_or_new_from_json_dict(data, cls)[source]

Get cls object w/ deserialization from json if needed.

If data is instance of cls, return data. Else if data is instance of dict, create instance from dict. Else, return None.

Parameters
  • data

  • cls

Return type

object

static get_or_new_from_json_dict_with_types(data, cls_map, type_key='type')[source]

Get cls object w/ deserialization from json by using type key hint if needed.

If data is instance of one of cls, return data. Else if data is instance of dict, create instance from dict. Else, return None.

Parameters
  • data

  • cls_map

  • type_key

Return type

object

linebot.models.error module

linebot.models.error module.

class linebot.models.error.Error(message=None, details=None, **kwargs)[source]

Bases: Base

Error response of LINE messaging API.

https://developers.line.biz/en/reference/messaging-api/#error-response

__init__(message=None, details=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.error.ErrorDetail(message=None, property=None, **kwargs)[source]

Bases: Base

ErrorDetail response of LINE messaging API.

__init__(message=None, property=None, **kwargs)[source]

__init__ method.

Parameters
  • message (str) – Details of the error message

  • property (str) – Related property

  • kwargs

linebot.models.events module

linebot.models.events module.

class linebot.models.events.Event(mode=None, timestamp=None, source=None, webhook_event_id=None, delivery_context=None, **kwargs)[source]

Bases: Base

Abstract Base Class of Webhook Event.

https://developers.line.biz/en/reference/messaging-api/#webhook-event-objects

__init__(mode=None, timestamp=None, source=None, webhook_event_id=None, delivery_context=None, **kwargs)[source]

__init__ method.

Parameters
  • mode (str) – Channel state

  • timestamp (long) – Time of the event in milliseconds

  • source (T <= linebot.models.sources.Source) – Source object

  • kwargs

class linebot.models.events.MessageEvent(mode=None, timestamp=None, source=None, reply_token=None, message=None, **kwargs)[source]

Bases: Event

Webhook MessageEvent.

https://developers.line.biz/en/reference/messaging-api/#message-event

Event object which contains the sent message. The message field contains a message object which corresponds with the message type. You can reply to message events.

__init__(mode=None, timestamp=None, source=None, reply_token=None, message=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.events.FollowEvent(mode=None, timestamp=None, source=None, reply_token=None, **kwargs)[source]

Bases: Event

Webhook FollowEvent.

https://developers.line.biz/en/reference/messaging-api/#follow-event

Event object for when your account is added as a friend (or unblocked). You can reply to follow events.

__init__(mode=None, timestamp=None, source=None, reply_token=None, **kwargs)[source]

__init__ method.

Parameters
  • mode (str) – Channel state

  • timestamp (long) – Time of the event in milliseconds

  • source (T <= linebot.models.sources.Source) – Source object

  • reply_token (str) – Reply token

  • kwargs

class linebot.models.events.UnfollowEvent(mode=None, timestamp=None, source=None, **kwargs)[source]

Bases: Event

Webhook UnfollowEvent.

https://developers.line.biz/en/reference/messaging-api/#unfollow-event

Event object for when your account is blocked.

__init__(mode=None, timestamp=None, source=None, **kwargs)[source]

__init__ method.

Parameters
  • mode (str) – Channel state

  • timestamp (long) – Time of the event in milliseconds

  • source (T <= linebot.models.sources.Source) – Source object

  • kwargs

class linebot.models.events.JoinEvent(mode=None, timestamp=None, source=None, reply_token=None, **kwargs)[source]

Bases: Event

Webhook JoinEvent.

https://developers.line.biz/en/reference/messaging-api/#join-event

Event object for when your account joins a group or talk room. You can reply to join events.

__init__(mode=None, timestamp=None, source=None, reply_token=None, **kwargs)[source]

__init__ method.

Parameters
  • mode (str) – Channel state

  • timestamp (long) – Time of the event in milliseconds

  • source (T <= linebot.models.sources.Source) – Source object

  • reply_token (str) – Reply token

  • kwargs

class linebot.models.events.LeaveEvent(mode=None, timestamp=None, source=None, **kwargs)[source]

Bases: Event

Webhook LeaveEvent.

https://developers.line.biz/en/reference/messaging-api/#leave-event

Event object for when your account leaves a group.

__init__(mode=None, timestamp=None, source=None, **kwargs)[source]

__init__ method.

Parameters
  • mode (str) – Channel state

  • timestamp (long) – Time of the event in milliseconds

  • source (T <= linebot.models.sources.Source) – Source object

  • kwargs

class linebot.models.events.PostbackEvent(mode=None, timestamp=None, source=None, reply_token=None, postback=None, **kwargs)[source]

Bases: Event

Webhook PostbackEvent.

https://developers.line.biz/en/reference/messaging-api/#postback-event

Event object for when a user performs an action on a template message which initiates a postback. You can reply to postback events.

__init__(mode=None, timestamp=None, source=None, reply_token=None, postback=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.events.BeaconEvent(mode=None, timestamp=None, source=None, reply_token=None, beacon=None, **kwargs)[source]

Bases: Event

Webhook BeaconEvent.

https://developers.line.biz/en/reference/messaging-api/#beacon-event

Event object for when a user detects a LINE Beacon. You can reply to beacon events.

__init__(mode=None, timestamp=None, source=None, reply_token=None, beacon=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.events.MemberJoinedEvent(mode=None, timestamp=None, source=None, reply_token=None, joined=None, **kwargs)[source]

Bases: Event

Webhook MemberJoinedEvent.

https://developers.line.biz/en/reference/messaging-api/#member-joined-event

Event object for when a user joins a group or room that the bot is in.

__init__(mode=None, timestamp=None, source=None, reply_token=None, joined=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.events.MemberLeftEvent(mode=None, timestamp=None, source=None, left=None, **kwargs)[source]

Bases: Event

Webhook MemberLeftEvent.

https://developers.line.biz/en/reference/messaging-api/#member-left-event

Event object for when a user leaves a group or room that the bot is in.

__init__(mode=None, timestamp=None, source=None, left=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.events.AccountLinkEvent(mode=None, timestamp=None, source=None, reply_token=None, link=None, **kwargs)[source]

Bases: Event

Webhook AccountLinkEvent.

https://developers.line.me/en/docs/messaging-api/reference/#account-link-event

Event object for when a user has linked his/her LINE account with a provider’s service account. You can reply to account link events. If the link token has expired or has already been used, no webhook event will be sent and the user will be shown an error.

__init__(mode=None, timestamp=None, source=None, reply_token=None, link=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.events.ThingsEvent(mode=None, timestamp=None, source=None, reply_token=None, things=None, **kwargs)[source]

Bases: Event

Webhook ThingsEvent.

https://developers.line.biz/en/reference/messaging-api/#device-link-event https://developers.line.biz/en/reference/messaging-api/#device-unlink-event https://developers.line.biz/en/reference/messaging-api/#scenario-result-event

Event sent from LINE Things Webhook service.

__init__(mode=None, timestamp=None, source=None, reply_token=None, things=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.events.UnsendEvent(mode=None, timestamp=None, source=None, unsend=None, **kwargs)[source]

Bases: Event

Webhook UnsendEvent.

https://developers.line.biz/en/reference/messaging-api/#unsend-event

Event object for when the user unsends a message in a group or room.

__init__(mode=None, timestamp=None, source=None, unsend=None, **kwargs)[source]

__init__ method.

Parameters
  • mode (str) – Channel state

  • timestamp (long) – Time of the event in milliseconds

  • source (T <= linebot.models.sources.Source) – Source object

  • unsend (T <= linebot.models.unsend.Unsend) – Unsend object

  • kwargs

class linebot.models.events.VideoPlayCompleteEvent(mode=None, timestamp=None, source=None, reply_token=None, video_play_complete=None, **kwargs)[source]

Bases: Event

Webhook VideoCompleteEvent.

https://developers.line.biz/en/reference/messaging-api/#video-viewing-complete

Event object Event for when a user finishes viewing a video at least once.

__init__(mode=None, timestamp=None, source=None, reply_token=None, video_play_complete=None, **kwargs)[source]

__init__ method.

Parameters
  • mode (str) – Channel state

  • timestamp (long) – Time of the event in milliseconds

  • source (T <= linebot.models.sources.Source) – Source object

  • reply_token (str) – Reply token

  • video_play_complete (T <= linebot.models.video_play_complete.VideoPlayComplete) – VideoPlayComplete object

  • kwargs

class linebot.models.events.Postback(data=None, params=None, **kwargs)[source]

Bases: Base

Postback.

https://developers.line.biz/en/reference/messaging-api/#postback-event

__init__(data=None, params=None, **kwargs)[source]

__init__ method.

Parameters
  • data (str) – Postback data

  • params (dict) – JSON object with the date and time selected by a user through a datetime picker action. Only returned for postback actions via the datetime picker.

  • kwargs

class linebot.models.events.Beacon(type=None, hwid=None, dm=None, **kwargs)[source]

Bases: Base

Beacon.

https://developers.line.biz/en/reference/messaging-api/#beacon-event

__init__(type=None, hwid=None, dm=None, **kwargs)[source]

__init__ method.

Parameters
  • type (str) – Type of beacon event

  • hwid (str) – Hardware ID of the beacon that was detected

  • dm (str) – Optional. Device message of beacon which is hex string

  • kwargs

property device_message

Get dm(device_message) as bytearray.

Return type

bytearray

class linebot.models.events.Joined(members=None, **kwargs)[source]

Bases: Base

Joined.

https://developers.line.biz/en/reference/messaging-api/#member-joined-event

__init__(members=None, **kwargs)[source]

__init__ method.

Parameters
  • members (dict) – Member of users who joined

  • kwargs

property members

Get members as list of SourceUser.

class linebot.models.events.Left(members=None, **kwargs)[source]

Bases: Base

Left.

https://developers.line.biz/en/reference/messaging-api/#member-left-event

__init__(members=None, **kwargs)[source]

__init__ method.

Parameters
  • members (dict) – Member of users who joined

  • kwargs

property members

Get members as list of SourceUser.

Bases: Base

Link.

https://developers.line.me/en/docs/messaging-api/reference/#link-object

__init__(result=None, nonce=None, **kwargs)[source]

__init__ method.

Parameters
  • result (str) – Indicate whether the link was successful or not.

  • nonce (str) – Specified nonce when verifying the user ID.

linebot.models.filter module

linebot.models.filter module.

class linebot.models.filter.Filter(demographic=None, **kwargs)[source]

Bases: Base

Filter.

https://developers.line.biz/en/reference/messaging-api/#narrowcast-demographic-filter

A filter is the top-level structure of a demographic element.

__init__(demographic=None, **kwargs)[source]

__init__ method.

Parameters
  • demographic (linebot.model.filter.DemographicFilter | linebot.model.operator.Operator) – Combination of different criteria using logical operator objects.

  • kwargs

class linebot.models.filter.DemographicFilter(**kwargs)[source]

Bases: Filter

DemographicFilter.

https://developers.line.biz/en/reference/messaging-api/#narrowcast-demographic-filter

Demographic filter objects represent criteria (e.g. age, gender, OS, region, and friendship duration) on which to filter the list of recipients. You can filter recipients based on a combination of different criteria using logical operator objects.

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.filter.GenderFilter(one_of=None, **kwargs)[source]

Bases: DemographicFilter

GenderFilter.

__init__(one_of=None, **kwargs)[source]

__init__ method.

Parameters

one_of (list[str]) – Send messages to users of a given gender. One of: male: Users who identify as male female: Users who identify as female

class linebot.models.filter.AppTypeFilter(one_of=None, **kwargs)[source]

Bases: DemographicFilter

AppTypeFilter.

__init__(one_of=None, **kwargs)[source]

__init__ method.

Parameters

one_of (list[str]) – Send messages to users of the specified OS. One of: ios: Users who using iOS. android: Users who using Android.

class linebot.models.filter.AreaFilter(one_of=None, **kwargs)[source]

Bases: DemographicFilter

AreaFilter.

__init__(one_of=None, **kwargs)[source]

__init__ method.

Parameters

one_of (list[str]) – Send messages to users in the specified region.

class linebot.models.filter.AgeFilter(gte=None, lt=None, **kwargs)[source]

Bases: DemographicFilter

AgeFilter.

This lets you filter recipients with a given age range.

__init__(gte=None, lt=None, **kwargs)[source]

__init__ method.

Be sure to specify either gte, lt, or both.

Parameters
  • gte (str) – Send messages to users at least as old as the specified age.

  • lt (str) – Send messages to users younger than the specified age. You can specify the same values as for the gte property.

class linebot.models.filter.SubscriptionPeriodFilter(gte=None, lt=None, **kwargs)[source]

Bases: DemographicFilter

SubscriptionPeriodFilter.

This lets you filter recipients with a given range of friendship durations.

__init__(gte=None, lt=None, **kwargs)[source]

__init__ method.

Be sure to specify either gte, lt, or both.

Parameters
  • gte (str) – Send messages to users who have been friends of yours for at least the specified number of days

  • lt (str) – Send messages to users who have been friends of yours for less than the specified number of days. You can specify the same values as for the gte property.

linebot.models.flex_message module

linebot.models.flex_message module.

class linebot.models.flex_message.FlexSendMessage(alt_text=None, contents=None, **kwargs)[source]

Bases: SendMessage

FlexSendMessage.

https://developers.line.biz/en/reference/messaging-api/#flex-message

Flex Messages are messages with a customizable layout. You can customize the layout freely by combining multiple elements.

__init__(alt_text=None, contents=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.flex_message.FlexContainer(**kwargs)[source]

Bases: Base

FlexContainer.

https://developers.line.biz/en/reference/messaging-api/#container

A container is the top-level structure of a Flex Message.

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.flex_message.BubbleContainer(size=None, direction=None, header=None, hero=None, body=None, footer=None, styles=None, action=None, **kwargs)[source]

Bases: FlexContainer

BubbleContainer.

https://developers.line.biz/en/reference/messaging-api/#bubble

This is a container that contains one message bubble. It can contain four blocks: header, hero, body, and footer.

__init__(size=None, direction=None, header=None, hero=None, body=None, footer=None, styles=None, action=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.flex_message.BubbleStyle(header=None, hero=None, body=None, footer=None, **kwargs)[source]

Bases: Base

BubbleStyle.

https://developers.line.biz/en/reference/messaging-api/#bubble-style

__init__(header=None, hero=None, body=None, footer=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.flex_message.BlockStyle(background_color=None, separator=None, separator_color=None, **kwargs)[source]

Bases: Base

BlockStyle.

https://developers.line.biz/en/reference/messaging-api/#block-style

__init__(background_color=None, separator=None, separator_color=None, **kwargs)[source]

__init__ method.

Parameters
  • background_color (str) – Background color of the block. Use a hexadecimal color code

  • separator (bool) – True to place a separator above the block True will be ignored for the first block in a container because you cannot place a separator above the first block. The default value is False

  • separator_color (str) – Color of the separator. Use a hexadecimal color code

  • kwargs

class linebot.models.flex_message.CarouselContainer(contents=None, **kwargs)[source]

Bases: FlexContainer

CarouselContainer.

https://developers.line.biz/en/reference/messaging-api/#f-carousel

This is a container that contains multiple bubble containers, or message bubbles. The bubbles will be shown in order by scrolling horizontally.

__init__(contents=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.flex_message.FlexComponent(**kwargs)[source]

Bases: Base

FlexComponent.

https://developers.line.biz/en/reference/messaging-api/#component

Components are objects that compose a Flex Message container.

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.flex_message.BoxComponent(layout=None, contents=None, background_color=None, border_color=None, border_width=None, corner_radius=None, justify_content=None, align_items=None, background=None, width=None, max_width=None, height=None, max_height=None, flex=None, spacing=None, margin=None, padding_all=None, padding_top=None, padding_bottom=None, padding_start=None, padding_end=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, action=None, **kwargs)[source]

Bases: FlexComponent

BoxComponent.

https://developers.line.biz/en/reference/messaging-api/#box

This is a component that defines the layout of child components. You can also include a box in a box.

__init__(layout=None, contents=None, background_color=None, border_color=None, border_width=None, corner_radius=None, justify_content=None, align_items=None, background=None, width=None, max_width=None, height=None, max_height=None, flex=None, spacing=None, margin=None, padding_all=None, padding_top=None, padding_bottom=None, padding_start=None, padding_end=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, action=None, **kwargs)[source]

__init__ method.

Parameters
  • layout (str) – The placement style of components in this box

  • contents (list[T <= linebot.models.flex_message.FlexComponent]) – Components in this box

  • background_color (str) – Background color of the block

  • border_color (str) – Color of box border

  • border_width (str) – Width of box border

  • corner_radius (str) – Radius at the time of rounding the corners of the border

  • justify_content (str) – How child elements are aligned along the main axis of the parent element

  • align_items (str) – How child elements are aligned along the cross axis of the parent element

  • background (T <= linebot.models.background.Background) – Background object

  • width (str) – Width of the box

  • max_width (str) – Maximum width of the box

  • height (str) – Height of the box

  • max_height (str) – Maximum height of the box

  • flex (float) – The ratio of the width or height of this box within the parent box and the previous component in the parent box

  • spacing (str) – Minimum space between components in this box

  • margin (str) – Minimum space between this box

  • padding_all (str) – Free space between the borders of this box and the child element

  • padding_top (str) – Free space between the border at the upper end of this box and the upper end of the child element

  • padding_bottom (str) – Free space between the border at the lower end of this box and the lower end of the child element

  • padding_start (str) – Free space between the border at the left end of this box and the left end of the child element

  • padding_end (str) – Free space between the border at the right end of this box and the right end of the child element

  • position (str) – Reference position for placing this box

  • offset_top (str) – The top offset

  • offset_bottom (str) – The bottom offset

  • offset_start (str) – The left offset

  • offset_end (str) – The right offset

  • action (list[T <= linebot.models.actions.Action]) – Action performed when this button is tapped

  • kwargs

class linebot.models.flex_message.ButtonComponent(action=None, flex=None, margin=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, height=None, style=None, color=None, gravity=None, adjust_mode=None, **kwargs)[source]

Bases: FlexComponent

ButtonComponent.

https://developers.line.biz/en/reference/messaging-api/#button

This component draws a button. When the user taps a button, a specified action is performed.

__init__(action=None, flex=None, margin=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, height=None, style=None, color=None, gravity=None, adjust_mode=None, **kwargs)[source]

__init__ method.

Parameters
  • action (list[T <= linebot.models.actions.Action]) – Action performed when this button is tapped

  • flex (float) – The ratio of the width or height of this component within the parent box

  • margin (str) – Minimum space between this component and the previous component in the parent box

  • position (str) – Reference position for placing this box

  • offset_top (str) – The top offset

  • offset_bottom (str) – The bottom offset

  • offset_start (str) – The left offset

  • offset_end (str) – The right offset

  • height (str) – Height of the button

  • style (str) – Style of the button

  • color (str) – Character color when the style property is link. Background color when the style property is primary or secondary. Use a hexadecimal color code

  • gravity (str) – Vertical alignment style

  • adjust_mode (str) – The method by which to adjust the text font size

  • kwargs

class linebot.models.flex_message.FillerComponent(flex=None, **kwargs)[source]

Bases: FlexComponent

FillerComponent.

https://developers.line.biz/en/reference/messaging-api/#filler

This is an invisible component to fill extra space between components.

__init__(flex=None, **kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.flex_message.IconComponent(url=None, margin=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, size=None, aspect_ratio=None, **kwargs)[source]

Bases: FlexComponent

IconComponent.

https://developers.line.biz/en/reference/messaging-api/#icon

This component draws an icon.

__init__(url=None, margin=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, size=None, aspect_ratio=None, **kwargs)[source]

__init__ method.

Parameters
  • url (str) – Image URL Protocol: HTTPS Image format: JPEG or PNG

  • margin (str) – Minimum space between this component and the previous component in the parent box

  • position (str) – Reference position for placing this box

  • offset_top (str) – The top offset

  • offset_bottom (str) – The bottom offset

  • offset_start (str) – The left offset

  • offset_end (str) – The right offset

  • size (str) – Maximum size of the icon width

  • aspect_ratio (str) – Aspect ratio of the icon

  • kwargs

class linebot.models.flex_message.ImageComponent(url=None, flex=None, margin=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, align=None, gravity=None, size=None, aspect_ratio=None, aspect_mode=None, background_color=None, action=None, animated=False, **kwargs)[source]

Bases: FlexComponent

ImageComponent.

https://developers.line.biz/en/reference/messaging-api/#f-image

This component draws an image.

__init__(url=None, flex=None, margin=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, align=None, gravity=None, size=None, aspect_ratio=None, aspect_mode=None, background_color=None, action=None, animated=False, **kwargs)[source]

__init__ method.

Parameters
  • url (str) – Image URL Protocol: HTTPS Image format: JPEG or PNG

  • flex (float) – The ratio of the width or height of this component within the parent box

  • margin (str) – Minimum space between this component and the previous component in the parent box

  • position (str) – Reference position for placing this box

  • offset_top (str) – The top offset

  • offset_bottom (str) – The bottom offset

  • offset_start (str) – The left offset

  • offset_end (str) – The right offset

  • align (str) – Horizontal alignment style

  • gravity (str) – Vertical alignment style

  • size (str) – Maximum size of the image width

  • aspect_ratio (str) – Aspect ratio of the image

  • aspect_mode (str) – Style of the image

  • background_color (str) – Background color of the image. Use a hexadecimal color code.

  • action (list[T <= linebot.models.actions.Action]) – Action performed when this image is tapped

  • animated (bool) – True to play an animated image. Default is False.

  • kwargs

class linebot.models.flex_message.SeparatorComponent(margin=None, color=None, **kwargs)[source]

Bases: FlexComponent

SeparatorComponent.

https://developers.line.biz/en/reference/messaging-api/#separator

This component draws a separator between components in the parent box.

__init__(margin=None, color=None, **kwargs)[source]

__init__ method.

Parameters
  • margin (str) – Minimum space between this component and the previous component in the parent box

  • color (str) – Color of the separator. Use a hexadecimal color code

  • kwargs

class linebot.models.flex_message.SpanComponent(text=None, color=None, size=None, weight=None, style=None, decoration=None, **kwargs)[source]

Bases: FlexComponent

SpanComponent.

https://developers.line.biz/en/reference/messaging-api/#span

This component renders multiple text strings with different designs in one row.

__init__(text=None, color=None, size=None, weight=None, style=None, decoration=None, **kwargs)[source]

__init__ method.

Parameters
  • text (str) – Text

  • color (str) – Font color

  • size (str) – Font size

  • weight (str) – Font weight

  • style (str) – Style of the text

  • decoration (str) – Decoration of the text

  • kwargs

class linebot.models.flex_message.TextComponent(text=None, contents=None, flex=None, margin=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, size=None, align=None, gravity=None, wrap=None, line_spacing=None, max_lines=None, weight=None, color=None, action=None, style=None, decoration=None, **kwargs)[source]

Bases: FlexComponent

TextComponent.

https://developers.line.biz/en/reference/messaging-api/#f-text

This component draws text. You can format the text.

__init__(text=None, contents=None, flex=None, margin=None, position=None, offset_top=None, offset_bottom=None, offset_start=None, offset_end=None, size=None, align=None, gravity=None, wrap=None, line_spacing=None, max_lines=None, weight=None, color=None, action=None, style=None, decoration=None, **kwargs)[source]

__init__ method.

Parameters
  • text (str) – Text

  • contents (list[T <= linebot.models.flex_message.SpanComponent]) – Array of spans

  • flex (float) – The ratio of the width or height of this component within the parent box

  • margin (str) – Minimum space between this component and the previous component in the parent box

  • position (str) – Reference position for placing this box

  • offset_top (str) – The top offset

  • offset_bottom (str) – The bottom offset

  • offset_start (str) – The left offset

  • offset_end (str) – The right offset

  • size (str) – Font size

  • align (str) – Horizontal alignment style

  • gravity (str) – Vertical alignment style

  • wrap (bool) – rue to wrap text. The default value is False. If set to True, you can use a new line character (n) to begin on a new line.

  • line_spacing (str) – Line spacing in a wrapping text

  • max_lines (int) – Max number of lines

  • weight (str) – Font weight

  • color (str) – Font color

  • action (list[T <= linebot.models.actions.Action]) – Action performed when this image is tapped

  • style (str) – Style of the text

  • decoration (str) – Decoration of the text

  • kwargs

class linebot.models.flex_message.VideoComponent(url=None, preview_url=None, alt_content=None, aspect_ratio=None, action=None, **kwargs)[source]

Bases: FlexComponent

VideoComponent.

https://developers.line.biz/en/reference/messaging-api/#f-video

This component renders a video.

__init__(url=None, preview_url=None, alt_content=None, aspect_ratio=None, action=None, **kwargs)[source]

__init__ method.

Parameters

linebot.models.imagemap module

linebot.models.imagemap module.

class linebot.models.imagemap.ImagemapSendMessage(base_url=None, alt_text=None, base_size=None, video=None, actions=None, **kwargs)[source]

Bases: SendMessage

ImagemapSendMessage.

https://developers.line.biz/en/reference/messaging-api/#imagemap-message

Imagemaps are images with one or more links. You can assign one link for the entire image or multiple links which correspond to different regions of the image.

__init__(base_url=None, alt_text=None, base_size=None, video=None, actions=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.imagemap.BaseSize(width=None, height=None, **kwargs)[source]

Bases: Base

BaseSize.

https://developers.line.biz/en/reference/messaging-api/#imagemap-message

__init__(width=None, height=None, **kwargs)[source]

__init__ method.

Parameters
  • width (int) – Width of base image (set to 1040px)

  • height (int) – Height of base image(set to the height that corresponds to a width of 1040px

  • kwargs

class linebot.models.imagemap.ImagemapAction(**kwargs)[source]

Bases: Base

ImagemapAction.

https://developers.line.biz/en/reference/messaging-api/#imagemap-message

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.imagemap.URIImagemapAction(link_uri=None, area=None, **kwargs)[source]

Bases: ImagemapAction

URIImagemapAction.

https://developers.line.biz/en/reference/messaging-api/#imagemap-message

__init__(link_uri=None, area=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.imagemap.MessageImagemapAction(text=None, area=None, **kwargs)[source]

Bases: ImagemapAction

MessageImagemapAction.

https://developers.line.biz/en/reference/messaging-api/#imagemap-message

__init__(text=None, area=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.imagemap.ImagemapArea(x=None, y=None, width=None, height=None, **kwargs)[source]

Bases: Base

ImagemapArea.

https://developers.line.biz/en/reference/messaging-api/#imagemap-area-object

Defines the size of the full imagemap with the width as 1040px. The top left is used as the origin of the area.

__init__(x=None, y=None, width=None, height=None, **kwargs)[source]

__init__ method.

Parameters
  • x (int) – Horizontal position of the tappable area

  • y (int) – Vertical position of the tappable area

  • width (int) – Width of the tappable area

  • height (int) – Height of the tappable area

  • kwargs

class linebot.models.imagemap.Video(original_content_url=None, preview_image_url=None, area=None, external_link=None, **kwargs)[source]

Bases: Base

Video.

https://developers.line.biz/en/reference/messaging-api/#imagemap-message

Defines the properties of the video object in imagemap.

__init__(original_content_url=None, preview_image_url=None, area=None, external_link=None, **kwargs)[source]

__init__ method.

Parameters

Bases: Base

ExternalLink.

https://developers.line.biz/en/reference/messaging-api/#imagemap-message

Defines URL and label of external link in video.

__init__(link_uri=None, label=None, **kwargs)[source]

__init__ method.

Parameters
  • link_uri (str) – Webpage URL

  • label (str) – Label

  • kwargs

linebot.models.insight module

linebot.models.insight module.

class linebot.models.insight.DemographicInsight(percentage=None, **kwargs)[source]

Bases: Base

Abstract Base Class of DemographicInsight.

__init__(percentage=None, **kwargs)[source]

__init__ method.

Parameters
  • percentage (float) – Percentage.

  • kwargs

class linebot.models.insight.GenderInsight(percentage=None, gender=None, **kwargs)[source]

Bases: DemographicInsight

GenderInsight.

__init__(percentage=None, gender=None, **kwargs)[source]

__init__ method.

Parameters
  • percentage (float) – Percentage.

  • gender (str) – Gender

  • kwargs

class linebot.models.insight.AgeInsight(percentage=None, age=None, **kwargs)[source]

Bases: DemographicInsight

AgeInsight.

__init__(percentage=None, age=None, **kwargs)[source]

__init__ method.

Parameters
  • percentage (float) – Percentage.

  • age (str) – Age

  • kwargs

class linebot.models.insight.AreaInsight(percentage=None, area=None, **kwargs)[source]

Bases: DemographicInsight

AreaInsight.

__init__(percentage=None, area=None, **kwargs)[source]

__init__ method.

Parameters
  • percentage (float) – Percentage.

  • area (str) – Area

  • kwargs

class linebot.models.insight.AppTypeInsight(percentage=None, app_type=None, **kwargs)[source]

Bases: DemographicInsight

AppTypeInsight.

__init__(percentage=None, app_type=None, **kwargs)[source]

__init__ method.

Parameters
  • percentage (float) – Percentage.

  • app_type (str) – OS

  • kwargs

class linebot.models.insight.SubscriptionPeriodInsight(percentage=None, subscription_period=None, **kwargs)[source]

Bases: DemographicInsight

SubscriptionPeriodInsight.

__init__(percentage=None, subscription_period=None, **kwargs)[source]

__init__ method.

Parameters
  • percentage (float) – Percentage.

  • subscription_period (str) – Friendship duration

  • kwargs

class linebot.models.insight.MessageStatistics(request_id=None, timestamp=None, delivered=None, unique_impression=None, unique_click=None, unique_media_played=None, unique_media_played_100_percent=None, **kwargs)[source]

Bases: Base

MessageStatistics.

__init__(request_id=None, timestamp=None, delivered=None, unique_impression=None, unique_click=None, unique_media_played=None, unique_media_played_100_percent=None, **kwargs)[source]

__init__ method.

Parameters
  • request_id (str) – Request ID.

  • timestamp (int) – UNIX timestamp for message delivery time.

  • delivered (int) – Number of messages delivered. This property shows values of less than 20.

  • unique_impression (int) – Number of people who opened the message, meaning they displayed at least 1 bubble.

  • unique_click (int) – Number of people who opened any URL in the message.

  • unique_media_played (int) – Number of people who started playing any video or audio in the message.

  • unique_media_played_100_percent (int) – Number of people who played the entirety of any video or audio in the message.

class linebot.models.insight.MessageStatisticsOfCustomAggregationUnit(unique_impression=None, unique_click=None, unique_media_played=None, unique_media_played_100_percent=None, **kwargs)[source]

Bases: Base

MessageStatisticsOfCustomAggregationUnit.

__init__(unique_impression=None, unique_click=None, unique_media_played=None, unique_media_played_100_percent=None, **kwargs)[source]

__init__ method.

Parameters
  • unique_impression (int) – Number of people who opened the message, meaning they displayed at least 1 bubble.

  • unique_click (int) – Number of people who opened any URL in the message.

  • unique_media_played (int) – Number of people who started playing any video or audio in the message.

  • unique_media_played_100_percent (int) – Number of people who played the entirety of any video or audio in the message.

class linebot.models.insight.MessageInsight(seq=None, impression=None, media_played=None, media_played_25_percent=None, media_played_50_percent=None, media_played_75_percent=None, media_played_100_percent=None, unique_media_played=None, unique_media_played_25_percent=None, unique_media_played_50_percent=None, unique_media_played_75_percent=None, unique_media_played_100_percent=None, **kwargs)[source]

Bases: Base

MessageInsight.

__init__(seq=None, impression=None, media_played=None, media_played_25_percent=None, media_played_50_percent=None, media_played_75_percent=None, media_played_100_percent=None, unique_media_played=None, unique_media_played_25_percent=None, unique_media_played_50_percent=None, unique_media_played_75_percent=None, unique_media_played_100_percent=None, **kwargs)[source]

__init__ method.

Parameters
  • seq (int) – Bubble’s serial number.

  • impression (int) – Number of times the bubble was displayed.

  • media_played (int) – Number of times audio or video in the bubble started playing.

  • media_played_25_percent (int) – Number of times audio or video in the bubble was played from start to 25%.

  • media_played_50_percent (int) – Number of times audio or video in the bubble was played from start to 50%.

  • media_played_75_percent (int) – Number of times audio or video in the bubble was played from start to 75%.

  • media_played_100_percent (int) – Number of times audio or video in the bubble was played in its entirety.

  • unique_media_played (int) – Number of people that started playing audio or video in the bubble.

  • unique_media_played_25_percent (int) – Number of people that played audio or video in the bubble from start to 25%.

  • unique_media_played_50_percent (int) – Number of people that played audio or video in the bubble from start to 50%.

  • unique_media_played_75_percent (int) – Number of people that played audio or video in the bubble from start to 75%.

  • unique_media_played_100_percent (int) – Number of people that played audio or video in the bubble in its entirety.

class linebot.models.insight.ClickInsight(seq=None, url=None, click=None, unique_click=None, unique_click_of_request=None, **kwargs)[source]

Bases: Base

ClickInsight.

__init__(seq=None, url=None, click=None, unique_click=None, unique_click_of_request=None, **kwargs)[source]

__init__ method.

Parameters
  • seq (int) – The URL’s serial number.

  • url (str) – URL.

  • click (int) – Number of times the URL was opened.

  • unique_click (int) – Number of people that opened the URL.

  • unique_click_of_request (int) – Number of people who opened this url through any link in the message.

class linebot.models.insight.JobInsight(audience_group_job_id=None, audience_group_id=None, description=None, type=None, job_status=None, failed_type=None, audience_count=None, created=None, **kwargs)[source]

Bases: Base

ClickInsight.

__init__(audience_group_job_id=None, audience_group_id=None, description=None, type=None, job_status=None, failed_type=None, audience_count=None, created=None, **kwargs)[source]

__init__ method.

Parameters
  • audience_group_job_id (int) – A job ID.

  • audience_group_id (int) – An audience ID.

  • description (str) – The job’s description.

  • type (str) – The job’s type. One of: ‘DIFF_ADD’

  • job_status (str) – The job’s status. One of: ‘QUEUED’, ‘WORKING’, ‘FINISHED’, ‘FAILED’

  • failed_type (str) – The reason why the operation failed. This is only included when jobs[].jobStatus is FAILED.

  • audience_count (int) – The number of accounts (recipients) that were added or removed.

  • created (int) – When the job was created (in UNIX time).

  • kwargs

linebot.models.limit module

linebot.models.recipient module.

class linebot.models.limit.Limit(max=None, up_to_remaining_quota=False, **kwargs)[source]

Bases: Base

Limit.

https://developers.line.biz/en/reference/messaging-api/#send-narrowcast-message

__init__(max=None, up_to_remaining_quota=False, **kwargs)[source]

__init__ method.

Parameters

kwargs

linebot.models.messages module

linebot.models.messages module.

class linebot.models.messages.Message(id=None, **kwargs)[source]

Bases: Base

Abstract Base Class of Message.

__init__(id=None, **kwargs)[source]

__init__ method.

Parameters
  • id (str) – Message ID

  • kwargs

class linebot.models.messages.TextMessage(id=None, text=None, emojis=None, mention=None, **kwargs)[source]

Bases: Message

TextMessage.

https://developers.line.biz/en/reference/messaging-api/#wh-text

Message object which contains the text sent from the source.

__init__(id=None, text=None, emojis=None, mention=None, **kwargs)[source]

__init__ method.

Parameters
  • id (str) – Message ID

  • text (str) – Message text

  • emojis (List) – Array of LINE emoji objects

  • mention (object) – LINE mention object

  • kwargs

class linebot.models.messages.ImageMessage(id=None, content_provider=None, image_set=None, **kwargs)[source]

Bases: Message

ImageMessage.

https://developers.line.biz/en/reference/messaging-api/#wh-image

Message object which contains the image content sent from the source. The binary image data can be retrieved with the Content API.

__init__(id=None, content_provider=None, image_set=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.messages.VideoMessage(id=None, duration=None, content_provider=None, **kwargs)[source]

Bases: Message

VideoMessage.

https://developers.line.biz/en/reference/messaging-api/#wh-video

Message object which contains the video content sent from the source. The binary video data can be retrieved with the Content API.

__init__(id=None, duration=None, content_provider=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.messages.AudioMessage(id=None, duration=None, content_provider=None, **kwargs)[source]

Bases: Message

AudioMessage.

https://developers.line.biz/en/reference/messaging-api/#wh-audio

Message object which contains the audio content sent from the source. The binary audio data can be retrieved with the Content API.

__init__(id=None, duration=None, content_provider=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.messages.LocationMessage(id=None, title=None, address=None, latitude=None, longitude=None, **kwargs)[source]

Bases: Message

LocationMessage.

https://developers.line.biz/en/reference/messaging-api/#wh-location

__init__(id=None, title=None, address=None, latitude=None, longitude=None, **kwargs)[source]

__init__ method.

Parameters
  • id (str) – Message ID

  • title (str) – Title

  • address (str) – Address

  • latitude (float) – Latitude

  • longitude (float) – Longitude

  • kwargs

class linebot.models.messages.StickerMessage(id=None, package_id=None, sticker_id=None, sticker_resource_type=None, keywords=None, text=None, **kwargs)[source]

Bases: Message

StickerMessage.

https://developers.line.biz/en/reference/messaging-api/#wh-sticker

Message object which contains the sticker data sent from the source. For a list of basic LINE stickers and sticker IDs, see sticker list.

__init__(id=None, package_id=None, sticker_id=None, sticker_resource_type=None, keywords=None, text=None, **kwargs)[source]

__init__ method.

Parameters
  • id (str) – Message ID

  • package_id (str) – Package ID

  • sticker_id (str) – Sticker ID

  • sticker_resource_type (str) – Sticker resource type

  • keywords (list[str]) – List of up to 15 keywords describing the sticker

  • text (str) – Any text entered by the user

  • kwargs

class linebot.models.messages.FileMessage(id=None, file_name=None, file_size=None, **kwargs)[source]

Bases: Message

FileMessage.

https://developers.line.biz/en/reference/messaging-api/#wh-file

Message object which contains the file content sent from the source. The binary file data can be retrieved with the Content API.

__init__(id=None, file_name=None, file_size=None, **kwargs)[source]

__init__ method.

Parameters
  • id (str) – Message ID

  • file_name (str) – File Name

  • file_size (int) – File Size

  • kwargs

class linebot.models.messages.ContentProvider(type=None, original_content_url=None, preview_image_url=None, **kwargs)[source]

Bases: Base

Content provider.

__init__(type=None, original_content_url=None, preview_image_url=None, **kwargs)[source]

__init__ method.

Parameters
  • type (str) – Provider of the content. line or external.

  • original_content_url (str) – URL of the content.

  • preview_image_url (str) – URL of the preview image.

  • kwargs

class linebot.models.messages.ImageSet(id=None, index=None, total=0, **kwargs)[source]

Bases: Base

Image Set.

__init__(id=None, index=None, total=0, **kwargs)[source]

__init__ method.

Parameters
  • id (str) – Image set ID.

  • index (int) – Image number in a set of images sent simultaneously.

  • total (int) – Total number of images sent simultaneously.

  • kwargs

linebot.models.operator module

linebot.models.filter module.

class linebot.models.operator.Operator(**kwargs)[source]

Bases: Base

Operator.

https://developers.line.biz/en/reference/messaging-api/#narrowcast-demographic-filter

Use logical AND, OR, and NOT operators to combine multiple recipient objects or demographic filter objects together. You can specify up to 10 recipient objects or demographic filter objects per request.

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.operator.And(*args, **kwargs)[source]

Bases: Operator

And.

Create a new recipient object or demographic filter object by taking the logical conjunction (AND) of the specified array of objects.

__init__(*args, **kwargs)[source]

__init__ method.

Parameters
  • args

  • kwargs

class linebot.models.operator.Or(*args, **kwargs)[source]

Bases: Operator

Or.

Create a new recipient object or demographic filter object by taking the logical disjunction (OR) of the specified array of objects.

__init__(*args, **kwargs)[source]

__init__ method.

Parameters
  • args

  • kwargs

class linebot.models.operator.Not(arg, **kwargs)[source]

Bases: Operator

Not.

Create a new recipient object or demographic filter object that excludes in the specified object.

__init__(arg, **kwargs)[source]

__init__ method.

Parameters
  • arg

  • kwargs

linebot.models.recipient module

linebot.models.limit module.

class linebot.models.recipient.Recipient(**kwargs)[source]

Bases: Base

Recipient.

https://developers.line.biz/en/reference/messaging-api/#narrowcast-recipient

Recipient objects represent audiences. You can specify recipients based on a combination of criteria using logical operator objects.

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.recipient.AudienceRecipient(group_id=None, **kwargs)[source]

Bases: Recipient

AudienceRecipient.

__init__(group_id=None, **kwargs)[source]

__init__ method.

Parameters
  • group_id (int) – The audience ID. Create audiences with the Manage Audience API.

  • kwargs

class linebot.models.recipient.RedeliveryRecipient(request_id=None, **kwargs)[source]

Bases: Recipient

RedeliveryRecipient.

__init__(request_id=None, **kwargs)[source]

__init__ method.

Parameters
  • request_id (str) – The request ID of the narrowcast message previously sent. The request IDs is an ID issued for each Messaging API request.

  • kwargs

linebot.models.responses module

linebot.models.responses module.

class linebot.models.responses.BroadcastResponse(request_id=None)[source]

Bases: object

BroadcastResponse.

https://developers.line.biz/en/reference/messaging-api/#send-broadcast-message

__init__(request_id=None)[source]

__init__ method.

Parameters

request_id (str) – Request ID. A unique ID is generated for each request

class linebot.models.responses.Profile(display_name=None, user_id=None, picture_url=None, status_message=None, language=None, **kwargs)[source]

Bases: Base

Profile.

https://developers.line.biz/en/reference/messaging-api/#get-profile

__init__(display_name=None, user_id=None, picture_url=None, status_message=None, language=None, **kwargs)[source]

__init__ method.

Parameters
  • display_name (str) – Display name

  • user_id (str) – User ID

  • picture_url (str) – Image URL

  • status_message (str) – Status message

  • language (str) – Get user’s language

  • kwargs

class linebot.models.responses.Group(group_id=None, group_name=None, picture_url=None, **kwargs)[source]

Bases: Base

Group.

https://developers.line.biz/en/reference/messaging-api/#get-group-id-response

__init__(group_id=None, group_name=None, picture_url=None, **kwargs)[source]

__init__ method.

:param str group_id :param str group_name :param str picture_url :param kwargs:

class linebot.models.responses.MemberIds(member_ids=None, next=None, **kwargs)[source]

Bases: Base

MemberIds.

https://developers.line.biz/en/reference/messaging-api/#get-group-member-user-ids https://developers.line.biz/en/reference/messaging-api/#get-room-member-user-ids

__init__(member_ids=None, next=None, **kwargs)[source]

__init__ method.

Parameters
  • member_ids (list[str]) – List of user IDs of the members in the group or room. Max: 100 user IDs

  • next (str) – continuationToken. Only returned when there are more user IDs remaining in memberIds.

  • kwargs

class linebot.models.responses.Content(response)[source]

Bases: object

MessageContent.

https://developers.line.biz/en/reference/messaging-api/#get-content

__init__(response)[source]

__init__ method.

Parameters

response (T <= linebot.http_client.HttpResponse) – HttpResponse object

property content_type

Get Content-type header value.

Return type

str

Returns

content-type header value

property content

Get content.

If content size is large, should use iter_content.

Return type

binary

iter_content(chunk_size=1024)[source]

Get content as iterator (stream).

If content size is large, should use this.

Parameters

chunk_size – Chunk size

Return type

iterator

class linebot.models.responses.RichMenuResponse(rich_menu_id=None, size=None, selected=None, name=None, chat_bar_text=None, areas=None, **kwargs)[source]

Bases: Base

RichMenuResponse.

https://developers.line.me/en/docs/messaging-api/reference/#rich-menu-response-object

__init__(rich_menu_id=None, size=None, selected=None, name=None, chat_bar_text=None, areas=None, **kwargs)[source]

__init__ method.

Parameters
  • id (str) – Rich Menu ID

  • size (linebot.models.rich_menu.RichMenuSize) – size object which describe the rich menu displayed in the chat. Rich menu images must be one of the following sizes: 2500x1686, 2500x843.

  • selected (bool) – true to display the rich menu by default. Otherwise, false.

  • name (str) – Name of the rich menu. Maximum of 300 characters.

  • chat_bar_text (str) – Text displayed in the chat bar. Maximum of 14 characters.

  • areas (list[T <= linebot.models.rich_menu.RichMenuArea]) – Array of area objects which define coordinates and size of tappable areas. Maximum of 20 area objects.

  • kwargs

class linebot.models.responses.RichMenuAliasResponse(rich_menu_alias_id=None, rich_menu_id=None, **kwargs)[source]

Bases: Base

RichMenuAliasResponse.

https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-alias-by-id-response

__init__(rich_menu_alias_id=None, rich_menu_id=None, **kwargs)[source]

__init__ method.

Parameters
  • rich_menu_alias_id (str) – Rich menu alias ID.

  • rich_menu_id (str) – Rich menu ID.

  • kwargs

class linebot.models.responses.RichMenuAliasListResponse(aliases=None, **kwargs)[source]

Bases: Base

RichMenuAliasListResponse.

https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-alias-list-response

__init__(aliases=None, **kwargs)[source]

__init__ method.

Parameters
  • aliases – Array of rich menu alias objects

  • kwargs

class linebot.models.responses.MessageQuotaResponse(type=None, value=None, **kwargs)[source]

Bases: Base

MessageQuotaResponse.

https://developers.line.biz/en/reference/messaging-api/#get-quota

__init__(type=None, value=None, **kwargs)[source]

__init__ method.

Parameters
  • type (str) – Quota limitation type

  • value (int) – The target limit for additional messages in the current month. This property is returned when the type property has a value of limited.

  • kwargs

class linebot.models.responses.MessageQuotaConsumptionResponse(total_usage=None, **kwargs)[source]

Bases: Base

MessageQuotaConsumptionResponse.

https://developers.line.biz/en/reference/messaging-api/#get-consumption

__init__(total_usage=None, **kwargs)[source]

__init__ method.

Parameters
  • total_usage (str) – The number of sent messages in the current month

  • kwargs

class linebot.models.responses.MessageDeliveryBroadcastResponse(status=None, success=None, **kwargs)[source]

Bases: Base

MessageDeliveryBroadcastResponse.

__init__(status=None, success=None, **kwargs)[source]

__init__ method.

Parameters
  • status (str) – Status of the counting process.

  • success (int) – The number of messages sent with the Messaging API on the date specified in date.

  • kwargs

class linebot.models.responses.MessageDeliveryReplyResponse(status=None, success=None, **kwargs)[source]

Bases: Base

MessageDeliveryReplyResponse.

__init__(status=None, success=None, **kwargs)[source]

__init__ method.

Parameters
  • status (str) – Status of the counting process.

  • success (int) – The number of messages sent with the Messaging API on the date specified in date.

  • kwargs

class linebot.models.responses.MessageDeliveryPushResponse(status=None, success=None, **kwargs)[source]

Bases: Base

MessageDeliveryPushResponse.

__init__(status=None, success=None, **kwargs)[source]

__init__ method.

Parameters
  • status (str) – Status of the counting process.

  • success (int) – The number of messages sent with the Messaging API on the date specified in date.

  • kwargs

class linebot.models.responses.MessageDeliveryMulticastResponse(status=None, success=None, **kwargs)[source]

Bases: Base

MessageDeliveryMulticastResponse.

__init__(status=None, success=None, **kwargs)[source]

__init__ method.

Parameters
  • status (str) – Status of the counting process.

  • success (int) – The number of messages sent with the Messaging API on the date specified in date.

  • kwargs

class linebot.models.responses.MessageProgressNarrowcastResponse(phase=None, success_count=None, failure_count=None, target_count=None, failed_description=None, error_code=None, accepted_time=None, completed_time=None, **kwargs)[source]

Bases: Base

MessageProgressNarrowcastResponse.

__init__(phase=None, success_count=None, failure_count=None, target_count=None, failed_description=None, error_code=None, accepted_time=None, completed_time=None, **kwargs)[source]

__init__ method.

Parameters
  • phase (str) – Progress status. One of waiting, sending, succeeded, or failed.

  • success_count (int) – Number of narrowcast messages sent successful.

  • failure_count (int) – Number of narrowcast messages sent failed.

  • target_count (int) – Number of targeted messages sent.

  • failed_description (str) – Reason why narrowcast failed, useful when phase is failed.

  • error_code (int) – Summary of the error. One of 1 or 2. 1 means internal error, whereas 2 indicates too few targets.

  • accepted_time (str) – Narrowcast message request accepted time in milliseconds.

  • completed_time (str) – Processing of narrowcast message request completion time in milliseconds.

  • kwargs

class linebot.models.responses.IssueLinkTokenResponse(link_token=None, **kwargs)[source]

Bases: Base

IssueLinkTokenResponse.

https://developers.line.biz/en/reference/messaging-api/#issue-link-token

__init__(link_token=None, **kwargs)[source]

__init__ method.

Parameters
  • link_token (str) – Link token.

  • kwargs

class linebot.models.responses.IssueChannelTokenResponse(access_token=None, expires_in=None, token_type=None, **kwargs)[source]

Bases: Base

IssueAccessTokenResponse.

https://developers.line.biz/en/reference/messaging-api/#issue-channel-access-token

__init__(access_token=None, expires_in=None, token_type=None, **kwargs)[source]

__init__ method.

Parameters
  • access_token (str) – Short-lived channel access token.

  • expires_in (int) – Time until channel access token expires in seconds from time the token is issued.

  • token_type (str) – Bearer.

  • kwargs

class linebot.models.responses.InsightMessageDeliveryResponse(status=None, broadcast=None, targeting=None, auto_response=None, welcome_response=None, chat=None, api_broadcast=None, api_push=None, api_multicast=None, api_reply=None, **kwargs)[source]

Bases: Base

InsightMessageDeliveryResponse.

__init__(status=None, broadcast=None, targeting=None, auto_response=None, welcome_response=None, chat=None, api_broadcast=None, api_push=None, api_multicast=None, api_reply=None, **kwargs)[source]

__init__ method.

Parameters
  • status (str) – Calculation status. One of ready, unready, or out_of_service.

  • broadcast (int) – Number of broadcast messages sent.

  • targeting (int) – Number of targeted/segmented messages sent.

  • auto_response (int) – Number of auto-response messages sent.

  • welcome_response (int) – Number of greeting messages sent.

  • chat (int) – Number of messages sent from LINE Official Account Manager Chat screen.

  • api_broadcast (int) – Number of broadcast messages sent with the Send broadcast message Messaging API operation.

  • api_push (int) – Number of push messages sent with the Send push message Messaging API operation.

  • api_multicast (int) – Number of multicast messages sent with the Send multicast message Messaging API operation.

  • api_reply (int) – Number of replies sent with the Send reply message Messaging API operation.

  • success (int) – The number of messages sent with the Messaging API on the date specified in date.

  • kwargs

class linebot.models.responses.InsightFollowersResponse(status=None, followers=None, targeted_reaches=None, blocks=None, **kwargs)[source]

Bases: Base

InsightFollowersResponse.

__init__(status=None, followers=None, targeted_reaches=None, blocks=None, **kwargs)[source]

__init__ method.

Parameters
  • status (str) – Calculation status. One of ready, unready, or out_of_service.

  • followers (int) – The number of times, as of the specified date, that a user added this LINE official account as a friend for the first time.

  • targeted_reaches (int) – The number of users, as of the specified date, that the official account can reach through targeted messages based on gender, age, and/or region.

  • blocks (int) – The number of users blocking the account as of the specified date.

  • kwargs

class linebot.models.responses.InsightDemographicResponse(available=None, genders=None, ages=None, areas=None, app_types=None, subscription_periods=None, **kwargs)[source]

Bases: Base

InsightDemographicResponse.

__init__(available=None, genders=None, ages=None, areas=None, app_types=None, subscription_periods=None, **kwargs)[source]

__init__ method.

Parameters
  • available (bool) – true if friend demographic information is available.

  • genders (list[T <= linebot.models.GenderInsight]) – Percentage per gender.

  • ages (list[T <= linebot.models.AgeInsight]) – Percentage per age group.

  • areas (list[T <= linebot.models.AreaInsight]) – Percentage per area.

  • app_types (list[T <= linebot.models.AppTypeInsight]) – Percentage by OS.

  • subscription_periods (list[T <= linebot.models.SubscriptionPeriodInsight]) – Percentage per friendship duration.

  • kwargs

class linebot.models.responses.InsightMessageEventResponse(overview=None, messages=None, clicks=None, **kwargs)[source]

Bases: Base

InsightMessageEventResponse.

__init__(overview=None, messages=None, clicks=None, **kwargs)[source]

__init__ method.

Parameters
  • overview (T <= linebot.models.MessageStatistics) – Summary of message statistics.

  • messages (list[T <= linebot.models.MessageInsight]) – Array of information about individual message bubbles.

  • clicks (list[T <= linebot.models.ClickInsight]) – Array of information about URLs in the message.

  • kwargs

class linebot.models.responses.InsightMessageEventOfCustomAggregationUnitResponse(overview=None, messages=None, clicks=None, **kwargs)[source]

Bases: Base

InsightMessageEventResponse.

__init__(overview=None, messages=None, clicks=None, **kwargs)[source]

__init__ method.

Parameters
  • overview (T <= linebot.models.MessageStatisticsOfCustomAggregationUnit) – Summary of message statistics.

  • messages (list[T <= linebot.models.MessageInsight]) – Array of information about individual message bubbles.

  • clicks (list[T <= linebot.models.ClickInsight]) – Array of information about URLs in the message.

  • kwargs

class linebot.models.responses.AggregationInfoResponse(num_of_custom_aggregation_units=None, **kwargs)[source]

Bases: Base

The number of aggregation units used this month.

https://developers.line.biz/en/reference/partner-docs/#get-number-of-units-used-this-month

__init__(num_of_custom_aggregation_units=None, **kwargs)[source]

__init__ method.

Parameters
  • num_of_custom_aggregation_units (int) – Number of aggregation units used this month.

  • kwargs

class linebot.models.responses.AggregationNameListResponse(custom_aggregation_units=None, next=None, **kwargs)[source]

Bases: Base

The name list of units used this month for statistics aggregation.

https://developers.line.biz/en/reference/partner-docs/#get-name-list-of-units-used-this-month

__init__(custom_aggregation_units=None, next=None, **kwargs)[source]

__init__ method.

Parameters
  • custom_aggregation_units (list[str]) – name list of aggregation units used this month. Max: 100 unit names

  • next (str) – continuationToken. A continuation token to get the next array of unit names.

  • kwargs

class linebot.models.responses.NarrowcastResponse(request_id=None, **kwargs)[source]

Bases: Base

NarrowcastResponse.

https://developers.line.biz/en/reference/messaging-api/#send-narrowcast-message

__init__(request_id=None, **kwargs)[source]

__init__ method.

Parameters
  • request_id (str) – Request ID. A unique ID is generated for each request

  • kwargs

class linebot.models.responses.BotInfo(user_id=None, basic_id=None, premium_id=None, display_name=None, picture_url=None, chat_mode=None, mark_as_read_mode=None, **kwargs)[source]

Bases: Base

Response of linebot.get_bot_info() .

https://developers.line.biz/en/reference/messaging-api/#get-bot-info

__init__(user_id=None, basic_id=None, premium_id=None, display_name=None, picture_url=None, chat_mode=None, mark_as_read_mode=None, **kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.responses.GetWebhookResponse(endpoint=None, active=None, **kwargs)[source]

Bases: Base

Response of get_webhook_endpoint() .

https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information

__init__(endpoint=None, active=None, **kwargs)[source]

__init__ method.

Parameters
  • endpoint (str) – The webhook endpoint URL.

  • active (bool) – Whether the webhook is in use.

  • kwargs

class linebot.models.responses.TestWebhookResponse(success=None, timestamp=None, status_code=None, reason=None, detail=None, **kwargs)[source]

Bases: Base

Response of test_webhook_endpoint() .

https://developers.line.biz/en/reference/messaging-api/#test-webhook-endpoint

__init__(success=None, timestamp=None, status_code=None, reason=None, detail=None, **kwargs)[source]

__init__ method.

Parameters
  • success (bool) – Result of the communication from the LINE platform to the webhook URL.

  • timestamp (str) – Timestamp

  • status_code (int) – The HTTP status code.

  • reason (str) – Reason for the response.

  • detail (str) – Details of the response.

  • kwargs

class linebot.models.responses.AudienceGroup(audience_group_id=None, type=None, description=None, status=None, audience_count=None, created=None, is_ifa_audience=None, permission=None, create_route=None, request_id=None, failed_type=None, click_url=None, jobs=None, **kwargs)[source]

Bases: Base

AudienceGroups.

https://developers.line.biz/en/reference/messaging-api/#get-audience-group

__init__(audience_group_id=None, type=None, description=None, status=None, audience_count=None, created=None, is_ifa_audience=None, permission=None, create_route=None, request_id=None, failed_type=None, click_url=None, jobs=None, **kwargs)[source]

__init__ method.

Parameters
  • audience_group_id (int) – The audience ID.

  • type (str) – The audience type. One of UPLOAD or CLICK or IMP or CHAT_TAG or FRIEND_PATH.

  • description (str) – The audience’s name.

  • status (str) – The audience’s status. One of IN_PROGRESS or READY or FAILED or EXPIRED.

  • audience_count (int) – The number of valid recipients.

  • created (int) – When the audience was created (in UNIX time).

  • is_ifa_audience (bool) – The value specified when creating an audience for uploading user IDs to indicate the type of accounts that will be given as recipients.

  • permission (str) – Audience’s update permission. Audiences linked to the same channel will be READ_WRITE.

  • create_route (str) – How the audience was created. If omitted, you will get all audiences.

  • request_id (str) – The request ID that was specified when the audience was created.

  • failed_type (str) – The reason why the operation failed. This is only included when status is FAILED. One of AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT or INTERNAL_ERROR

  • click_url (str) – The URL that was specified when the audience was created. This is only included when type is CLICK

  • jobs – An array of jobs. This array is used to keep track of each attempt to add new user IDs or IFAs to an audience for uploading user IDs.

  • kwargs

class linebot.models.responses.ClickAudienceGroup(audience_group_id=None, create_route=None, type=None, description=None, created=None, permission=None, expire_timestamp=None, is_ifa_audience=None, request_id=None, click_url=None, **kwargs)[source]

Bases: Base

ClickAudienceGroup.

https://developers.line.biz/en/reference/messaging-api/#create-click-audience-group

__init__(audience_group_id=None, create_route=None, type=None, description=None, created=None, permission=None, expire_timestamp=None, is_ifa_audience=None, request_id=None, click_url=None, **kwargs)[source]

__init__ method.

Parameters
  • audience_group_id (int) – The audience ID.

  • create_route (str) – How the audience was created. If omitted, you will get all audiences.

  • type (str) – The audience type. One of UPLOAD or CLICK or IMP or CHAT_TAG or FRIEND_PATH.

  • description (str) – The audience’s name.

  • created (int) – When the audience was created (in UNIX time).

  • permission (str) – Audience’s update permission. Audiences linked to the same channel will be READ_WRITE.

  • expire_timestamp (int) – Time of audience expiration. Only returned for specific audiences.

  • is_ifa_audience (bool) – The value specified when creating an audience for uploading user IDs to indicate the type of accounts that will be given as recipients.

  • request_id (str) – The request ID that was specified when the audience was created.

  • click_url (str) – The URL that was specified when the audience was created. This is only included when type is CLICK

  • kwargs

class linebot.models.responses.CreateAudienceGroup(audience_group_id=None, create_route=None, type=None, description=None, created=None, permission=None, expire_timestamp=None, is_ifa_audience=None, **kwargs)[source]

Bases: Base

ClickAudienceGroup.

https://developers.line.biz/en/reference/messaging-api/#create-upload-audience-group

__init__(audience_group_id=None, create_route=None, type=None, description=None, created=None, permission=None, expire_timestamp=None, is_ifa_audience=None, **kwargs)[source]

__init__ method.

Parameters
  • audience_group_id (int) – The audience ID.

  • create_route (str) – How the audience was created. If omitted, you will get all audiences.

  • type (str) – The audience type. One of UPLOAD or CLICK or IMP or CHAT_TAG or FRIEND_PATH.

  • description (str) – The audience’s name.

  • created (int) – When the audience was created (in UNIX time).

  • permission (str) – Audience’s update permission. Audiences linked to the same channel will be READ_WRITE.

  • expire_timestamp (int) – Time of audience expiration. Only returned for specific audiences.

  • is_ifa_audience (bool) – The value specified when creating an audience for uploading user IDs to indicate the type of accounts that will be given as recipients.

  • kwargs

class linebot.models.responses.ImpAudienceGroup(audience_group_id=None, create_route=None, type=None, description=None, created=None, permission=None, expire_timestamp=None, is_ifa_audience=None, request_id=None, **kwargs)[source]

Bases: Base

ImpAudienceGroup.

https://developers.line.biz/en/reference/messaging-api/#create-imp-audience-group

__init__(audience_group_id=None, create_route=None, type=None, description=None, created=None, permission=None, expire_timestamp=None, is_ifa_audience=None, request_id=None, **kwargs)[source]

__init__ method.

Parameters
  • audience_group_id (int) – The audience ID.

  • create_route (str) – How the audience was created. If omitted, you will get all audiences.

  • type (str) – The audience type. One of UPLOAD or CLICK or IMP or CHAT_TAG or FRIEND_PATH.

  • description (str) – The audience’s name.

  • created (int) – When the audience was created (in UNIX time).

  • permission (str) – Audience’s update permission. Audiences linked to the same channel will be READ_WRITE.

  • expire_timestamp (int) – Time of audience expiration. Only returned for specific audiences.

  • is_ifa_audience (bool) – The value specified when creating an audience for uploading user IDs to indicate the type of accounts that will be given as recipients.

  • request_id (str) – The request ID that was specified when the audience was created.

  • kwargs

class linebot.models.responses.GetAuthorityLevel(authority_level=None, **kwargs)[source]

Bases: Base

GetAuthorityLevel.

https://developers.line.biz/en/reference/messaging-api/#get-authority-level

__init__(authority_level=None, **kwargs)[source]

__init__ method.

Parameters
  • authority_level (str) – The authority level for all audiences linked to a channel.

  • kwargs

class linebot.models.responses.Audience(id=None, **kwargs)[source]

Bases: Base

Audience.

https://developers.line.biz/en/reference/messaging-api/#update-upload-audience-group

__init__(id=None, **kwargs)[source]

__init__ method.

Parameters
  • audience_id (str) – A user ID or IFA.

  • kwargs

class linebot.models.responses.UserIds(user_ids=None, next=None, **kwargs)[source]

Bases: Base

UserIds.

https://developers.line.biz/en/reference/messaging-api/#get-follower-ids

__init__(user_ids=None, next=None, **kwargs)[source]

__init__ method.

Parameters
  • user_ids (list[str]) – List of user IDs of users that have added the LINE Official Account as a friend. Max: 300 user IDs

  • next (str) – continuationToken. A continuation token to get the next array of user IDs.

  • kwargs

class linebot.models.responses.IssueChannelTokenResponseV2(access_token=None, expires_in=None, token_type=None, key_id=None, **kwargs)[source]

Bases: Base

IssueAccessTokenResponseV2.

https://developers.line.biz/en/reference/messaging-api/#issue-channel-access-token-v2-1

__init__(access_token=None, expires_in=None, token_type=None, key_id=None, **kwargs)[source]

__init__ method.

Parameters
  • access_token (str) – Short-lived channel access token.

  • expires_in (int) – Time until channel access token expires in seconds from time the token is issued.

  • token_type (str) – Bearer.

  • key_id – Unique key ID for identifying the channel access token.

  • kwargs

class linebot.models.responses.ChannelAccessTokens(access_tokens=None, **kwargs)[source]

Bases: Base

ChannelAccessTokens.

https://developers.line.biz/en/reference/messaging-api/#get-issued-channel-access-tokens-v2-1

__init__(access_tokens=None, **kwargs)[source]

__init__ method.

Parameters
  • access_tokens (list[str]) – List of channel access token

  • kwargs

class linebot.models.responses.VerifyChannelTokenResponseV2(client_id=None, expires_in=None, scope=None, **kwargs)[source]

Bases: Base

VerifyChannelTokenResponseV2.

https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token-v2-1

__init__(client_id=None, expires_in=None, scope=None, **kwargs)[source]

__init__ method.

Parameters
  • client_id (str) – The channel ID for which the channel access token was issued.

  • expires_in (int) – Number of seconds before the channel access token expires.

  • scope (str) – Permissions granted to the channel access token.

  • kwargs

class linebot.models.responses.ValidAccessTokenKeyIDsResponse(kids=None, **kwargs)[source]

Bases: Base

ValidAccessTokenKeyIDsResponse.

https://developers.line.biz/en/reference/messaging-api/#get-all-valid-channel-access-token-key-ids-v2-1

__init__(kids=None, **kwargs)[source]

__init__ method.

Parameters
  • kids (list[str]) – Array of channel access token key IDs.

  • kwargs

linebot.models.rich_menu module

linebot.models.rich_menu module.

class linebot.models.rich_menu.RichMenu(size=None, selected=None, name=None, chat_bar_text=None, areas=None, **kwargs)[source]

Bases: Base

RichMenu.

https://developers.line.me/en/docs/messaging-api/reference/#rich-menu-object

__init__(size=None, selected=None, name=None, chat_bar_text=None, areas=None, **kwargs)[source]

__init__ method.

Parameters
  • size (linebot.models.rich_menu.RichMenuSize) – size object which describe the rich menu displayed in the chat. Rich menu images must be one of the following sizes: 2500x1686, 2500x843.

  • selected (bool) – true to display the rich menu by default. Otherwise, false.

  • name (str) – Name of the rich menu. Maximum of 300 characters.

  • chatBarText (str) – Text displayed in the chat bar. Maximum of 14 characters.

  • areas (list[T <= linebot.models.rich_menu.RichMenuArea]) – Array of area objects which define coordinates and size of tappable areas. Maximum of 20 area objects.

  • kwargs

class linebot.models.rich_menu.RichMenuSize(width=None, height=None, **kwargs)[source]

Bases: Base

RichMenuSize.

https://developers.line.me/en/docs/messaging-api/reference/#size-object

__init__(width=None, height=None, **kwargs)[source]

__init__ method.

Parameters
  • width (int) – Width of the rich menu. Must be 2500.

  • height (int) – Height of the rich menu. Possible values: 1686, 843.

  • kwargs

class linebot.models.rich_menu.RichMenuArea(bounds=None, action=None, **kwargs)[source]

Bases: Base

RichMenuArea.

https://developers.line.me/en/docs/messaging-api/reference/#area-object

__init__(bounds=None, action=None, **kwargs)[source]

__init__ method.

Parameters
  • bounds (linebot.models.rich_menu.RichMenuBound) – Object describing the boundaries of the area in pixels. See bounds object.

  • action (T <= linebot.models.actions.Action) – Action performed when the area is tapped. See action objects.

  • kwargs

class linebot.models.rich_menu.RichMenuBounds(x=None, y=None, width=None, height=None, **kwargs)[source]

Bases: Base

RichMenuBounds.

https://developers.line.me/en/docs/messaging-api/reference/#bounds-object

__init__(x=None, y=None, width=None, height=None, **kwargs)[source]

__init__ method.

Parameters
  • x (int) – Horizontal position relative to the top-left corner of the area.

  • y (int) – Vertical position relative to the top-left corner of the area.

  • width (int) – Width of the area.

  • height (int) – Height of the area.

  • kwargs

class linebot.models.rich_menu.RichMenuAlias(rich_menu_alias_id=None, rich_menu_id=None, **kwargs)[source]

Bases: Base

RichMenuAlias.

https://developers.line.biz/en/reference/messaging-api/#create-rich-menu-alias

__init__(rich_menu_alias_id=None, rich_menu_id=None, **kwargs)[source]

__init__ method.

Parameters
  • rich_menu_alias_id (string) – Rich menu alias ID, which can be any ID, unique for each channel.

  • rich_menu_id (string) – The rich menu ID to be associated with the rich menu alias.

  • kwargs

linebot.models.send_messages module

linebot.models.send_messages module.

class linebot.models.send_messages.SendMessage(quick_reply=None, sender=None, **kwargs)[source]

Bases: Base

Abstract Base Class of SendMessage.

__init__(quick_reply=None, sender=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.send_messages.TextSendMessage(text=None, emojis=None, quick_reply=None, sender=None, **kwargs)[source]

Bases: SendMessage

TextSendMessage.

https://developers.line.biz/en/reference/messaging-api/#text-message

__init__(text=None, emojis=None, quick_reply=None, sender=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.send_messages.ImageSendMessage(original_content_url=None, preview_image_url=None, quick_reply=None, sender=None, **kwargs)[source]

Bases: SendMessage

ImageSendMessage.

https://developers.line.biz/en/reference/messaging-api/#image-message

__init__(original_content_url=None, preview_image_url=None, quick_reply=None, sender=None, **kwargs)[source]

__init__ method.

Parameters
  • original_content_url (str) – Image URL. HTTPS JPEG Max: 1024 x 1024 Max: 1 MB

  • preview_image_url (str) – Preview image URL HTTPS JPEG Max: 240 x 240 Max: 1 MB

  • quick_reply (T <= linebot.models.send_messages.QuickReply) – QuickReply object

  • kwargs

class linebot.models.send_messages.VideoSendMessage(original_content_url=None, preview_image_url=None, tracking_id=None, quick_reply=None, sender=None, **kwargs)[source]

Bases: SendMessage

VideoSendMessage.

https://developers.line.biz/en/reference/messaging-api/#video-message

__init__(original_content_url=None, preview_image_url=None, tracking_id=None, quick_reply=None, sender=None, **kwargs)[source]

__init__ method.

Parameters
  • original_content_url (str) – URL of video file. HTTPS. mp4. Less than 1 minute. Max: 10 MB.

  • preview_image_url (str) – URL of preview image. HTTPS. JPEG. Max: 240 x 240. Max: 1 MB.

  • tracking_id (str) – the video viewing complete event occurs when the user finishes watching the video. Max character limit: 100.

  • quick_reply (T <= linebot.models.send_messages.QuickReply) – QuickReply object

  • kwargs

class linebot.models.send_messages.AudioSendMessage(original_content_url=None, duration=None, quick_reply=None, sender=None, **kwargs)[source]

Bases: SendMessage

AudioSendMessage.

https://developers.line.biz/en/reference/messaging-api/#audio-message

__init__(original_content_url=None, duration=None, quick_reply=None, sender=None, **kwargs)[source]

__init__ method.

Parameters
  • original_content_url (str) – URL of audio file. HTTPS. m4a. Less than 1 minute. Max 10 MB.

  • duration (long) – Length of audio file (milliseconds).

  • quick_reply (T <= linebot.models.send_messages.QuickReply) – QuickReply object

  • kwargs

class linebot.models.send_messages.LocationSendMessage(title=None, address=None, latitude=None, longitude=None, quick_reply=None, sender=None, **kwargs)[source]

Bases: SendMessage

LocationSendMessage.

https://developers.line.biz/en/reference/messaging-api/#location-message

__init__(title=None, address=None, latitude=None, longitude=None, quick_reply=None, sender=None, **kwargs)[source]

__init__ method.

Parameters
  • title (str) – Title

  • address (str) – Address

  • latitude (float) – Latitude

  • longitude (float) – Longitude

  • quick_reply (T <= linebot.models.send_messages.QuickReply) – QuickReply object

  • kwargs

class linebot.models.send_messages.StickerSendMessage(package_id=None, sticker_id=None, quick_reply=None, sender=None, **kwargs)[source]

Bases: SendMessage

StickerSendMessage.

https://developers.line.biz/en/reference/messaging-api/#sticker-message

__init__(package_id=None, sticker_id=None, quick_reply=None, sender=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.send_messages.QuickReply(items=None, **kwargs)[source]

Bases: Base

QuickReply.

https://developers.line.me/en/docs/messaging-api/#quick-reply

__init__(items=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.send_messages.QuickReplyButton(image_url=None, action=None, **kwargs)[source]

Bases: Base

QuickReplyButton.

https://developers.line.me/en/reference/messaging-api/#quick-reply-button-object

__init__(image_url=None, action=None, **kwargs)[source]

__init__ method.

Parameters
  • image_url (str) – URL of the icon that is displayed at the beginning of the button

  • action (T <= linebot.models.actions.Action) – Action performed when this button is tapped

  • kwargs

class linebot.models.send_messages.Sender(name=None, icon_url=None, **kwargs)[source]

Bases: Base

Sender.

https://developers.line.biz/en/reference/messaging-api/#icon-nickname-switch

__init__(name=None, icon_url=None, **kwargs)[source]

__init__ method.

Parameters
  • name (str) – Display name

  • icon_url (str) – Icon image URL

linebot.models.sources module

linebot.models.sources module.

class linebot.models.sources.Source(**kwargs)[source]

Bases: Base

Abstract Base Class of Source.

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

abstract property sender_id

Abstract property of id to send a message.

If SourceUser, return user_id. If SourceGroup, return group_id. If SourceRoom, return room_id.

‘sender_id’ is deprecated.

Return type

str

class linebot.models.sources.SourceUser(user_id=None, **kwargs)[source]

Bases: Source

SourceUser.

https://developers.line.biz/en/reference/messaging-api/#source-user

JSON object which contains the source user of the event.

__init__(user_id=None, **kwargs)[source]

__init__ method.

Parameters
  • user_id (str) – ID of the source user

  • kwargs

property sender_id

Alias of user_id.

‘sender_id’ is deprecated. Use ‘user_id’ instead.

Return type

str

class linebot.models.sources.SourceGroup(group_id=None, user_id=None, **kwargs)[source]

Bases: Source

SourceGroup.

https://developers.line.biz/en/reference/messaging-api/#source-group

JSON object which contains the source group of the event.

__init__(group_id=None, user_id=None, **kwargs)[source]

__init__ method.

Parameters
  • group_id (str) – ID of the source group

  • user_id (str) – ID of the source user

  • kwargs

property sender_id

Alias of group_id.

‘sender_id’ is deprecated. Use ‘group_id’ instead.

Return type

str

class linebot.models.sources.SourceRoom(room_id=None, user_id=None, **kwargs)[source]

Bases: Source

SourceRoom.

https://developers.line.biz/en/reference/messaging-api/#source-room

JSON object which contains the source room of the event.

__init__(room_id=None, user_id=None, **kwargs)[source]

__init__ method.

Parameters
  • room_id (str) – ID of the source room

  • user_id (str) – ID of the source user

  • kwargs

property sender_id

Alias of room_id.

‘sender_id’ is deprecated. Use ‘room_id’ instead.

Return type

str

linebot.models.template module

linebot.models.template module.

class linebot.models.template.TemplateSendMessage(alt_text=None, template=None, **kwargs)[source]

Bases: SendMessage

TemplateSendMessage.

https://developers.line.biz/en/reference/messaging-api/#template-messages

Template messages are messages with predefined layouts which you can customize. There are three types of templates available that can be used to interact with users through your bot.

__init__(alt_text=None, template=None, **kwargs)[source]

__init__ method.

Parameters
  • alt_text (str) – Alternative text for unsupported devices.

  • template (T <= linebot.models.template.Template) – Object with the contents of the template.

  • kwargs

class linebot.models.template.Template(**kwargs)[source]

Bases: Base

Abstract Base Class of Template.

__init__(**kwargs)[source]

__init__ method.

Parameters

kwargs

class linebot.models.template.ButtonsTemplate(text=None, title=None, thumbnail_image_url=None, image_aspect_ratio=None, image_size=None, image_background_color=None, actions=None, default_action=None, **kwargs)[source]

Bases: Template

ButtonsTemplate.

https://developers.line.biz/en/reference/messaging-api/#buttons

Template message with an image, title, text, and multiple action buttons.

__init__(text=None, title=None, thumbnail_image_url=None, image_aspect_ratio=None, image_size=None, image_background_color=None, actions=None, default_action=None, **kwargs)[source]

__init__ method.

Parameters
  • text (str) – Message text. Max: 160 characters (no image or title). Max: 60 characters (message with an image or title)

  • title (str) – Title. Max: 40 characters

  • thumbnail_image_url (str) – Image URL. HTTPS JPEG or PNG Aspect ratio: 1:1.51 Max width: 1024px Max: 1 MB

  • image_aspect_ratio (str) – Aspect ratio of the image. Specify one of the following values: rectangle: 1.51:1 square: 1:1

  • image_size (str) – Size of the image. Specify cover or contain.

  • image_background_color (str) – Background color of image. Specify a RGB color value.

  • actions (list[T <= linebot.models.actions.Action]) – Action when tapped. Max: 4

  • default_action (T <= linebot.models.actions.Action) – Action when image is tapped; set for the entire image, title, and text area

  • kwargs

class linebot.models.template.ConfirmTemplate(text=None, actions=None, **kwargs)[source]

Bases: Template

ConfirmTemplate.

https://developers.line.biz/en/reference/messaging-api/#confirm

Template message with two action buttons.

__init__(text=None, actions=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.template.CarouselTemplate(columns=None, image_aspect_ratio=None, image_size=None, **kwargs)[source]

Bases: Template

CarouselTemplate.

https://developers.line.biz/en/reference/messaging-api/#carousel

Template message with multiple columns which can be cycled like a carousel.

__init__(columns=None, image_aspect_ratio=None, image_size=None, **kwargs)[source]

__init__ method.

Parameters
  • columns (list[T <= linebot.models.template.CarouselColumn]) – Array of columns. Max: 10

  • image_aspect_ratio (str) – Aspect ratio of the image. Specify rectangle or square.

  • image_size (str) – Size of the image. Specify cover or contain.

  • kwargs

class linebot.models.template.ImageCarouselTemplate(columns=None, **kwargs)[source]

Bases: Template

ImageCarouselTemplate.

https://developers.line.biz/en/reference/messaging-api/#image-carousel

Template message with multiple images columns which can be cycled like as carousel.

__init__(columns=None, **kwargs)[source]

__init__ method.

Parameters
class linebot.models.template.CarouselColumn(text=None, title=None, thumbnail_image_url=None, image_background_color=None, actions=None, default_action=None, **kwargs)[source]

Bases: Base

CarouselColumn.

https://developers.line.biz/en/reference/messaging-api/#column-object

__init__(text=None, title=None, thumbnail_image_url=None, image_background_color=None, actions=None, default_action=None, **kwargs)[source]

__init__ method.

Parameters
  • text (str) – Message text. Max: 120 characters (no image or title) Max: 60 characters (message with an image or title)

  • title (str) – Title. Max: 40 characters

  • thumbnail_image_url (str) – Image URL (HTTPS). JPEG or PNG. Aspect ration is 1:1.51. Max width: 1024px, Max: 1 MB.

  • image_background_color (str) – Background color of image. Specify a RGB color value.

  • actions (list[T <= linebot.models.actions.Action]) – Action when tapped. Max: 3

  • default_action (T <= linebot.models.actions.Action) – Action when image is tapped; set for the entire image, title, and text area

  • kwargs

class linebot.models.template.ImageCarouselColumn(image_url=None, action=None, **kwargs)[source]

Bases: Base

ImageCarouselColumn.

https://developers.line.biz/en/reference/messaging-api/#column-object-for-image-carousel

__init__(image_url=None, action=None, **kwargs)[source]

__init__ method.

Parameters
  • image_url (str) – Image URL (HTTPS). JPEG or PNG. Aspect ration is 1:1. Max width: 1024px, Max: 1 MB.

  • action (T <= linebot.models.actions.Action) – Action when image is tapped. Max: 5.

  • kwargs

linebot.models.things module

linebot.models.things module.

class linebot.models.things.Things(device_id=None, **kwargs)[source]

Bases: Base

Abstract Base Class of Things.

__init__(device_id=None, **kwargs)[source]

__init__ method.

Parameters
  • device_id (str) – Device ID.

  • kwargs

Bases: Things

DeviceLink.

https://developers.line.biz/en/reference/messaging-api/#device-link-event

Indicates that a user linked a device with LINE.

__init__(device_id=None, **kwargs)[source]

__init__ method.

Parameters
  • device_id (str) – Device ID of the device that has been linked with LINE.

  • kwargs

Bases: Things

DeviceUnlink.

https://developers.line.biz/en/reference/messaging-api/#device-unlink-event

Indicates that the user unlinked a device from LINE.

__init__(device_id=None, **kwargs)[source]

__init__ method.

Parameters
  • device_id (str) – Device ID of the device that was unlinked from LINE.

  • kwargs

class linebot.models.things.ScenarioResult(device_id=None, result=None, **kwargs)[source]

Bases: Things

ScenarioResult.

https://developers.line.biz/en/reference/messaging-api/#scenario-result-event

Indicates that an automatic communication scenario has been executed.

__init__(device_id=None, result=None, **kwargs)[source]

__init__ method.

Parameters
  • device_id (str) – Device ID of the device that executed the scenario.

  • result (str) – ScenarioResultPayload object.

  • kwargs

class linebot.models.things.ScenarioResultPayload(scenario_id=None, revision=None, start_time=None, result_code=None, end_time=None, action_results=None, ble_notification_payload=None, error_reason=None, **kwargs)[source]

Bases: Base

ScenarioResultPayload.

__init__(scenario_id=None, revision=None, start_time=None, result_code=None, end_time=None, action_results=None, ble_notification_payload=None, error_reason=None, **kwargs)[source]

__init__ method.

Parameters
  • scenario_id (str) – Scenario ID executed.

  • revision (long) – Revision number.

  • start_time (long) – Timestamp for when execution of scenario action started (milliseconds).

  • end_time (long) – Timestamp for when execution of scenario was completed (milliseconds).

  • result_code (str) – Scenario execution completion status.

  • action_results (list[T <= linebot.models.things.ActionResult]) – Array of actions specified in a scenario.

  • ble_notification_payload (str) – Data contained in notification.

  • error_reason (str) – Error response.

  • kwargs

class linebot.models.things.ActionResult(type=None, data=None, **kwargs)[source]

Bases: Base

ActionResult.

Execution result of individual operations specified in action

__init__(type=None, data=None, **kwargs)[source]

__init__ method.

Parameters
  • type (str) – Type of the executed action.

  • data (str) – Base64-encoded binary data.

  • kwargs