Open Can't set URL from Node RED

Discussion in 'Join' started by RichardU, Feb 18, 2019.

  1. RichardU

    RichardU Member

    Joined:
    Apr 10, 2015
    Messages:
    37
    Likes Received:
    1
    I'm pushing notifications from Node RED. The icon works, but the sound does not. They are in the same folder. Android 9.0.4 Any ideas?

    msg.push = {
    "deviceId": "xxx",
    "title": "Test",
    "text": "Testing",
    "icon": "/sdcard/Ringtones/testicon.png",
    "sound": "/sdcard/Ringtones/testsound.mp3",
    };
    return msg;
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    8,488
    Likes Received:
    720
    What version of Join are you using? If it's the beta, try setting a category too so that it creates a new notification category for that notification.
     
  3. RichardU

    RichardU Member

    Joined:
    Apr 10, 2015
    Messages:
    37
    Likes Received:
    1
    Category worked. Thanks. :)
     
  4. nisseDILLIGAF

    nisseDILLIGAF New Member

    Joined:
    Oct 15, 2018
    Messages:
    1
    Likes Received:
    0
    @joaomgcd
    Hi, sorry to hijack this thread, but I'm having similar problem..
    I'm using the Join api to send notifications with custom sounds... sound is not working anymore.. (2-5 weeks?)
    If I send to group.all, my other phone (Android 6.0.1) and tablet (Android 7.1) play the sound, but not my android 9 phone. (just default sound)
    All using Join v.2.1.0-beta3
    Is Category part of the API or just a node Red thing?
    Just now saw the New release post, what should I write?
    &category=Pushed%20Notification ??

    Edit:
    Its working now :)

    category=something
     
    Last edited: Mar 22, 2019
  5. knaks

    knaks New Member

    Joined:
    Feb 21, 2019
    Messages:
    1
    Likes Received:
    0
    Hi joaomgcd

    I also have custom notifications working by setting the Category. However, It does not work if I also set the URL. Is this by design, or a bug? Ideally, I would like a custom notification and also be able to set a URL to click on.

    Also, the custom notification doesn't work in Chrome. Is this a Chrome limitation?

    Best regards.
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    8,488
    Likes Received:
    720
    Hhmm, setting a URL shouldn't change it. Can you give me an example of that?

    What about the custom notification is not working in Chrome exactly? Thanks
     
  7. RichardU

    RichardU Member

    Joined:
    Apr 10, 2015
    Messages:
    37
    Likes Received:
    1
    As of right now, I can't change sounds. This works in Node Red:
    Code (Text):
    msg.devices = "My Phone";
    msg.title = "Alert";
    msg.text  = "Driveway";
    msg.icon = "/storage/emulated/0/ringtones/red-car-48.png";
    msg.url = "https://mydomain.com";
    msg.push = {
    "sound": "/storage/emulated/0/ringtones/duck.mp3",
    "category": "Alert Driveway",
    };
    return msg;
    But this just gives me the same sound.
    Code (Text):
    msg.devices = "My Phone";
    msg.title = "Alarm";
    msg.text  = "On";
    msg.icon = "/storage/emulated/0/ringtones/red-car-48.png";
    msg.url = "https://mydomain.com";
    msg.push = {
    "sound": "/storage/emulated/0/ringtones/goose.mp3",
    "category": "Alarm On",
    };
    return msg;
    Also, I've tried to use the Join API and I can't get any sound to work. Probably because I don't know what to put in the Sound URI field. None of these have worked:
    Code (Text):
    android.resource://storage/emulated/0/ringtones/locked-on.mp3
    file:///storage/emulated/0/ringtones/locked-on.mp3
    storage/emulated/0/ringtones/locked-on.mp3
    What is the proper format for the Sound URI field?
     
  8. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    8,488
    Likes Received:
    720
    Thanks. But do those 2 notifications show up in different notification categories on your phone?
    Also, does the first one play the correct sound?
    Also, can you not select the correct sound for them in Android settings?
     
  9. RichardU

    RichardU Member

    Joined:
    Apr 10, 2015
    Messages:
    37
    Likes Received:
    1
    The first does play the correct sound.

    Under Apps & Notifications / Join / Notifications: The first item (Alert Driveway) is not shown. The second item (Alarm On) is shown, and under sound it shows the correct file name, but at the bottom it says: ! Default Notification channel. (and the correct sound does not play).

    How (where) would I select the correct sound in Android settings?
     
  10. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    8,488
    Likes Received:
    720
    Just to be sure, can you please try creating the notification via Join API (add a category property to the URL manually. need to update the website). Does that make it create the category correctly in the Android Settings?
     
  11. RichardU

    RichardU Member

    Joined:
    Apr 10, 2015
    Messages:
    37
    Likes Received:
    1
    How do I specify a URI in the Join API? My file is at: "/storage/emulated/0/ringtones/locked-off.mp3" What exactly do I enter into the Sound URI field?

    Also, I'm still confused by what you meant with "can you not select the correct sound for them in Android settings?" Where would I do that?
     
  12. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    8,488
    Likes Received:
    720
    You should set it to just that. I think it should work. Or try "file:///storage/emulated/0/ringtones/locked-off.mp3" if it doesn't work.
    About doing it in Settings, try Android Settings > Apps > Join > Notifications and edit the categories you want :)
     
  13. RichardU

    RichardU Member

    Joined:
    Apr 10, 2015
    Messages:
    37
    Likes Received:
    1
    Maybe you've already updated because Notification Category is already an option.

    I did some research. It seems in Android 8+ every notification requires a Channel (which Join calls Category). Once a Category is created, the sound for that Category is specified in Settings / Apps & notifications / Join / Notifications / (choose the Category).

    If I specify a Sound URI in the API for an existing Category, the results are unstable (including an error that I emailed to you). Perhaps you should specify in the API that Sound URI should only be used when creating a new Category (at least for Android 8+).

    Understanding the above, I am able to use the API to trigger Notifications with the proper category. However, I haven't figured out how to do so in NodeRED. None of the following work
    msg.channel = "Alarm Armed";
    msg.category = "Alarm Armed";
    msg.push = {"category": "Alarm Armed"};
    msg.push = {"channel": "Alarm Armed"};

    What should I try for Node RED?
    Also, my app now has a bunch of test categories. Could you please add to the API the ability to remove a Category?
     
  14. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    8,488
    Likes Received:
    720
    Yes, you are totally correct about categories.
    But about Node-RED I was able to get it working with something like:
    Code (Text):
    msg.push = {
        "text":"finding device...",
        "title":"Standing here",
        "category":"Nice One"
    }
    return msg;
    Does that not work for you?
     
  15. RichardU

    RichardU Member

    Joined:
    Apr 10, 2015
    Messages:
    37
    Likes Received:
    1
    I figured it out. The sound will not play if I specify a msg.url e.g. it stops if I uncomment either line below. Is there another way to include the URL?

    Also, any way to delete unneeded Categories?

    Code (Text):
    msg.devices = "My Phone";
    // msg.url = "https://mydomain.org/";
    msg.push = {
        "icon":"/storage/emulated/0/ringtones/alarm-bell-48.png",
    //    "url": "https://mydomain.org/",
        "text":"This is text",
        "title":"This is title",
        "category":"Alarm Armed"
    }
    return msg;
     
     
  16. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    8,488
    Likes Received:
    720
    Unfortunately there's no way to delete categories right now, sorry!
    About the URL, can you check if it uses a different category when you do that (by long clicking the notification)? Thanks again
     
  17. Stephan Hackett

    Stephan Hackett New Member

    Joined:
    Jun 4, 2019
    Messages:
    1
    Likes Received:
    0
    I just checked this myself and it uses the "URLs" category.
    Having the url set breaks setting any custom categories. I joined the forum to mention that I could not get my custom categories set using NodeRed and found this thread. Removing the msg.push.url setting resolved the problem. Is there a reason that urls need their own special category?
     
    Last edited: Jun 4, 2019
: NodeRed, API

Share This Page