webhook

package
v8.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSignature = errors.New("invalid signature")
)

Functions

func ValidateSignature

func ValidateSignature(channelSecret, signature string, body []byte) bool

Types

type AccountLinkEvent

type AccountLinkEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Reply token used to send reply message to this event. This property won't be included if linking the account has failed.
	 */
	ReplyToken string `json:"replyToken,omitempty"`

	/**
	 * Get Link
	 */
	Link *LinkContent `json:"link"`
}

func (*AccountLinkEvent) MarshalJSON

func (r *AccountLinkEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the AccountLinkEvent struct.

func (*AccountLinkEvent) UnmarshalJSON

func (cr *AccountLinkEvent) UnmarshalJSON(data []byte) error

type ActionResult

type ActionResult struct {

	/**
	 * Get Type
	 */
	Type ActionResultTYPE `json:"type"`

	/**
	 * Base64-encoded binary data
	 */
	Data string `json:"data,omitempty"`
}

type ActionResultTYPE

type ActionResultTYPE string
const (
	ActionResultTYPE_VOID ActionResultTYPE = "void"

	ActionResultTYPE_BINARY ActionResultTYPE = "binary"
)

ActionResultTYPE constants

type ActivatedEvent

type ActivatedEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Get ChatControl
	 */
	ChatControl *ChatControl `json:"chatControl"`
}

func (*ActivatedEvent) MarshalJSON

