-
-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When subscribing to messages via an API using the raw stream, how should the messages be split in order to retrieve the latest ones? #1196
Comments
Here are the actions that worked for me. This will show a pop-up/alert/notification with the
|
Thank you for your explanation. However, when using the method of splitting 'Contents of URL' by 'New Lines,' sometimes when dealing with multi-line text, I encounter an issue where only the last line of the text is extracted, and I haven't been able to solve it. |
When I send multi-line text and read it back in the "raw" stream, it's collapsed onto one line, so it splits fine in the iOS Shortcut. Are you saying it doesn't collapse onto one line for you? |
This issue might be related to my code. When I use a Python script to automatically send clipboard content, I use the following code: def send_clipboard(msg):
requests.post("https://%s" % (URL),
data=msg.encode(encoding='utf-8'),
headers={
"Authorization": TOKEN if TOKEN != "-" else "",
"Title": CLIENTNAME
}) During testing, when sending multi-line text, the iOS Shortcut only receives the last line of text. Thank you for your help. Perhaps I can fix this by modifying the request I’m sending. |
Hmm. I tested your script (using python 3.10). The message printed on two lines in the console and in the web app, but in the "raw" stream, it was collapsed onto one line for me. I was able to grab the whole "test message" in the iOS Shortcut. import requests
URL = 'ntfy.sh/mytopic'
TOKEN = '-'
CLIENTNAME = 'test'
def send_clipboard(msg):
requests.post("https://%s" % (URL),
data=msg.encode(encoding='utf-8'),
headers={
"Authorization": TOKEN if TOKEN != "-" else "",
"Title": CLIENTNAME
})
if __name__ == '__main__':
send_clipboard('test\nmessage')
print('test\nmessage') This printed on two lines in the console and in the web app |
I copied this paragraph at random:
When I send this, iOS Shortcut can only receive the last sentence. |
After reviewing the documentation, I couldn't find any query parameters that allow fetching the latest messages. I want to use iOS Shortcuts to retrieve the latest messages for a specified topic. However, using either /json or /sse, iOS Shortcuts currently can't parse the file content correctly. If I use the raw format, I'm unable to properly split the content. I have also found a similar issue to mine.
How to get the latest message of a topic in JSON format from the API?
Could you consider adding a filter parameter to retrieve the latest message, or advise me on how to correctly parse the messages from the raw format?
The text was updated successfully, but these errors were encountered: