Fix #952 and #948 by encoding metadata for notifications

Fix #952 and #948 by encoding metadata for notifications in different ways