func (r *ActivatedEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the ActivatedEvent struct.

func (*ActivatedEvent) UnmarshalJSON

func (cr *ActivatedEvent) UnmarshalJSON(data []byte) error

type AllMentionee

type AllMentionee struct {
	Mentionee

	/**
	 * Index position of the user mention for a character in text, with the first character being at position 0. (Required)
	 */
	Index int32 `json:"index"`

	/**
	 * The length of the text of the mentioned user. For a mention @example, 8 is the length. (Required)
	 */
	Length int32 `json:"length"`
}

func (*AllMentionee) MarshalJSON

func (r *AllMentionee) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the AllMentionee struct.

type AttachedModuleContent

type AttachedModuleContent struct {
	ModuleContent

	/**
	 * User ID of the bot on the attached LINE Official Account (Required)
	 */
	BotId string `json:"botId"`

	/**
	 * An array of strings indicating the scope permitted by the admin of the LINE Official Account. (Required)
	 */
	Scopes []string `json:"scopes"`
}

func (*AttachedModuleContent) MarshalJSON

func (r *AttachedModuleContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the AttachedModuleContent struct.

type AudioMessageContent

type AudioMessageContent struct {
	MessageContent

	/**
	 * Message ID (Required)
	 */
	Id string `json:"id"`

	/**
	 * Get ContentProvider
	 */
	ContentProvider *ContentProvider `json:"contentProvider"`

	/**
	 * Length of audio file (milliseconds)
	 */
	Duration int64 `json:"duration"`
}

func (*AudioMessageContent) MarshalJSON

func (r *AudioMessageContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the AudioMessageContent struct.

type BeaconContent

type BeaconContent struct {

	/**
	 * Hardware ID of the beacon that was detected (Required)
	 */
	Hwid string `json:"hwid"`

	/**
	 * Type of beacon event. (Required)
	 */
	Type BeaconContentTYPE `json:"type"`

	/**
	 * Device message of beacon that was detected.
	 */
	Dm string `json:"dm,omitempty"`
}

type BeaconContentTYPE

type BeaconContentTYPE string

BeaconContentTYPE type

Type of beacon event.
const (
	BeaconContentTYPE_ENTER BeaconContentTYPE = "enter"

	BeaconContentTYPE_BANNER BeaconContentTYPE = "banner"

	BeaconContentTYPE_STAY BeaconContentTYPE = "stay"
)

BeaconContentTYPE constants

type BeaconEvent

type BeaconEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Reply token used to send reply message to this event (Required)
	 */
	ReplyToken string `json:"replyToken"`

	/**
	 * Get Beacon
	 */
	Beacon *BeaconContent `json:"beacon"`
}

func (*BeaconEvent) MarshalJSON

func (r *BeaconEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the BeaconEvent struct.

func (*BeaconEvent) UnmarshalJSON

func (cr *BeaconEvent) UnmarshalJSON(data []byte) error

type BotResumedEvent

type BotResumedEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`
}

func (*BotResumedEvent) MarshalJSON

func (r *BotResumedEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the BotResumedEvent struct.

func (*BotResumedEvent) UnmarshalJSON

func (cr *BotResumedEvent) UnmarshalJSON(data []byte) error

type BotSuspendedEvent

type BotSuspendedEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`
}

func (*BotSuspendedEvent) MarshalJSON

func (r *BotSuspendedEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the BotSuspendedEvent struct.

func (*BotSuspendedEvent) UnmarshalJSON

func (cr *BotSuspendedEvent) UnmarshalJSON(data []byte) error

type CallbackRequest

type CallbackRequest struct {

	/**
	 * User ID of a bot that should receive webhook events. The user ID value is a string that matches the regular expression, `U[0-9a-f]{32}`.  (Required)
	 */
	Destination string `json:"destination"`

	/**
	 * Array of webhook event objects. The LINE Platform may send an empty array that doesn't include a webhook event object to confirm communication.  (Required)
	 */
	Events []EventInterface `json:"events"`
}

CallbackRequest The request body contains a JSON object with the user ID of a bot that should receive webhook events and an array of webhook event objects. https://developers.line.biz/en/reference/messaging-api/#request-body

func ParseRequest

func ParseRequest(channelSecret string, r *http.Request) (*CallbackRequest, error)

ParseRequest func

func (*CallbackRequest) MarshalJSON

func (r *CallbackRequest) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the CallbackRequest struct.

func (*CallbackRequest) UnmarshalJSON

func (cr *CallbackRequest) UnmarshalJSON(data []byte) error

type ChatControl

type ChatControl struct {

	/**
	 * Get ExpireAt
	 */
	ExpireAt int64 `json:"expireAt"`
}

type ContentProvider

type ContentProvider struct {

	/**
	 * Provider of the image file. (Required)
	 */
	Type ContentProviderTYPE `json:"type"`

	/**
	 * URL of the image file. Only included when contentProvider.type is external.
	 */
	OriginalContentUrl string `json:"originalContentUrl,omitempty"`

	/**
	 * URL of the preview image. Only included when contentProvider.type is external.
	 */
	PreviewImageUrl string `json:"previewImageUrl,omitempty"`
}

type ContentProviderTYPE

type ContentProviderTYPE string

ContentProviderTYPE type

Provider of the image file.
const (
	ContentProviderTYPE_LINE ContentProviderTYPE = "line"

	ContentProviderTYPE_EXTERNAL ContentProviderTYPE = "external"
)

ContentProviderTYPE constants

type DeactivatedEvent

type DeactivatedEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`
}

func (*DeactivatedEvent) MarshalJSON

func (r *DeactivatedEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the DeactivatedEvent struct.

func (*DeactivatedEvent) UnmarshalJSON

func (cr *DeactivatedEvent) UnmarshalJSON(data []byte) error

type DeliveryContext

type DeliveryContext struct {

	/**
	 * Whether the webhook event is a redelivered one or not. (Required)
	 */
	IsRedelivery bool `json:"isRedelivery"`
}

type DetachedModuleContent

type DetachedModuleContent struct {
	ModuleContent

	/**
	 * Detached LINE Official Account bot user ID (Required)
	 */
	BotId string `json:"botId"`

	/**
	 * Reason for detaching (Required)
	 */
	Reason DetachedModuleContentREASON `json:"reason"`
}

func (*DetachedModuleContent) MarshalJSON

func (r *DetachedModuleContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the DetachedModuleContent struct.

type DetachedModuleContentREASON

type DetachedModuleContentREASON string

DetachedModuleContentREASON type

Reason for detaching
const (
	DetachedModuleContentREASON_BOT_DELETED DetachedModuleContentREASON = "bot_deleted"
)

DetachedModuleContentREASON constants

type Emoji

type Emoji struct {

	/**
	 * Index position for a character in text, with the first character being at position 0. (Required)
	 */
	Index int32 `json:"index"`

	/**
	 * The length of the LINE emoji string. For LINE emoji (hello), 7 is the length. (Required)
	 */
	Length int32 `json:"length"`

	/**
	 * Product ID for a LINE emoji set. (Required)
	 */
	ProductId string `json:"productId"`

	/**
	 * ID for a LINE emoji inside a set. (Required)
	 */
	EmojiId string `json:"emojiId"`
}

type ErrorHandlerFunc

type ErrorHandlerFunc func(error, *http.Request)

ErrorHandlerFunc type

type Event

type Event struct {
	Type string `json:"type"`

	Source Source `json:"source,omitempty"`

	Timestamp int64 `json:"timestamp"`

	Mode EventMode `json:"mode"`

	WebhookEventId string `json:"webhookEventId"`

	DeliveryContext DeliveryContext `json:"deliveryContext"`
}

func (Event) GetType

func (e Event) GetType() string

type EventInterface

type EventInterface interface {
	GetType() string
}

func UnmarshalEvent

func UnmarshalEvent(data []byte) (EventInterface, error)

type EventMode

type EventMode string

EventMode type

const (
	EventMode_ACTIVE EventMode = "active"

	EventMode_STANDBY EventMode = "standby"
)

EventMode constants

type EventsHandlerFunc

type EventsHandlerFunc func(*CallbackRequest, *http.Request)

EventsHandlerFunc type

type FileMessageContent

type FileMessageContent struct {
	MessageContent

	/**
	 * Message ID (Required)
	 */
	Id string `json:"id"`

	/**
	 * File name (Required)
	 */
	FileName string `json:"fileName"`

	/**
	 * File size in bytes (Required)
	 */
	FileSize int32 `json:"fileSize"`
}

func (*FileMessageContent) MarshalJSON

func (r *FileMessageContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the FileMessageContent struct.

type FollowDetail added in v8.4.0

type FollowDetail struct {

	/**
	 * Whether a user has added your LINE Official Account as a friend or unblocked. (Required)
	 */
	IsUnblocked bool `json:"isUnblocked"`
}

type FollowEvent

type FollowEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Reply token used to send reply message to this event (Required)
	 */
	ReplyToken string `json:"replyToken"`

	/**
	 * Get Follow
	 */
	Follow *FollowDetail `json:"follow"`
}

func (*FollowEvent) MarshalJSON

func (r *FollowEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the FollowEvent struct.

func (*FollowEvent) UnmarshalJSON

func (cr *FollowEvent) UnmarshalJSON(data []byte) error

type GroupSource

type GroupSource struct {
	Source

	/**
	 * Group ID of the source group chat (Required)
	 */
	GroupId string `json:"groupId"`

	/**
	 * ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId.
	 */
	UserId string `json:"userId,omitempty"`
}

func (*GroupSource) MarshalJSON

func (r *GroupSource) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the GroupSource struct.

type ImageMessageContent

type ImageMessageContent struct {
	MessageContent

	/**
	 * Message ID (Required)
	 */
	Id string `json:"id"`

	/**
	 * Get ContentProvider
	 */
	ContentProvider *ContentProvider `json:"contentProvider"`

	/**
	 * Get ImageSet
	 */
	ImageSet *ImageSet `json:"imageSet,omitempty"`

	/**
	 * Quote token to quote this message.  (Required)
	 */
	QuoteToken string `json:"quoteToken"`
}

func (*ImageMessageContent) MarshalJSON

func (r *ImageMessageContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the ImageMessageContent struct.

type ImageSet

type ImageSet struct {

	/**
	 * Image set ID. Only included when multiple images are sent simultaneously. (Required)
	 */
	Id string `json:"id"`

	/**
	 * An index starting from 1, indicating the image number in a set of images sent simultaneously. Only included when multiple images are sent simultaneously. However, it won't be included if the sender is using LINE 11.15 or earlier for Android.
	 */
	Index int32 `json:"index"`

	/**
	 * The total number of images sent simultaneously.
	 */
	Total int32 `json:"total"`
}

type JoinEvent

type JoinEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Reply token used to send reply message to this event (Required)
	 */
	ReplyToken string `json:"replyToken"`
}

func (*JoinEvent) MarshalJSON

func (r *JoinEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the JoinEvent struct.

func (*JoinEvent) UnmarshalJSON

func (cr *JoinEvent) UnmarshalJSON(data []byte) error

type JoinedMembers

type JoinedMembers struct {

	/**
	 * Users who joined. Array of source user objects. (Required)
	 */
	Members []UserSource `json:"members"`
}

type LeaveEvent

type LeaveEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`
}

func (*LeaveEvent) MarshalJSON

func (r *LeaveEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the LeaveEvent struct.

func (*LeaveEvent) UnmarshalJSON

func (cr *LeaveEvent) UnmarshalJSON(data []byte) error

type LeftMembers

type LeftMembers struct {

	/**
	 * Users who left. Array of source user objects. (Required)
	 */
	Members []UserSource `json:"members"`
}

type LinkContent

type LinkContent struct {

	/**
	 * One of the following values to indicate whether linking the account was successful or not (Required)
	 */
	Result LinkContentRESULT `json:"result"`

	/**
	 * Specified nonce (number used once) when verifying the user ID. (Required)
	 */
	Nonce string `json:"nonce"`
}

type LinkContentRESULT

type LinkContentRESULT string

LinkContentRESULT type

One of the following values to indicate whether linking the account was successful or not
const (
	LinkContentRESULT_OK LinkContentRESULT = "ok"

	LinkContentRESULT_FAILED LinkContentRESULT = "failed"
)

LinkContentRESULT constants

type LinkThingsContent

type LinkThingsContent struct {
	ThingsContent

	/**
	 * Device ID of the device that has been linked with LINE. (Required)
	 */
	DeviceId string `json:"deviceId"`
}

func (*LinkThingsContent) MarshalJSON

func (r *LinkThingsContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the LinkThingsContent struct.

type LocationMessageContent

type LocationMessageContent struct {
	MessageContent

	/**
	 * Message ID (Required)
	 */
	Id string `json:"id"`

	/**
	 * Title
	 */
	Title string `json:"title,omitempty"`

	/**
	 * Address
	 */
	Address string `json:"address,omitempty"`

	/**
	 * Latitude (Required)
	 */
	Latitude float64 `json:"latitude"`

	/**
	 * Longitude (Required)
	 */
	Longitude float64 `json:"longitude"`
}

func (*LocationMessageContent) MarshalJSON

func (r *LocationMessageContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the LocationMessageContent struct.

type MemberJoinedEvent

type MemberJoinedEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Reply token used to send reply message to this event (Required)
	 */
	ReplyToken string `json:"replyToken"`

	/**
	 * Get Joined
	 */
	Joined *JoinedMembers `json:"joined"`
}

func (*MemberJoinedEvent) MarshalJSON

func (r *MemberJoinedEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the MemberJoinedEvent struct.

func (*MemberJoinedEvent) UnmarshalJSON

func (cr *MemberJoinedEvent) UnmarshalJSON(data []byte) error

type MemberLeftEvent

type MemberLeftEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Get Left
	 */
	Left *LeftMembers `json:"left"`
}

func (*MemberLeftEvent) MarshalJSON

func (r *MemberLeftEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the MemberLeftEvent struct.

func (*MemberLeftEvent) UnmarshalJSON

func (cr *MemberLeftEvent) UnmarshalJSON(data []byte) error

type Mention

type Mention struct {

	/**
	 * Array of one or more mention objects. Max: 20 mentions (Required)
	 */
	Mentionees []MentioneeInterface `json:"mentionees"`
}

func (*Mention) MarshalJSON

func (r *Mention) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the Mention struct.

func (*Mention) UnmarshalJSON

func (cr *Mention) UnmarshalJSON(data []byte) error

type Mentionee

type Mentionee struct {
	Type string `json:"type"`

	Index int32 `json:"index"`

	Length int32 `json:"length"`
}

func (Mentionee) GetType

func (e Mentionee) GetType() string

type MentioneeInterface

type MentioneeInterface interface {
	GetType() string
}

func UnmarshalMentionee

func UnmarshalMentionee(data []byte) (MentioneeInterface, error)

type MessageContent

type MessageContent struct {
	Type string `json:"type"`

	Id string `json:"id"`
}

func (MessageContent) GetType

func (e MessageContent) GetType() string

type MessageContentInterface

type MessageContentInterface interface {
	GetType() string
}

func UnmarshalMessageContent

func UnmarshalMessageContent(data []byte) (MessageContentInterface, error)

type MessageEvent

type MessageEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Get ReplyToken
	 */
	ReplyToken string `json:"replyToken,omitempty"`

	/**
	 * Get Message
	 */
	Message MessageContentInterface `json:"message"`
}

func (*MessageEvent) MarshalJSON

func (r *MessageEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the MessageEvent struct.

func (*MessageEvent) UnmarshalJSON

func (cr *MessageEvent) UnmarshalJSON(data []byte) error

type ModuleContent

type ModuleContent struct {
	Type string `json:"type"`
}

func (ModuleContent) GetType

func (e ModuleContent) GetType() string

type ModuleContentInterface

type ModuleContentInterface interface {
	GetType() string
}

func UnmarshalModuleContent

func UnmarshalModuleContent(data []byte) (ModuleContentInterface, error)

type ModuleEvent

type ModuleEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Get Module
	 */
	Module ModuleContentInterface `json:"module"`
}

func (*ModuleEvent) MarshalJSON

func (r *ModuleEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the ModuleEvent struct.

func (*ModuleEvent) UnmarshalJSON

func (cr *ModuleEvent) UnmarshalJSON(data []byte) error

type PnpDelivery added in v8.1.0

type PnpDelivery struct {

	/**
	 * A hashed phone number string or a string specified by `X-Line-Delivery-Tag` header (Required)
	 */
	Data string `json:"data"`
}

type PnpDeliveryCompletionEvent added in v8.1.0

type PnpDeliveryCompletionEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Get Delivery
	 */
	Delivery *PnpDelivery `json:"delivery"`
}

func (*PnpDeliveryCompletionEvent) MarshalJSON added in v8.1.0

func (r *PnpDeliveryCompletionEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the PnpDeliveryCompletionEvent struct.

func (*PnpDeliveryCompletionEvent) UnmarshalJSON added in v8.1.0

func (cr *PnpDeliveryCompletionEvent) UnmarshalJSON(data []byte) error

type PostbackContent

type PostbackContent struct {

	/**
	 * Postback data (Required)
	 */
	Data string `json:"data"`

	/**
	 * Get Params
	 */
	Params map[string]string `json:"params"`
}

type PostbackEvent

type PostbackEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Reply token used to send reply message to this event
	 */
	ReplyToken string `json:"replyToken,omitempty"`

	/**
	 * Get Postback
	 */
	Postback *PostbackContent `json:"postback"`
}

func (*PostbackEvent) MarshalJSON

func (r *PostbackEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the PostbackEvent struct.

func (*PostbackEvent) UnmarshalJSON

func (cr *PostbackEvent) UnmarshalJSON(data []byte) error

type RoomSource

type RoomSource struct {
	Source

	/**
	 * ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId.
	 */
	UserId string `json:"userId,omitempty"`

	/**
	 * Room ID of the source multi-person chat (Required)
	 */
	RoomId string `json:"roomId"`
}

func (*RoomSource) MarshalJSON

func (r *RoomSource) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the RoomSource struct.

type ScenarioResult

type ScenarioResult struct {

	/**
	 * Scenario ID executed
	 */
	ScenarioId string `json:"scenarioId,omitempty"`

	/**
	 * Revision number of the scenario set containing the executed scenario
	 */
	Revision int32 `json:"revision"`

	/**
	 * Timestamp for when execution of scenario action started (milliseconds, LINE app time) (Required)
	 */
	StartTime int64 `json:"startTime"`

	/**
	 * Timestamp for when execution of scenario was completed (milliseconds, LINE app time) (Required)
	 */
	EndTime int64 `json:"endTime"`

	/**
	 * Scenario execution completion status (Required)
	 */
	ResultCode string `json:"resultCode"`

	/**
	 * Execution result of individual operations specified in action. Only included when things.result.resultCode is success.
	 */
	ActionResults []ActionResult `json:"actionResults,omitempty"`

	/**
	 * Data contained in notification.
	 */
	BleNotificationPayload string `json:"bleNotificationPayload,omitempty"`

	/**
	 * Error reason.
	 */
	ErrorReason string `json:"errorReason,omitempty"`
}

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

type ScenarioResultThingsContent

type ScenarioResultThingsContent struct {
	ThingsContent

	/**
	 * Device ID of the device that has been linked with LINE. (Required)
	 */
	DeviceId string `json:"deviceId"`

	/**
	 * Get Result
	 */
	Result *ScenarioResult `json:"result"`
}

func (*ScenarioResultThingsContent) MarshalJSON

func (r *ScenarioResultThingsContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the ScenarioResultThingsContent struct.

type Source

type Source struct {
	Type string `json:"type,omitempty"`
}

func (Source) GetType

func (e Source) GetType() string

type SourceInterface

type SourceInterface interface {
	GetType() string
}

func UnmarshalSource

func UnmarshalSource(data []byte) (SourceInterface, error)

type StickerMessageContent

type StickerMessageContent struct {
	MessageContent

	/**
	 * Message ID (Required)
	 */
	Id string `json:"id"`

	/**
	 * Package ID (Required)
	 */
	PackageId string `json:"packageId"`

	/**
	 * Sticker ID (Required)
	 */
	StickerId string `json:"stickerId"`

	/**
	 * Get StickerResourceType
	 */
	StickerResourceType StickerMessageContentSTICKER_RESOURCE_TYPE `json:"stickerResourceType"`

	/**
	 * Array of up to 15 keywords describing the sticker. If a sticker has 16 or more keywords, a random selection of 15 keywords will be returned. The keyword selection is random for each event, so different keywords may be returned for the same sticker.
	 */
	Keywords []string `json:"keywords"`

	/**
	 * Any text entered by the user. This property is only included for message stickers. Max character limit: 100
	 */
	Text string `json:"text,omitempty"`

	/**
	 * Quote token to quote this message.  (Required)
	 */
	QuoteToken string `json:"quoteToken"`

	/**
	 * Message ID of a quoted message. Only included when the received message quotes a past message.
	 */
	QuotedMessageId string `json:"quotedMessageId,omitempty"`
}

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

func (*StickerMessageContent) MarshalJSON

func (r *StickerMessageContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the StickerMessageContent struct.

type StickerMessageContentSTICKER_RESOURCE_TYPE

type StickerMessageContentSTICKER_RESOURCE_TYPE string
const (
	StickerMessageContentSTICKER_RESOURCE_TYPE_STATIC StickerMessageContentSTICKER_RESOURCE_TYPE = "STATIC"

	StickerMessageContentSTICKER_RESOURCE_TYPE_ANIMATION StickerMessageContentSTICKER_RESOURCE_TYPE = "ANIMATION"

	StickerMessageContentSTICKER_RESOURCE_TYPE_SOUND StickerMessageContentSTICKER_RESOURCE_TYPE = "SOUND"

	StickerMessageContentSTICKER_RESOURCE_TYPE_ANIMATION_SOUND StickerMessageContentSTICKER_RESOURCE_TYPE = "ANIMATION_SOUND"

	StickerMessageContentSTICKER_RESOURCE_TYPE_POPUP StickerMessageContentSTICKER_RESOURCE_TYPE = "POPUP"

	StickerMessageContentSTICKER_RESOURCE_TYPE_POPUP_SOUND StickerMessageContentSTICKER_RESOURCE_TYPE = "POPUP_SOUND"

	StickerMessageContentSTICKER_RESOURCE_TYPE_CUSTOM StickerMessageContentSTICKER_RESOURCE_TYPE = "CUSTOM"

	StickerMessageContentSTICKER_RESOURCE_TYPE_MESSAGE StickerMessageContentSTICKER_RESOURCE_TYPE = "MESSAGE"

	StickerMessageContentSTICKER_RESOURCE_TYPE_NAME_TEXT StickerMessageContentSTICKER_RESOURCE_TYPE = "NAME_TEXT"

	StickerMessageContentSTICKER_RESOURCE_TYPE_PER_STICKER_TEXT StickerMessageContentSTICKER_RESOURCE_TYPE = "PER_STICKER_TEXT"
)

StickerMessageContentSTICKER_RESOURCE_TYPE constants

type TextMessageContent

type TextMessageContent struct {
	MessageContent

	/**
	 * Message ID (Required)
	 */
	Id string `json:"id"`

	/**
	 * Message text. (Required)
	 */
	Text string `json:"text"`

	/**
	 * Array of one or more LINE emoji objects. Only included in the message event when the text property contains a LINE emoji.
	 */
	Emojis []Emoji `json:"emojis,omitempty"`

	/**
	 * Get Mention
	 */
	Mention *Mention `json:"mention,omitempty"`

	/**
	 * Quote token to quote this message.  (Required)
	 */
	QuoteToken string `json:"quoteToken"`

	/**
	 * Message ID of a quoted message. Only included when the received message quotes a past message.
	 */
	QuotedMessageId string `json:"quotedMessageId,omitempty"`
}

func (*TextMessageContent) MarshalJSON

func (r *TextMessageContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the TextMessageContent struct.

type ThingsContent

type ThingsContent struct {
	Type string `json:"type"`
}

func (ThingsContent) GetType

func (e ThingsContent) GetType() string

type ThingsContentInterface

type ThingsContentInterface interface {
	GetType() string
}

func UnmarshalThingsContent

func UnmarshalThingsContent(data []byte) (ThingsContentInterface, error)

type ThingsEvent

type ThingsEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Reply token used to send reply message to this event (Required)
	 */
	ReplyToken string `json:"replyToken"`

	/**
	 * Get Things
	 */
	Things ThingsContentInterface `json:"things"`
}

func (*ThingsEvent) MarshalJSON

func (r *ThingsEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the ThingsEvent struct.

func (*ThingsEvent) UnmarshalJSON

func (cr *ThingsEvent) UnmarshalJSON(data []byte) error

type UnfollowEvent

type UnfollowEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`
}

func (*UnfollowEvent) MarshalJSON

func (r *UnfollowEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the UnfollowEvent struct.

func (*UnfollowEvent) UnmarshalJSON

func (cr *UnfollowEvent) UnmarshalJSON(data []byte) error

type UnknownEvent

type UnknownEvent struct {
	EventInterface
	Type string
	Raw  map[string]json.RawMessage
}

func (UnknownEvent) GetType

func (e UnknownEvent) GetType() string

type UnknownMentionee

type UnknownMentionee struct {
	MentioneeInterface
	Type string
	Raw  map[string]json.RawMessage
}

func (UnknownMentionee) GetType

func (e UnknownMentionee) GetType() string

type UnknownMessageContent

type UnknownMessageContent struct {
	MessageContentInterface
	Type string
	Raw  map[string]json.RawMessage
}

func (UnknownMessageContent) GetType

func (e UnknownMessageContent) GetType() string

type UnknownModuleContent

type UnknownModuleContent struct {
	ModuleContentInterface
	Type string
	Raw  map[string]json.RawMessage
}

func (UnknownModuleContent) GetType

func (e UnknownModuleContent) GetType() string

type UnknownSource

type UnknownSource struct {
	SourceInterface
	Type string
	Raw  map[string]json.RawMessage
}

func (UnknownSource) GetType

func (e UnknownSource) GetType() string

type UnknownThingsContent

type UnknownThingsContent struct {
	ThingsContentInterface
	Type string
	Raw  map[string]json.RawMessage
}

func (UnknownThingsContent) GetType

func (e UnknownThingsContent) GetType() string

type UnlinkThingsContent

type UnlinkThingsContent struct {
	ThingsContent

	/**
	 * Device ID of the device that has been linked with LINE. (Required)
	 */
	DeviceId string `json:"deviceId"`
}

func (*UnlinkThingsContent) MarshalJSON

func (r *UnlinkThingsContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the UnlinkThingsContent struct.

type UnsendDetail

type UnsendDetail struct {

	/**
	 * The message ID of the unsent message (Required)
	 */
	MessageId string `json:"messageId"`
}

type UnsendEvent

type UnsendEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Get Unsend
	 */
	Unsend *UnsendDetail `json:"unsend"`
}

func (*UnsendEvent) MarshalJSON

func (r *UnsendEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the UnsendEvent struct.

func (*UnsendEvent) UnmarshalJSON

func (cr *UnsendEvent) UnmarshalJSON(data []byte) error

type UserMentionee

type UserMentionee struct {
	Mentionee

	/**
	 * Index position of the user mention for a character in text, with the first character being at position 0. (Required)
	 */
	Index int32 `json:"index"`

	/**
	 * The length of the text of the mentioned user. For a mention @example, 8 is the length. (Required)
	 */
	Length int32 `json:"length"`

	/**
	 * User ID of the mentioned user. Only included if mention.mentions[].type is user and the user consents to the LINE Official Account obtaining their user profile information.
	 */
	UserId string `json:"userId,omitempty"`
}

func (*UserMentionee) MarshalJSON

func (r *UserMentionee) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the UserMentionee struct.

type UserSource

type UserSource struct {
	Source

	/**
	 * ID of the source user
	 */
	UserId string `json:"userId,omitempty"`
}

func (*UserSource) MarshalJSON

func (r *UserSource) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the UserSource struct.

type VideoMessageContent

type VideoMessageContent struct {
	MessageContent

	/**
	 * Message ID (Required)
	 */
	Id string `json:"id"`

	/**
	 * Length of video file (milliseconds)
	 */
	Duration int64 `json:"duration"`

	/**
	 * Get ContentProvider
	 */
	ContentProvider *ContentProvider `json:"contentProvider"`

	/**
	 * Quote token to quote this message.  (Required)
	 */
	QuoteToken string `json:"quoteToken"`
}

func (*VideoMessageContent) MarshalJSON

func (r *VideoMessageContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the VideoMessageContent struct.

type VideoPlayComplete

type VideoPlayComplete struct {

	/**
	 * ID used to identify a video. Returns the same value as the trackingId assigned to the video message. (Required)
	 */
	TrackingId string `json:"trackingId"`
}

type VideoPlayCompleteEvent

type VideoPlayCompleteEvent struct {
	Event

	/**
	 * Get Source
	 */
	Source SourceInterface `json:"source,omitempty"`

	/**
	 * Time of the event in milliseconds. (Required)
	 */
	Timestamp int64 `json:"timestamp"`

	/**
	 * Get Mode
	 */
	Mode EventMode `json:"mode"`

	/**
	 * Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
	 */
	WebhookEventId string `json:"webhookEventId"`

	/**
	 * Get DeliveryContext
	 */
	DeliveryContext *DeliveryContext `json:"deliveryContext"`

	/**
	 * Reply token used to send reply message to this event (Required)
	 */
	ReplyToken string `json:"replyToken"`

	/**
	 * Get VideoPlayComplete
	 */
	VideoPlayComplete *VideoPlayComplete `json:"videoPlayComplete"`
}

func (*VideoPlayCompleteEvent) MarshalJSON

func (r *VideoPlayCompleteEvent) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON serialization of the VideoPlayCompleteEvent struct.

func (*VideoPlayCompleteEvent) UnmarshalJSON

func (cr *VideoPlayCompleteEvent) UnmarshalJSON(data []byte) error

type WebhookHandler

type WebhookHandler struct {
	// contains filtered or unexported fields
}

WebhookHandler type

func NewWebhookHandler

func NewWebhookHandler(channelSecret string) (*WebhookHandler, error)

New returns a new WebhookHandler instance.

func (*WebhookHandler) HandleError

func (wh *WebhookHandler) HandleError(f ErrorHandlerFunc)

HandleError method

func (*WebhookHandler) HandleEvents

func (wh *WebhookHandler) HandleEvents(f EventsHandlerFunc)

HandleEvents method

func (*WebhookHandler) ServeHTTP

func (wh *WebhookHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL