blockmason / lndr

Lending on the Blockchain
https://lndr.io/
9 stars 6 forks source link

Send push notification when transaction is pending #66

Closed willbach closed 6 years ago

aupiff commented 6 years ago

To do this, I assume all I need to do is send something like the following payload to UA's POST https://go.urbanairship.com/api/push endpoint. @TheAznShumai, do I have this right?

{
    "audience": {
        "android_channel": "31279004-103e-4ba8-b4bf-65eb3eb81859"
    },
   "notification": {
      "alert": "new pending credit from {friend name}",
      "actions": {
          "app_defined": { "LNDR_ACTIONS" : ["NEW_PENDING"] }
       }
   },
   "device_types" : "all"
}
TheAznShumai commented 6 years ago

you may need to specify the device type and the channel key depending on the platform, but this is correct.

ghost commented 6 years ago

Are we currently storing device type and channel on the server? Just want to get this cleaned up quickly.

On Wed, Dec 20, 2017 at 7:54 AM, Johnny Loi notifications@github.com wrote:

you may need to specify the device type and the channel depending on the platform, but this is correct.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blockmason/lndr/issues/66#issuecomment-353101504, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGDc0960wVtjgNDNo7BVFdXFeS26FYcks5tCS2mgaJpZM4RCYPp .

aupiff commented 6 years ago

@timgalebach there are "platform" and "channelID" fields associated with a LNDR address that are set using the /register_push endpoint.

aupiff commented 6 years ago

@TheAznShumai FYI, I'm limiting platform values to "ios" and "android".

ghost commented 6 years ago

Unacceptable. The TimPhone 2000 is right around the corner.

On Dec 20, 2017 1:52 PM, "Roy Blankman" notifications@github.com wrote:

@TheAznShumai https://github.com/theaznshumai FYI, I'm limiting platform values to "ios" and "android".

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/blockmason/lndr/issues/66#issuecomment-353150394, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGDc7Y_Y5oTLqyToGycPFtE4sJxyzEGks5tCVdlgaJpZM4RCYPp .

aupiff commented 6 years ago

@TheAznShumai looks like we also need to include application key and master secret in our requests to urban airship for http basic authentication. How do you want to get those to me?

aupiff commented 6 years ago

If there's an urban airship account for blockmason, please share the account credentials with me. This is probably the easiest way.

ghost commented 6 years ago

shared

On Dec 20, 2017 2:29 PM, "Roy Blankman" notifications@github.com wrote:

If there's an urban airship account for blockmason, please share the accounts credentials with me. This is probably the easiest way.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/blockmason/lndr/issues/66#issuecomment-353158828, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGDc_wwZipIHcj6PzL7SVmauWSfYLDyks5tCV71gaJpZM4RCYPp .

aupiff commented 6 years ago

Ok, I have a PR out with rough version of push notifications implemented. I still need to test what I have so far. @TheAznShumai does the mobile application currently hit the server's /register_push endpoint? I assume this would happen when an account is created. Can we can get that functionality into a new release of the iPhone and Android app?

(We'll probably have to support multiple devices per user. I mentioned this in another comment somewhere a few days ago. We should put off implementing this until basic notifications are working but let's keep it in the back of our heads.)

aupiff commented 6 years ago

I've updated the production server. For users with a channelID & platform associated with their account, the server will attempt to hit the urban airship /push endpoint whenever a new pending record is created or a pending record is confirmed.

ghost commented 6 years ago

Do we want to do it for cancelled records too?

On Wed, Dec 20, 2017 at 7:04 PM, Roy Blankman notifications@github.com wrote:

I've updated the production server. For users with a channelID & platform associated with their account, the server will attempt to hit the urban airship /push endpoint whenever a new pending record is created or a pending record is confirmed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/blockmason/lndr/issues/66#issuecomment-353245824, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGDc2mI2yd3jPO2HZeF4mYsbyXyE68bks5tCcqygaJpZM4RCYPp .

aupiff commented 6 years ago

Yeah we do, I'm going to add that in an upcoming PR. The /reject endpoint is one I wanted to refactor so I put it off.

aupiff commented 6 years ago

code has been tested and is currently live on production server.