Q&A

Carousel message can have only one column

Pre condition, Condition to reproduce

I faced a very strange situation: the carousel message objece is like below: I found if I put these 2 columns together, I got 400 bad request. But if I remove either one of column, it works, I am confused about this, can anybody help ?

I use office line-bot-sdk Nodejs.

'{"messages":[{"type":"template","altText":"好物一覽","template":{"type":"carousel","imageAspectRatio":"rectangle","imageSize":"cover","columns":[{"thumbnailImageUrl":"https://frogpos.app/images/cake.jpg","imageBackgroundColor":"#ffffff","title":"超好吃的巧克力蛋糕","text":"吃一口可以香死人啊","actions":[{"type":"postback","label":"+1 戳這裡 (280元)","data":"item=cake&store=wk&price=280"}]},{"thumbnailImageUrl":"https://frogpos.app/images/dumpling.jpg","imageBackgroundColor":"#ffffff","title":"手桿皮冷凍水餃","text":"薄皮大餡,物超所值","actions":[{"type":"postback","label":"韭菜 +1 (120元)","data":"item=cake&store=wk&price=120"},{"type":"postback","label":"韭黃蝦仁 +1 (180元)","data":"item=cake&store=wk&price=120"}]}]}}],"replyToken":"6da5761759af4f008b11664ba672490a","notificationDisabled":false}'

Issue/ Error Message details

