From 8dabc2743a0e6267b0f83c77c65072a42ed4b832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Albarca?= Date: Mon, 6 Feb 2023 19:04:30 +0100 Subject: [PATCH] Fix optional footer for interactive list messages --- src/Request/MessageRequest/RequestOptionsListMessage.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Request/MessageRequest/RequestOptionsListMessage.php b/src/Request/MessageRequest/RequestOptionsListMessage.php index 6e1b4ec..8c621cc 100644 --- a/src/Request/MessageRequest/RequestOptionsListMessage.php +++ b/src/Request/MessageRequest/RequestOptionsListMessage.php @@ -11,7 +11,7 @@ final class RequestOptionsListMessage extends MessageRequest */ public function body(): array { - return [ + $request = [ 'messaging_product' => $this->message->messagingProduct(), 'recipient_type' => $this->message->recipientType(), 'to' => $this->message->to(), @@ -23,9 +23,14 @@ public function body(): array 'text' => $this->message->header(), ], 'body' => ['text' => $this->message->body()], - 'footer' => ['text' => $this->message->footer()], 'action' => $this->message->action(), ], ]; + + if ($this->message->footer()) { + $request['interactive']['footer'] = ['text' => $this->message->footer()]; + } + + return $request; } }