Closed hozdemir closed 2 years ago
Replace 21465
with '21465'
- the data payload of an FCM message allows strings only.
Yep this is correct ^ Meant to comment when I found the a fix last night. It must be a string.
I was trying to send an array down, the data object has to be key->val strings only.
I'm trying to send data as follows in sendFcm method;
return FcmMessage::create() ->setData(['type' => 'xxx', 'id' => 21465]) ->setNotification(\NotificationChannels\Fcm\Resources\Notification::create() ->setTitle('a title') ->setBody('a body') ) ->setAndroid(AndroidConfig::create() ->setFcmOptions(AndroidFcmOptions::create()->setAnalyticsLabel('analytics')) ->setNotification(AndroidNotification::create()->setColor('#0A0A0A')) ) ->setApns(ApnsConfig::create()->setFcmOptions(ApnsFcmOptions::create()->setAnalyticsLabel('analytics_ios')));
but causing an error;
ERROR: Invalid value at 'message.data[1].value' (TYPE_STRING), 21465 {"exception":"[object] (NotificationChannels\\Fcm\\Exceptions\\CouldNotSendNotification(code: 0): Invalid value at 'message.data[1].value'
how can it be solved?