headers: [Object], 2021-08-31T04:38:15.214924+00:00 app[web.1]: transformRequest: [Array], 2021-08-31T04:38:15.214924+00:00 app[web.1]: transformResponse: [Array], 2021-08-31T04:38:15.214924+00:00 app[web.1]: timeout: 0, 2021-08-31T04:38:15.214925+00:00 app[web.1]: adapter: [Function: httpAdapter], 2021-08-31T04:38:15.214925+00:00 app[web.1]: xsrfCookieName: 'XSRF-TOKEN', 2021-08-31T04:38:15.214925+00:00 app[web.1]: xsrfHeaderName: 'X-XSRF-TOKEN', 2021-08-31T04:38:15.214925+00:00 app[web.1]: maxContentLength: -1, 2021-08-31T04:38:15.214926+00:00 app[web.1]: maxBodyLength: -1, 2021-08-31T04:38:15.214926+00:00 app[web.1]: validateStatus: [Function: validateStatus] 2021-08-31T04:38:15.214926+00:00 app[web.1]: }, 2021-08-31T04:38:15.214927+00:00 app[web.1]: request: ClientRequest { 2021-08-31T04:38:15.214927+00:00 app[web.1]: _events: [Object: null prototype], 2021-08-31T04:38:15.214927+00:00 app[web.1]: _eventsCount: 7, 2021-08-31T04:38:15.214928+00:00 app[web.1]: _maxListeners: undefined, 2021-08-31T04:38:15.214928+00:00 app[web.1]: outputData: [], 2021-08-31T04:38:15.214928+00:00 app[web.1]: outputSize: 0, 2021-08-31T04:38:15.214929+00:00 app[web.1]: writable: true, 2021-08-31T04:38:15.214929+00:00 app[web.1]: destroyed: false, 2021-08-31T04:38:15.214929+00:00 app[web.1]: _last: true, 2021-08-31T04:38:15.214930+00:00 app[web.1]: chunkedEncoding: false, 2021-08-31T04:38:15.214930+00:00 app[web.1]: shouldKeepAlive: false, 2021-08-31T04:38:15.214930+00:00 app[web.1]: _defaultKeepAlive: true, 2021-08-31T04:38:15.214931+00:00 app[web.1]: useChunkedEncodingByDefault: true, 2021-08-31T04:38:15.214931+00:00 app[web.1]: sendDate: false, 2021-08-31T04:38:15.214931+00:00 app[web.1]: _removedConnection: false, 2021-08-31T04:38:15.214931+00:00 app[web.1]: _removedContLen: false, 2021-08-31T04:38:15.214932+00:00 app[web.1]: _removedTE: false, 2021-08-31T04:38:15.214932+00:00 app[web.1]: _contentLength: null, 2021-08-31T04:38:15.214932+00:00 app[web.1]: _hasBody: true, 2021-08-31T04:38:15.214932+00:00 app[web.1]: _trailer: '', 2021-08-31T04:38:15.214932+00:00 app[web.1]: finished: true, 2021-08-31T04:38:15.214932+00:00 app[web.1]: _headerSent: true, 2021-08-31T04:38:15.214933+00:00 app[web.1]: socket: [TLSSocket], 2021-08-31T04:38:15.214933+00:00 app[web.1]: _header: 'POST /v2/bot/message/reply HTTP/1.1\r\n' + 2021-08-31T04:38:15.214934+00:00 app[web.1]: 'Accept: application/json, text/plain, /\r\n' + 2021-08-31T04:38:15.214934+00:00 app[web.1]: 'Content-Type: application/json\r\n' + 2021-08-31T04:38:15.214935+00:00 app[web.1]: 'Authorization: Bearer THE TOKEN DATA\r\n' + 2021-08-31T04:38:15.214935+00:00 app[web.1]: 'User-Agent: @line/bot-sdk/7.3.0\r\n' + 2021-08-31T04:38:15.214935+00:00 app[web.1]: 'Content-Length: 864\r\n' + 2021-08-31T04:38:15.214936+00:00 app[web.1]: 'Host: api.line.me\r\n' + 2021-08-31T04:38:15.214936+00:00 app[web.1]: 'Connection: close\r\n' + 2021-08-31T04:38:15.214936+00:00 app[web.1]: '\r\n', 2021-08-31T04:38:15.214936+00:00 app[web.1]: _keepAliveTimeout: 0, 2021-08-31T04:38:15.214937+00:00 app[web.1]: _onPendingData: [Function: noopPendingOutput], 2021-08-31T04:38:15.214937+00:00 app[web.1]: agent: [Agent], 2021-08-31T04:38:15.214937+00:00 app[web.1]: socketPath: undefined, 2021-08-31T04:38:15.214937+00:00 app[web.1]: method: 'POST', 2021-08-31T04:38:15.214938+00:00 app[web.1]: maxHeaderSize: undefined, 2021-08-31T04:38:15.214938+00:00 app[web.1]: insecureHTTPParser: undefined, 2021-08-31T04:38:15.214938+00:00 app[web.1]: path: '/v2/bot/message/reply', 2021-08-31T04:38:15.214938+00:00 app[web.1]: _ended: true, 2021-08-31T04:38:15.214939+00:00 app[web.1]: res: [IncomingMessage], 2021-08-31T04:38:15.214939+00:00 app[web.1]: aborted: false, 2021-08-31T04:38:15.214939+00:00 app[web.1]: timeoutCb: null, 2021-08-31T04:38:15.214940+00:00 app[web.1]: upgradeOrConnect: false, 2021-08-31T04:38:15.214947+00:00 app[web.1]: parser: null, 2021-08-31T04:38:15.214947+00:00 app[web.1]: maxHeadersCount: null, 2021-08-31T04:38:15.214947+00:00 app[web.1]: reusedSocket: false, 2021-08-31T04:38:15.214947+00:00 app[web.1]: host: 'api.line.me', 2021-08-31T04:38:15.214948+00:00 app[web.1]: protocol: 'https:', 2021-08-31T04:38:15.214948+00:00 app[web.1]: _redirectable: [Writable], 2021-08-31T04:38:15.214948+00:00 app[web.1]: [Symbol(kCapture)]: false, 2021-08-31T04:38:15.214949+00:00 app[web.1]: [Symbol(kNeedDrain)]: false, 2021-08-31T04:38:15.214949+00:00 app[web.1]: [Symbol(corked)]: 0, 2021-08-31T04:38:15.214949+00:00 app[web.1]: [Symbol(kOutHeaders)]: [Object: null prototype] 2021-08-31T04:38:15.214949+00:00 app[web.1]: }, 2021-08-31T04:38:15.214954+00:00 app[web.1]: response: { 2021-08-31T04:38:15.214954+00:00 app[web.1]: status: 400, 2021-08-31T04:38:15.214954+00:00 app[web.1]: statusText: 'Bad Request', 2021-08-31T04:38:15.214955+00:00 app[web.1]: headers: [Object], 2021-08-31T04:38:15.214955+00:00 app[web.1]: config: [Object], 2021-08-31T04:38:15.214955+00:00 app[web.1]: request: [ClientRequest], 2021-08-31T04:38:15.214955+00:00 app[web.1]: data: [Object] 2021-08-31T04:38:15.214956+00:00 app[web.1]: }, 2021-08-31T04:38:15.214956+00:00 app[web.1]: isAxiosError: true, 2021-08-31T04:38:15.214956+00:00 app[web.1]: toJSON: [Function: toJSON] 2021-08-31T04:38:15.214956+00:00 app[web.1]: } 2021-08-31T04:38:15.214957+00:00 app[web.1]: }

Accompanying respective source code

Resolution Tried

Reference information (Version / Platform/ environment)

  • 0
  • 2
  • 1639
  • twitter facebook

I finally sort this out. Number of buttons must be same on every carousel card. Otherwise got error. That is the reason why only one card OK, but 2 cards with different number of buttons not working.

Thanks everybody.

  • 0

you must not show your token... Please delete "Bearer" line...

And, can you show more error log? I can't find any reason such simple log. I think your json is almost right and it's not strange and bug in messaging api. How about sending it as json via CLI? What happens?

  • 0

Similar posts

    No similar posts

Are you sure? question.vm