Skip to content

Kitchensink example 'flex json' #657

@datoslabs

Description

@datoslabs

System Information

  • OS: Windows 11
  • Go Version [e.g. 1.24.3] 1.25.1
  • line-bot-sdk-go version(s) [e.g. 8.13.1] 8.18.0? (github main branch as of 1/13/2026)

Expected Behavior

Display the Brown Cafe flex message.

Current Behavior

Server error:
unexpected status code: 400, {"message":"A message (messages[0]) in the request body is invalid","details":[{"message":"invalid property","property":"/footer/contents/2"}]}

Steps to Reproduce

  1. git clone https://github.com/line/line-bot-sdk-go.git
  2. cd line-bot-sdk-go\examples\kitchensink
  3. go run server.go (after setting the env variables)
  4. send flex json message inside LINE App chat (with the bot)

Logs

2026/01/13 13:15:26 unexpected status code: 400, {"message":"A message (messages[0]) in the request body is invalid","details":[{"message":"invalid property","property":"/footer/contents/2"}]}

Additional Context (Optional)

I copied and pasted the json content into the FLEX MESSAGE SIMULATOR and it appears to be valid. UnmarshalFlexContainer call:

contents, err := messaging_api.UnmarshalFlexContainer([]byte(jsonString))

also completed without error. The error is returned from the following:

if _, err := app.bot.ReplyMessage(
&messaging_api.ReplyMessageRequest{
ReplyToken: replyToken,
Messages: []messaging_api.MessageInterface{
&messaging_api.FlexMessage{
AltText: "Flex message alt text",
Contents: contents,
},
},
},
); err != nil {
return err
}

The error message seems to suggest there is an invalid property in /footer/contents/2 which appears to be a spacer according to the JSON string. If the spacer, ie:

{
"type": "spacer",
"size": "sm"
}
is removed, the error disappears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions