Skip to content
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

Group Key not working #3

Open
blehke opened this issue Feb 9, 2023 · 6 comments
Open

Group Key not working #3

blehke opened this issue Feb 9, 2023 · 6 comments

Comments

@blehke
Copy link

blehke commented Feb 9, 2023

Stumbled across this the other day and love the potential... worked perfectly for me, fell on my face when I tried to deploy it!

When setting up the Ignition > Notification, I put my own User Key - everything worked fine.
I also have the User Keys setup under Security > Users, Roles > Contact Info, although I'm not sure where these are used...

I then replaced my User Key with a Group Key. When I trigger the notification again, I got: Error sending notification: status code=400, response=Bad Request

Both of the above scenarios work via Postman.

Would be great if you could see the POST request in the Logs when in "Log Only" mode for troubleshooting.

@traviscox
Copy link
Collaborator

The module is always submitting the following parameters in the POST:

  • token
  • user (user or group key)
  • message
  • device
  • sound
  • priority

When using a group key, the API expects to only have a single device in the JSON message. That means, you can only have one contact in the roster with the proper device name. Their documentation states this:

When sending to delivery groups not belonging to a Pushover for Teams organization, or specifying multiple users in a single request, the device parameter will be ignored. Group users will have their specific device honored according to how they are entered in the group.

When sending to a single Team-owned group, the device name is honored, and will restrict sending the message to just the team member devices matching the name in the group. If no devices match, the message will not be broadcast to any users and the API will return a failure status.

My guess is you are sending to a single Team-owned group so the device is not ignored. Probably, just need to get the device correct (which is on the Security > Users, Roles > Contact Info. I would just create a contact for the Team.

In the meantime, I can certainly add some more logging to the module. Let me know.

@blehke
Copy link
Author

blehke commented Feb 13, 2023

I am attempting to use a Team Group. I guess I'm just confused as to what is supposed to go where - particularly because I don't want to use devices - I only want to use the Group.

@traviscox
Copy link
Collaborator

Can you post an example of the HTTP POST that works in Postman?

@blehke
Copy link
Author

blehke commented Feb 28, 2023

Thought I sent this... opened Postman and it was still showing like this!

Anyway:
https://api.pushover.net/1/messages.json?token=apiKey&user=userKey&message=Message Goes Here&title=Title Goes Here&priority=0

apiKey is from a team-owned Application
userKey is actually from a Group Key

@traviscox
Copy link
Collaborator

Yeah in your example you didn't specify device as a parameter. The module is forcing the parameter right now. What happens if you add that into Postman and leave the value blank?

@blehke
Copy link
Author

blehke commented Mar 2, 2023

I'm actually surprised - I expected this to fail, but it didn't

https://api.pushover.net/1/messages.json?token=apiKey&user=groupKey&message=Message Goes Here&title=Title Goes Here&priority=0&device

It still works with the "=" and no value:
https://api.pushover.net/1/messages.json?token=apiKey&user=groupKey&message=Message Goes Here&title=Title Goes Here&priority=0&device=

In an effort to break it... this did not work:
https://api.pushover.net/1/messages.json?token=apiKey&user=groupKey&message=Message Goes Here&title=Title Goes Here&priority=0&device=completelyRandom

Testing some more... when I used a user key, this worked. With a group key it did not. Personally, I'd call this a bug on their end.
https://api.pushover.net/1/messages.json?token=apiKey&user=userKey&message=Message Goes Here&title=Title Goes Here&priority=0&device=null

It appears that "device" is acting like a filter for a group? I have a group with myself and one other user. My device name is "iPhone", his is "galaxys22". With the same api and group key, I can send to only one device or the other by specifying the device name. If I put an invalid device name (including null!), it fails.

Would be nice to have the option to use a Group Key on the setup page or make use of the User Keys and Device Names on the user setup. Personally, I don't think I would ever use that - if someone gets a new phone, or wants to get notifications on their computer, I don't want to have to change the user setup.

Maybe you could do this: on the Notifcation Profile page - API Token is always required. Then ask for the User Key type - either User or Group. If it's a Group, you can enter the Group Key, and any time that profile is used, there is one API call to Pushover. If they pick User, then I think you also need to change the User Contact - that would require a User Key and optionally a Device ID, and when that profile is called, I think it would be an API call for each user.

A co-worker pointed out your new API module. I haven't looked at it yet, but wondering if that may be a better fit for my use case.

Let me know if there's anything I can do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants