diff --git a/app/controllers/api/messaging.php b/app/controllers/api/messaging.php index 8a15de5173..50128cbb00 100644 --- a/app/controllers/api/messaging.php +++ b/app/controllers/api/messaging.php @@ -2945,7 +2945,11 @@ App::post('/v1/messaging/messages/push') throw new Exception(Exception::STORAGE_FILE_NOT_PUBLIC); } - $image = "{$protocol}://{$host}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/view?project={$project->getId()}"; + $image = [ + 'bucketId' => $bucket->getId(), + 'fileId' => $file->getId(), + 'url' => "{$protocol}://{$host}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/view?project={$project->getId()}", + ]; } $pushData = []; @@ -3770,7 +3774,11 @@ App::patch('/v1/messaging/messages/push/:messageId') throw new Exception(Exception::STORAGE_FILE_NOT_PUBLIC); } - $pushData['image'] = "{$protocol}://{$host}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/view?project={$project->getId()}"; + $pushData['image'] = [ + 'bucketId' => $bucket->getId(), + 'fileId' => $file->getId(), + 'url' => "{$protocol}://{$host}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/view?project={$project->getId()}" + ]; } $message->setAttribute('data', $pushData); diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 6ebedd41a3..0f1503b3e5 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -627,7 +627,7 @@ class Messaging extends Action $body = $message['data']['body']; $data = $message['data']['data'] ?? null; $action = $message['data']['action'] ?? null; - $image = $message['data']['image'] ?? null; + $image = $message['data']['image']['url'] ?? null; $sound = $message['data']['sound'] ?? null; $icon = $message['data']['icon'] ?? null; $color = $message['data']['color'] ?? null;