aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

In Pinpoint, I can't associate a user with multiple endpoints #6289

Open stephendmalloy opened 4 years ago

stephendmalloy commented 4 years ago

I want to be able to create multiple endpoints for a single user. For example, I want the ability to be able to send a specific user emails as well as text messages and it doesn't appear that I'm able to do this. I'm only able to associate a user with a ONE channel type using the Analytics.updateEndpoint method.

If I associate the user with a different channel type they are no longer associated with the originally assigned channel type. So, for example, when a user loads my app I update their endpoint with channel type to EMAIL. Then, in a different settings area they have the option to opt in for text message alerts. When I attempt to update the endpoint channel type to SMS they are no longer associated with the EMAIL channel. I've even attempted changing the user id and that doesn't work either. While this does make sense, I didn't see a method to add an endpoint for the user so I assumed changing the channel type would work, but this is not the case.

I would expect that I would be able to associate a single user with multiple endpoints (different channels) so I can send them different messages through different channels using Pinpoint. According to the Pinpoint docs it looks like this is possible but I'm not seeing a way to do this using Amplify.

Am I missing something? Any help or guidance would be greatly appreciated.

amhinson commented 4 years ago

@stephendmalloy I'm looking into this now. Would you also be able to share an example of your current usage of updateEndpoint just for reference? Based on this code, it doesn't appear that you can set channelType to anything other than GCM or APNS, so I'm curious how you're setting it to EMAIL & SMS: https://github.com/aws-amplify/amplify-js/blob/3206a4fa05588674261ba6ac415c0315560ae968/packages/analytics/src/Providers/AWSPinpointProvider.ts#L731-L737

stephendmalloy commented 4 years ago

Sure thing.

I'm simply doing this, and it's working. I'm able to switch the channels via code and they are reflected correctly in Pinpoint. I just can't associate with multiple channels (e.g. add additional endpoints):

Analytics.updateEndpoint({ address: userData.attributes.email, channelType: 'EMAIL', optOut: 'NONE', userId: userData.username, userAttributes: { firstName: [ userFirstName ], lastName: [ userData.attributes.family_name], email: [ userData.attributes.email ], phone: [ userData.attributes.phone_number ] } });

Here is an article that I followed as well on Medium that is doing the same thing: https://medium.com/@jan.hesters/tracking-and-reminders-in-aws-amplify-6406a51738e1

stephendmalloy commented 4 years ago

@amhinson any possible updates on this? Have a great weekend.

amhinson commented 4 years ago

It does appear that this functionality isn't possible at the moment with Amplify, but we will track this as a feature request for future development.

lsale commented 3 years ago

@amhinson has anything changed on this? We are finding it increasingly difficult to use pinpoint in production if we can't have analytics data connected to both an email and a push channel and we want to give customers the ability to choose AND/OR for communications.

paulsjohnson91 commented 3 years ago

Has there been any progress with this? seems like a significant design flaw if this is still the way it works

jacdx commented 3 years ago

Serious design flaw. The amplify libraries seem to make it impossible to be able to maintain multiple endpoints per user. It's possible/designed to work in Pinpoint, nay even the point of Pinpoint (zing), but the JS library is getting in the way. I need to register and update both an email and push endpoints per user in the same app, so that I can message them across channels. I can make both updateEndpoint calls, but inevitably, one of the endpoints will not be associated with the user by the userId I gave it, and therefore not addressable by user. @paulsjohnson91 have you found any workarounds?

hisham commented 2 years ago

+1, I'm just starting to get into using pinpoint via aws-amplify and I'm finding the documentation is very lacking, and from issues like this, the feature set supported seems to be very minimal as well. Would be great if Amplify team can invest more into the pinpoint aws-amplify js lib + documentation.

biller-aivy commented 2 years ago

+1 @hisham any infos to share After 4 months?

hisham commented 2 years ago

Hi @biller-aivy - my application doesn't need this feature yet (multiple endpoint support) so I haven't looked into implementing this capability further.

KevinToala commented 2 years ago

maybe there is an update regarding this ? In our application we are limited to only being able to use email as a channel and we would like to try InApp or SMS messages

cwomack commented 1 year ago

Just wanted to ping anyone following this to say that we are reviewing a solution to permit multiple endpoints to be updated simultaneously and will update this issue with progress.

juandiegoespinosasantos commented 1 year ago

Hi @stephendmalloy and everyone.

Giving a look to the Pinpoint API Documentation it says:

[...] If someone uses your app on multiple devices, or if that person can be messaged at multiple addresses, you can assign the same user ID to multiple endpoints. In this case, Amazon Pinpoint synchronizes user attributes across the endpoints.

From: https://docs.aws.amazon.com/pinpoint/latest/developerguide/audience-define-user.html

So if all of your endpoints share the same User.UserId attribute they will be associated with the same user.

Hope this helps!

ZakariaNaija commented 1 year ago

Any updates @cwomack ? thanks!