Hello, I’ve created a Python utility by extending the pydiscourse client to send private massages
def send_private_message(self, content_html, title, target_usernames): """ Send a private message as the API user which this instance is created with """ if type(target_usernames) is list: target_usernames = ",".join(target_usernames) return self.create_post(content_html, title=title, target_usernames=target_usernames, archetype="private_message")
I’m using this utility from a script with some external recipient list to send group messages. However, the recipient list is not always kept up-to-date and some users may be missing.
So I tried to message like 100 users and got a 422 error with the message:
One of the users you are sending this message to could not be found discourse
This is not helpful when trying to find who was the “offending” username(s). Is there a way to get a more verbose error or is there a way to find out who is that user before making this call? Obviously I can query one-by-one before sending, but this is a huge performance hit especially for long lists.