cojohn / node-urban-airship

Simple wrapper for the Urban Airship API in Node.js.
MIT License
36 stars 15 forks source link

Have you started any work to update this to work with v3 of Urban Airship API? #7

Closed crifkin closed 10 years ago

crifkin commented 11 years ago

We might be willing/able to help with this process.

cojohn commented 11 years ago

I haven't; wasn't aware v3 was in the wild. I'll check out the documentation (saving link below for later).

http://docs.urbanairship.com/reference/api/v3/intro.html

crifkin commented 11 years ago

Ok, great. We're moving pretty quickly on a project that we're trying to get out in the next couple of weeks, so not sure what your timeline of looking at this and/or what your interest in collaborating on this would be. I also have to check with the powers that be RE us open sourcing our efforts, but certainly hoping to give back to the community on this.

On Aug 14, 2013, at 11:42 AM, Christopher John notifications@github.com wrote:

I haven't; wasn't aware v3 was in the wild. I'll check out the documentation (saving link below for later).

http://docs.urbanairship.com/reference/api/v3/intro.html

— Reply to this email directly or view it on GitHub.

crifkin commented 11 years ago

FYI I just tested the codebase as it currently stands with the V3 API and it works fine-- only change needed is to the docs for the payload.

Note: this is different from what they show in their push documentation-- http://docs.urbanairship.com/reference/api/v3/push.html#audience-selection I tested with that payload and it didn't work, but with the example below, it did

var payload = { "aps" : { "alert" : "Here is my interesting alert" }, "device_tokens": [ "DEVICE_TOKEN1", "DEVICE_TOKEN2" ] }

I haven't tested registering/removing devices through the module since it doesn't match my use case.

On Aug 14, 2013, at 12:12 PM, Craig McEldowney craig@crifkin.com wrote:

Ok, great. We're moving pretty quickly on a project that we're trying to get out in the next couple of weeks, so not sure what your timeline of looking at this and/or what your interest in collaborating on this would be. I also have to check with the powers that be RE us open sourcing our efforts, but certainly hoping to give back to the community on this.

On Aug 14, 2013, at 11:42 AM, Christopher John notifications@github.com wrote:

I haven't; wasn't aware v3 was in the wild. I'll check out the documentation (saving link below for later).

http://docs.urbanairship.com/reference/api/v3/intro.html

— Reply to this email directly or view it on GitHub.

hanishabsigh commented 10 years ago

Hey @cojohn , thanks for the awesome library. I just want to note that I started using this library but had to modify it slightly to work with the Urban Airship V3 API. The reason @crifkin is seeing that the V3 payloads don't work is that the API actually falls back to the V2 payloads unless a special header is specified. So currently this project is using the V2 API. I added the following header to work with the V3 API:

"Accept": "application/vnd.urbanairship+json; version=3;"

I didn't add this as a pull request because I know some people may want to have backwards compatibility with the V2 API but I wasn't sure how to implement that. Maybe some sort of option when initializing the library could be added.

Thanks - Hani Shabsigh @ApalapA

cojohn commented 10 years ago

@ApalapA If you include the v3 header and submit a pull request I'll be happy to merge it on a higher major version. With that solution, users who need to maintain v2 support can hardcode the current version into their package.json file. Alternatively, you could set default a v3 flag to false in the constructor and include the header when the implementing code has set the flag to true. More cumbersome, but we can always change the default value of the flag to true in later releases.