line_bot v0.1.0 LineBot behaviour View Source
A module for sending and receiving messages with the Line Messaging API.
This module:
- Provides functions for calling the various Line Messaging API endpoints.
- Specifies a behaviour that defines event handlers which are called to handle webhook event objects from the Messaging API.
Callbacks
If an event contains event-specific data, it is passed as the first argument to the event handler.
Each callback is provided with a LineBot.EventInfo.t/0
struct, which contains common metadata for
each request. If available, a reply_token
for use with the send_reply/3
is included as the final argument.
Unknown events are passed to handle_other/4
.
All of the callbacks are optional. If a callback is not implemented, the event will be ignored.
Link to this section Summary
Functions
Calls the Get content API.
Calls the Get number of followers API.
Calls the Get friend demographics API.
Calls the Get profile API.
Calls the Get number of message deliveries API.
Calls the Get number of messages sent this month API.
Calls the Get room member profile API.
Calls the Get number of message deliveries API.
Calls the Get number of sent push messages API.
Calls the Get number of sent reply messages API.
Calls the Issue link token API.
Calls the Leave group API.
Calls the Leave room API.
Sends one or more broadcast messages.
Sends one or more multicast messages.
Sends one or more push messages.
Sends one or more reply messages.
Callbacks
Called when an Account Link event is received.
Called when a Beacon event is received.
Called when a Follow event is received.
Called when a Join event is received.
Called when a Leave event is received.
Called when a Member Joined event is received.
Called when a Member Left event is received.
Called when a Message event is received.
Called when an unknown even it received. The type
contains the unknown event type, and the full event is passed as the event
argument. If a reply token was not present in the event, reply_token
will be nil
.
Called when a Postback event is received.
Called when a LINE Things Scenario Execution event is received.
Called when an Unfollow event is received.
Link to this section Types
Link to this section Functions
get_content(message_id)
View Sourceget_content(message_id :: binary()) :: HTTPoison.Response.t()
Calls the Get content API.
get_follower_count(date)
View Sourceget_follower_count(date :: String.t()) :: api_response()
Calls the Get number of followers API.
get_follower_demographics()
View Sourceget_follower_demographics() :: api_response()
Calls the Get friend demographics API.
get_group_member_ids(group_id, start \\ nil)
View Sourceget_group_member_ids(group_id :: String.t(), start :: binary() | nil) :: api_response()
Calls the Get group member user IDs API.
get_group_member_profile(group_id, user_id)
View Sourceget_group_member_profile(group_id :: String.t(), user_id :: String.t()) :: api_response()
Calls the Get group member profile API.
get_profile(user_id)
View Sourceget_profile(user_id :: String.t()) :: api_response()
Calls the Get profile API.
Calls the Get number of message deliveries API.
Calls the Get number of messages sent this month API.
get_room_member_ids(room_id, start \\ nil)
View Sourceget_room_member_ids(room_id :: String.t(), start :: binary() | nil) :: api_response()
Calls the Get room member user IDs API.
get_room_member_profile(room_id, user_id)
View Sourceget_room_member_profile(room_id :: String.t(), user_id :: String.t()) :: api_response()
Calls the Get room member profile API.
get_sent_broadcast_count(date)
View Sourceget_sent_broadcast_count(date :: String.t()) :: api_response()
Calls the Get number of sent broadcast messages API.
get_sent_message_count(date)
View Sourceget_sent_message_count(date :: String.t()) :: api_response()
Calls the Get number of message deliveries API.
get_sent_multicast_count(date)
View Sourceget_sent_multicast_count(date :: String.t()) :: api_response()
Calls the Get number of sent multicast messages API.
get_sent_push_count(date)
View Sourceget_sent_push_count(date :: String.t()) :: api_response()
Calls the Get number of sent push messages API.
get_sent_reply_count(date)
View Sourceget_sent_reply_count(date :: String.t()) :: api_response()
Calls the Get number of sent reply messages API.
issue_link_token(user_id)
View Sourceissue_link_token(user_id :: String.t()) :: api_response()
Calls the Issue link token API.
leave_group(group_id)
View Sourceleave_group(group_id :: String.t()) :: api_response()
Calls the Leave group API.
leave_room(room_id)
View Sourceleave_room(room_id :: String.t()) :: api_response()
Calls the Leave room API.
send_broadcast(messages, notification_disabled \\ false)
View Sourcesend_broadcast( messages :: [LineBot.Message.t()] | LineBot.Message.t(), notification_disabled :: boolean() ) :: api_response()
Sends one or more broadcast messages.
send_multicast(to, messages, notification_disabled \\ false)
View Sourcesend_multicast( to :: [String.t()], messages :: [LineBot.Message.t()] | LineBot.Message.t(), notification_disabled :: boolean() ) :: api_response()
Sends one or more multicast messages.
send_push(to, messages, notification_disabled \\ false)
View Sourcesend_push( to :: String.t(), messages :: [LineBot.Message.t()] | LineBot.Message.t(), notification_disabled :: boolean() ) :: api_response()
Sends one or more push messages.
send_reply(reply_token, messages, notification_disabled \\ false)
View Sourcesend_reply( reply_token :: String.t(), messages :: [LineBot.Message.t()] | LineBot.Message.t(), notification_disabled :: boolean() ) :: api_response()
Sends one or more reply messages.
Link to this section Callbacks
handle_account_link(data, info, reply_token)
View Source (optional)handle_account_link( data :: map(), info :: LineBot.EventInfo.t(), reply_token :: binary() ) :: any()
Called when an Account Link event is received.
handle_beacon(data, info, reply_token)
View Source (optional)handle_beacon( data :: map(), info :: LineBot.EventInfo.t(), reply_token :: binary() ) :: any()
Called when a Beacon event is received.
handle_follow(info, reply_token)
View Source (optional)handle_follow(info :: LineBot.EventInfo.t(), reply_token :: binary()) :: any()
Called when a Follow event is received.
handle_join(info, reply_token)
View Source (optional)handle_join(info :: LineBot.EventInfo.t(), reply_token :: binary()) :: any()
Called when a Join event is received.
handle_leave(info)
View Source (optional)handle_leave(info :: LineBot.EventInfo.t()) :: any()
Called when a Leave event is received.
handle_member_joined(members, info, reply_token)
View Source (optional)handle_member_joined( members :: list(), info :: LineBot.EventInfo.t(), reply_token :: binary() ) :: any()
Called when a Member Joined event is received.
handle_member_left(members, info)
View Source (optional)handle_member_left(members :: list(), info :: LineBot.EventInfo.t()) :: any()
Called when a Member Left event is received.
handle_message(message, info, reply_token)
View Source (optional)handle_message( message :: map(), info :: LineBot.EventInfo.t(), reply_token :: binary() ) :: any()
Called when a Message event is received.
handle_other(type, event, info, reply_token)
View Source (optional)handle_other( type :: binary(), event :: map(), info :: LineBot.EventInfo.t(), reply_token :: binary() | nil ) :: any()
Called when an unknown even it received. The type
contains the unknown event type, and the full event is passed as the event
argument. If a reply token was not present in the event, reply_token
will be nil
.
handle_postback(data, info, reply_token)
View Source (optional)handle_postback( data :: any(), info :: LineBot.EventInfo.t(), reply_token :: binary() ) :: any()
Called when a Postback event is received.
handle_things(data, info, reply_token)
View Source (optional)handle_things( data :: map(), info :: LineBot.EventInfo.t(), reply_token :: binary() ) :: any()
Called when a LINE Things Scenario Execution event is received.
handle_unfollow(info)
View Source (optional)handle_unfollow(info :: LineBot.EventInfo.t()) :: any()
Called when an Unfollow event is received.