[AC-222] ACS / Arrow Push - push to multiple channels, delimited by a comma does not seem to work as per docs
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Needs more info |
Resolution Date | 2015-12-08T09:39:22.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Arrow Push |
Labels | acs, docs, push, pushnotification |
Reporter | Andy Gaskell |
Assignee | Mostafizur Rahman |
Created | 2015-07-12T21:08:18.000+0000 |
Updated | 2015-12-08T09:39:22.000+0000 |
Description
See https://community.appcelerator.com/topic/2563/acs-arrow-push-push-to-multiple-channels-delimited-by-a-comma-does-not-seem-to-work-as-per-docs for background and full notes.
From that post...
I'm trying to push notifications to multiple channels, we should be able to just pass multiple channels into the Appcelerator Push API.
The docs state channel can be a single word, a comma delimited list or an array. So either the docs are wrong/not clear, or the API doesn't work as described.
Appcelerator docs at...
http://docs.appcelerator.com/arrowdb/latest/#!/api/PushNotifications-method-notify
...it says...
channel : String/String[] required
Name of the channel. For multiple channels, either comma-separate the list of channels or use an array of strings.
The name of the push channel cannot start with a hash symbol ('#') or contain a comma (',').
The two commands to send a push from linux/osx terminal (with curl)...
log-in...
curl -b cookies.txt -c cookies.txt -F "login=MYUSERNAME" -F "password=MYPASSWORD" https://api.cloud.appcelerator.com/v1/users/login.json?key=MYAPIKEY&pretty_json=true
send push...
curl -b cookies.txt -c cookies.txt -F "channel=year3" -F "to_ids=everyone" -F "payload=test" https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=MYAPIKEY&pretty_json=true
...and that works fine.
We should just be able to modify the second one to push to multiple channels, like...
curl -b cookies.txt -c cookies.txt -F "channel=year3,year4" -F "to_ids=everyone" -F "payload=test" https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=MYAPIKEY&pretty_json=true
...but that does not work, we get a...
"code":400,"status":"fail","message":"Subscription not found","method_name":"Notify"
Any ideas? Am I doing something wrong, misunderstanding the docs, or have I found a bug?
Thanks
Andy
Hello [~AndyG], Before sending push to the multiple channels, you have to subscribers those channels did you do that? And could you please share your test code and steps to reproduce? Thanks.
Hi Motiur Thanks for the comment. I tested the channels independently, and they worked fine, so devices are subscribed ok. So...
curl -b cookies.txt -c cookies.txt -F "channel=year3" -F "to_ids=everyone" -F "payload=test" https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=MYAPIKEY&pretty_json=true
...and...curl -b cookies.txt -c cookies.txt -F "channel=year4" -F "to_ids=everyone" -F "payload=test" https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=MYAPIKEY&pretty_json=true
...both work and come through to the devices. So I think that verifies the channels are working and devices are subscribed ok. In terms of test code, it is all in PHP, however, to abstracted it, and to simplify reproduction, I adapted it into single lines you could use on a curl enabled shell. So you can reproduce this with two lines pasted from the above post onto a linux/osx terminal. So just log-in using...curl -b cookies.txt -c cookies.txt -F "login=MYUSERNAME" -F "password=MYPASSWORD" https://api.cloud.appcelerator.com/v1/users/login.json?key=MYAPIKEY&pretty_json=true
And send to two channels using...curl -b cookies.txt -c cookies.txt -F "channel=year3,year4" -F "to_ids=everyone" -F "payload=test" https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=MYAPIKEY&pretty_json=true
You will have to edit the MYUSERNAME, MYPASSWORD and MYAPIKEY values, and also set up channels with these names in your environment, aside from those elements it should be quite simple to reproduce and validate. Thanks AndyHello [~AndyG], Thanks for your comment. Could you please share your PHP code which you used to subscribe your device and push to a channel with steps and testing environment. Thanks.
Hi Motiur I could share my code and environment, but I think that would only add unnecessary complexity to this thread. It is easiest / simplest to recreate the issue is with those two curl commands on the terminal. By doing it that way you remove all external factors. I would demo this in a screen-grab video, but it would contain our username, password and API key, so that rules out that option. Thanks Andy
Hello [~AndyG], Is it still an issue in latest environment (cloud: 3.2.9 & Cloud Push:3.4.0, Ti SDK:5.1.1.GA, 5.1.0.GA) ? Please let us know. Thanks.