Aws-sdk-android: Using Pinpoint for event-driven user-specific mobile push notifications (eg. "Jane liked your post")

Created on 24 Apr 2018  路  7Comments  路  Source: aws-amplify/aws-sdk-android

To help us solve your problem better, please answer the following list of questions.

  • What service are you using?
    AWS Pinpoint or AWS SNS

  • In what version of SDK are you facing the problem?
    N/A

  • Is the issue limited to Simulators / Actual Devices?
    Both

  • Can your problem be resolved if you bump to a higher version of SDK?
    No

  • Is this problem related to specific Android/OS version?
    No

If you need help with understanding how to implement something in particular then we suggest that you first look into our developer guide. You can also simplify your process of creating an application by using Mobile Hub.

The issue is in regards to the documentation.

Mobilehub and the Android SDK seem to prioritize Pinpoint over SNS for mobile push notifications. However, the Pinpoint documentation is unclear about the very common use-case of pushing a notification to a specific user. For instance, in a photo sharing app, a common notification would be "SomeSpecificUser just liked YourSpecificPost". Is Pinpoint the correct tool for that or does SNS->GCM/FCM/APNS remain the appropriate solution?

It is unclear if the class:
com.amazonaws.services.pinpoint.model.EndpointUser;
represents a specific User or a prototypical user that would be used to select matching users when creating a demographic/campaign.

Pinpoint offers convenient device token + cognito user management, so it would seem to be a preferable approach to SNS.

Feature Request Pinpoint

Most helpful comment

@joebernard yes I did.

Its a 3 step process on my part.

Frontend:

  1. Register the endpoint with the Cognito ID.

Backend:

  1. Given a Cognito ID, find all of the registered endpoints.
  2. Send a message to the specific endpoint.

You don't need a separate database, pinpoint takes care of that. Hope that helps. (And yes I agree, the documents are lacking for specific and widely used cases like these, I feel like it's all over the place).

Also, I am unsure what you mean by token, I think you mean device endpoint?

All 7 comments

Thank you @ajhool for reporting to us. Sorry for the inconvenience caused.

Amazon Pinpoint and Amazon SNS have overlapping feature sets, with Amazon Pinpoint being the recommended service for user engagement scenarios, such as the one you have described. Amazon Pinpoint lets you send messages to end-users in two primary ways, through campaigns and direct sends. Campaigns are valuable when you want to leverage messaging variables, targeting, scheduling, and automation features of Amazon Pinpoint. Direct sends is valuable when you have a one-to-many or transactional use case, where the analytics on the message sends aren鈥檛 as important. More information on Campaigns can be found here and more information on Direct sends can be found here.

Hi @ajhool,

Direct send is a feature request for the Pinpoint service. We're taking this to the Pinpoint team, and will report back on this thread if there are any updates.

@ajhool The event based trigger feature has been released: https://aws.amazon.com/blogs/messaging-and-targeting/event-based-campaigns-let-you-automatically-send-messages-to-your-customer-when-they-perform-certain-actions/

Event-based campaigns help you send messages that are timely, personalized, and relevant to your customers, which ultimately increases their trust in your brand and gives them a reason to return.

When you use the campaign wizard in the Amazon Pinpoint console, you now have the option to create event-based campaigns. Rather than define a time to send your message to customers, you select specific events, attributes, and metric values.

To report events from your Android application, you can use the following guide: https://aws-amplify.github.io/docs/android/analytics

@kvasukib How would one go about sending a single notification to an endpoint by using the person's Cognito id? I know that you can add pinpoint with Cognito via the docs here.

Once in code, I can only subscribe to the user's email as a channel type. My goal is to send push notifications to a user based on their cognito id. Can you please give me some insight as to how I can approach this problem? Or would SNS be better suited for something like this?

I am using iOS right now. If need be, I can also open this another issue if you like. Thanks

@returnzer0 Were you able to figure out how to send a push notification to a Cognito user? Right now I'm storing the device token and Cognito ID (sub) in a database, then looking up the token when I send the push.

The documentation around this is lacking and none of the responses in the thread answer how to do this.

@joebernard yes I did.

Its a 3 step process on my part.

Frontend:

  1. Register the endpoint with the Cognito ID.

Backend:

  1. Given a Cognito ID, find all of the registered endpoints.
  2. Send a message to the specific endpoint.

You don't need a separate database, pinpoint takes care of that. Hope that helps. (And yes I agree, the documents are lacking for specific and widely used cases like these, I feel like it's all over the place).

Also, I am unsure what you mean by token, I think you mean device endpoint?

Is there a way to schedule notification to single user/single endpoint? Currently what I'm aware is that we need to create campaigns to schedule notifications in future. If there's a way to schedule notifications (say send a push notification to user after 1 hour from now reminding him to check the app again etc) to single user - pinpoint would have been very helpful. At present, we are scheduling this through lambdas which is very costly (as the user base increases many lambdas need to trigger at different times to send notifications to individual users)

Was this page helpful?
0 / 5 - 0 ratings