Back
Creating Push Notification Results in Failed Status "No valid recipients found."
- 0
- Functions
- Messaging
- Cloud

When creating a push notification using the Python API, I get this error for the status of my message. I call it using basically this:
TypeScript
def main(context):
context.log("request body: " + context.req.body)
request = json.loads(context.req.body)
topic_id = request.get("topicId")
user_ids = request.get("userIds", None) # <- userIds is empty and returns None for this case
title = request.get("title", "")
body = request.get("body", "")
context.log("sending notification")
context.log(database.sendNotification(topic_id, title, body, user_ids))
context.log("notification sent")
def sendNotification(
self, topic_id: str, title: str, body: str, user_ids: list[str]
):
self._messaging.create_push(
ID.unique(), title, body, topics=list(topic_id), users=user_ids
)
This is what is logged:
TypeScript
request body: {"command":"send","topicId":"681e9678000e99a6b811","title":"New message from ...","body":"message"}
sending notification
None
notification sent
The image of the topic that I'm trying to push to is attached. As you can see the id's match.
I also attached the Message on the cloud.
Any help is appreciated!
TL;DR
Issue: When attempting to create a push notification using the Python API, the status returns "No valid recipients found."
Solution: The error is likely due to the 'userIds' variable being empty and returning 'None'. Ensure that 'userIds' is populated with valid user IDs before calling 'sendNotification'.Recommended threads
- Custom document types in Swift
How would I create a protocol to conform to Models.Document?
- "The document data is missing. Try again...
Hello, I am getting this error suddenly. I have been using this service for a year now, and I haven't made any changes to my code since then. My app was workin...
- Error: The document data is missing. Try...
I am not able to create any document on some of the collection/ DBs. As I can see many of us facing the same issue, need a quick resolution from the Appwrite Te...
