diff --git a/messenger.rst b/messenger.rst index cbd286a2f50..1e5c0945e27 100644 --- a/messenger.rst +++ b/messenger.rst @@ -2960,12 +2960,10 @@ Let's say you want to create a message decoder:: { public function decode(array $encodedEnvelope): Envelope { - $envelope = \json_decode($encodedEnvelope, true); - try { // parse the data you received with your custom fields - $data = $envelope['data']; - $data['token'] = $envelope['token']; + $data = json_decode($encodedEnvelope['body'], true); + $data['token'] = $encodedEnvelope['token']; // other operations like getting information from stamps } catch (\Throwable $throwable) {