diff --git a/lib/private/notification/inotification.php b/lib/private/notification/inotification.php
index b79b7f6d9d380913685a40e7f65f472356d8e384..0187abab152294e9cd15878452729076a8d0e8d2 100644
--- a/lib/private/notification/inotification.php
+++ b/lib/private/notification/inotification.php
@@ -76,10 +76,11 @@ interface INotification {
 
 	/**
 	 * @param string $type
-	 * @param int $id
+	 * @param string $id
 	 * @return $this
-	 * @throws \InvalidArgumentException if the object type or id are invalid
+	 * @throws \InvalidArgumentException if the object type or id is invalid
 	 * @since 8.2.0
+	 * @changed 9.0.0 Type of $id changed to string
 	 */
 	public function setObject($type, $id);
 
@@ -90,8 +91,9 @@ interface INotification {
 	public function getObjectType();
 
 	/**
-	 * @return int
+	 * @return string
 	 * @since 8.2.0
+	 * @changed 9.0.0 Return type changed to string
 	 */
 	public function getObjectId();
 
diff --git a/lib/private/notification/notification.php b/lib/private/notification/notification.php
index a22d5446f457ae4cbe610306ae11e2ab1f3acfb7..70964fc0366eec287fe87af1abe77ba910698f53 100644
--- a/lib/private/notification/notification.php
+++ b/lib/private/notification/notification.php
@@ -35,7 +35,7 @@ class Notification implements INotification {
 	/** @var string */
 	protected $objectType;
 
-	/** @var int */
+	/** @var string */
 	protected $objectId;
 
 	/** @var string */
@@ -83,7 +83,7 @@ class Notification implements INotification {
 		$this->dateTime = new \DateTime();
 		$this->dateTime->setTimestamp(0);
 		$this->objectType = '';
-		$this->objectId = 0;
+		$this->objectId = '';
 		$this->subject = '';
 		$this->subjectParameters = [];
 		$this->subjectParsed = '';
@@ -164,10 +164,11 @@ class Notification implements INotification {
 
 	/**
 	 * @param string $type
-	 * @param int $id
+	 * @param string $id
 	 * @return $this
 	 * @throws \InvalidArgumentException if the object type or id is invalid
 	 * @since 8.2.0
+	 * @changed 9.0.0 Type of $id changed to string
 	 */
 	public function setObject($type, $id) {
 		if (!is_string($type) || $type === '' || isset($type[64])) {
@@ -175,10 +176,10 @@ class Notification implements INotification {
 		}
 		$this->objectType = $type;
 
-		if (!is_int($id)) {
+		if (!is_int($id) && (!is_string($id) || $id === '' || isset($id[64]))) {
 			throw new \InvalidArgumentException('The given object id is invalid');
 		}
-		$this->objectId = $id;
+		$this->objectId = (string) $id;
 		return $this;
 	}
 
@@ -191,8 +192,9 @@ class Notification implements INotification {
 	}
 
 	/**
-	 * @return int
+	 * @return string
 	 * @since 8.2.0
+	 * @changed 9.0.0 Return type changed to string
 	 */
 	public function getObjectId() {
 		return $this->objectId;
@@ -443,7 +445,7 @@ class Notification implements INotification {
 			&&
 			$this->getObjectType() !== ''
 			&&
-			$this->getObjectId() !== 0
+			$this->getObjectId() !== ''
 		;
 	}
 }
diff --git a/tests/lib/notification/notificationtest.php b/tests/lib/notification/notificationtest.php
index da3ada440e2400611be059b8dae370c231b780ba..91fa1de8b42cb620c431353415ef7aca94d01c19 100644
--- a/tests/lib/notification/notificationtest.php
+++ b/tests/lib/notification/notificationtest.php
@@ -176,22 +176,23 @@ class NotificationTest extends TestCase {
 
 	public function dataSetObject() {
 		return [
-			['a', 1],
-			[str_repeat('a', 64), time()],
+			['a', '21', '21'],
+			[str_repeat('a', 64), 42, '42'],
 		];
 	}
 
 	/**
 	 * @dataProvider dataSetObject
 	 * @param string $type
-	 * @param int $id
+	 * @param int|string $id
+	 * @param string $exptectedId
 	 */
-	public function testSetObject($type, $id) {
+	public function testSetObject($type, $id, $exptectedId) {
 		$this->assertSame('', $this->notification->getObjectType());
-		$this->assertSame(0, $this->notification->getObjectId());
+		$this->assertSame('', $this->notification->getObjectId());
 		$this->assertSame($this->notification, $this->notification->setObject($type, $id));
 		$this->assertSame($type, $this->notification->getObjectType());
-		$this->assertSame($id, $this->notification->getObjectId());
+		$this->assertSame($exptectedId, $this->notification->getObjectId());
 	}
 
 	public function dataSetObjectTypeInvalid() {
@@ -210,7 +211,14 @@ class NotificationTest extends TestCase {
 	}
 
 	public function dataSetObjectIdInvalid() {
-		return $this->dataInvalidInt();
+		return [
+			[true],
+			[false],
+			[''],
+			[str_repeat('a', 64 + 1)],
+			[[]],
+			[[str_repeat('a', 64 + 1)]],
+		];
 	}
 
 	/**
@@ -560,12 +568,12 @@ class NotificationTest extends TestCase {
 
 	public function dataIsValidCommon() {
 		return [
-			['', '', 0, '', 0, false],
-			['app', '', 0, '', 0, false],
-			['app', 'user', 0, '', 0, false],
-			['app', 'user', time(), '', 0, false],
-			['app', 'user', time(), 'type', 0, false],
-			['app', 'user', time(), 'type', 42, true],
+			['', '', 0, '', '', false],
+			['app', '', 0, '', '', false],
+			['app', 'user', 0, '', '', false],
+			['app', 'user', time(), '', '', false],
+			['app', 'user', time(), 'type', '', false],
+			['app', 'user', time(), 'type', '42', true],
 		];
 	}
 
@@ -576,7 +584,7 @@ class NotificationTest extends TestCase {
 	 * @param string $user
 	 * @param int $timestamp
 	 * @param string $objectType
-	 * @param int $objectId
+	 * @param string $objectId
 	 * @param bool $expected
 	 */
 	public function testIsValidCommon($app, $user, $timestamp, $objectType, $objectId, $expected) {