Back

Can't get Payload from Message

  • 1
  • Android
  • Messaging
  • Cloud
retr122
11 May, 2024, 06:17

Hi. I'm creating my android app and trying to receive Firebase Message from my Appwrite Cloud Function. When I send message from Console (not using the code), i can receive payload. But when i send it using Python Server SDK, i receive empty payload. Is this error? This is part of my code (I don't receiving any errors) ``` newMessageData = {} newMessageData['chatCollectionId'] = new_collection_id newMessageData['userName1'] = user_1_name newMessageData['userName2'] = user_2_name newMessageData['userId1'] = chatId1 newMessageData['userId2'] = chatId2 #newMessageData['userPhoto1'] = user_1_photo #newMessageData['userPhoto2'] = user_2_photo

TypeScript
result = messaging.create_push(
message_id = ID.unique(),
title = 'New Meetsee Match!',
body = 'Your new match is here!',
topics = [], 
users = [document_1_userId, document_2_userId], # optional
targets = [], # optional
data = newMessageData
)```
TL;DR
Developers are having trouble receiving payload from the message they are sending through the Python Server SDK in their Android app. They are able to receive payload when sending messages from the console but not using the code. They suspect the issue might be related to the newMessageData object. To troubleshoot, developers are advised to log new message data before calling create and also log the result.
Steven
11 May, 2024, 06:20

So the title and body are okay? But the data isn't passing through?

retr122
11 May, 2024, 06:20

Yes

Steven
11 May, 2024, 06:26

Can you try logging new message data before calling create and also log the result?

retr122
11 May, 2024, 06:27

Ok

retr122
11 May, 2024, 06:32

{'chatCollectionId': '663f1088000486bfaf0e', 'userName1': 'Monica', 'userName2': 'Ryan', 'userId1': '66094e5a0c05c6251136', 'userId2': '662d14a5003243c80cb0'} I tried again with print(str(newMessageData)) and finally received payload. I'll try adding some new values in newMessageData and respond later, if there's any errors again

retr122
11 May, 2024, 06:52

It's finally working! Thank you! I think error was around newMessageData object (maybe his existance).

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more