Iterable / react-native-sdk

MIT License
36 stars 32 forks source link

SDK is unable to create new users #125

Closed jehartzog closed 5 months ago

jehartzog commented 3 years ago

The was first brought up in another issue here, but we recently saw the same behavior. We never noticed in our previous app as we had a legacy integration where the API created the users in Iterable for the client on signup.

Expected

Actual

Versions

roninopf commented 3 years ago

Thanks for writing in @jehartzog! Your detailed reports are much appreciated for sure.

I'm not sure how clear it is in the documentation (literally, I haven't searched for this specific info in there, before), but setUserId and setEmail ARE NOT supposed to create a new user; they aren't API calls like trackEvent or registerDeviceToken, which are API calls and do create profiles for new users.

What I'm curious is why trackEvent would be failing here, I'd love to see what's going on in the logs (or similar, like a code snippet) when that's happening. EDIT: Also, feel free to file a ticket with your CSM for this, since we potentially would discuss sensitive info.

We've definitely received multiple tickets specifically around setUserId/setEmail, so, clarifying how that works has been of discussion, for sure. Please feel free to pass along any suggestions in that regard, too!

jehartzog commented 3 years ago

@roninopf Thanks for the quick response.

This report was shorter than most as it's not really a bug, nor is it blocking us. We plan to use the more powerful API integration for our core customer logic, to link pre-signup/post-signup users, etc.

I was moving forward on adding this lib primarily for push integration, and wanted to test out pushes before we had finished our API work, and found that I basically couldn't get anything working by just using this library.

To answer you question about what I saw, here is the code I'm using:


  setup = async () => {
    const iterableConfig = new IterableConfig();

    await Iterable.initialize(this.#config.ITERABLE_MOBILE_KEY, iterableConfig);

    // Iterable.setUserId(`${id}`) is called after above code, but before the bottom timeout, once userId has been restored from AsyncStorage
    setTimeout(() => {
      Iterable.trackEvent('test', {});
    }, 5000);
}

As you can see, pretty minimal repro example of using the SDK :).

Here is what I'm seeing:

api.iterable.com/api/inApp/getMessages - 200
api.iterable.com/api/events/track - 400:
{
  "msg": "No user exists with userId 101",
  "code": "BadParams",
  "params": null
}

I just don't fully understand the steps I need to take in order to successfully create a user via this SDK only. I also did a full re-read of all the docs when setting up a new client app, and I've fully integrated this SDK before. I'll be honest, I didn't troubleshoot extensively, and I don't actually need assist here, as I know if I'm patient we will finish our API work which will do all that for us.

I'm bringing this up since I expect consumers of this library may expect it to function as a standalone integration, and I'm not sure the docs and/or functionality is there with regard to user creation/management. Feel free to close this though, as we're not actually blocked by anything at this time.

dwrz commented 3 years ago

We've run into this issue today.

https://support.iterable.com/hc/en-us/articles/360045714132-Installing-Iterable-s-React-Native-SDK-

States the following:

At some point in your app's React Native code, call Iterable.setEmail, passing in a test email address that does not yet exist in your Iterable project. For example:

Iterable.setEmail("docs@iterable.com");

2. Run the app until it calls setEmail, which creates an Iterable user profile.

. . . 

3. To verify that Iterable now has a user profile for the new email address, navigate to Audience > Contact Lookup and search it.

We are seeing the console log from setEmail, but the contact lookup is unable to find a user with the email address we are using.

Is the expectation that some other call is made to create a user? If so, which one?

trungls1706 commented 3 years ago

Hi all I have same issue I seeing the console log from setEmail, but user profile not found in Iterable

"@iterable/react-native-sdk": "^1.1.1", "react-native": "^0.64.1",

yarikpwnzer commented 3 years ago

We want to use Iterable SDK only for in-App-messages + Push Notifications. I spent all day with profile creation issue, because from documentation it says: 7.2 Run the app until it calls setEmail, which creates an Iterable user profile. And actually it doesn't work. Now from comment I see that I need to make event for creating user profile. Issue was open from April 8 and still its opened + documentation is wrong. Pretty nice developers support You have here...

migue1s commented 3 years ago

It worked for me when I did:

import { IterableConfig } from '@iterable/react-native-sdk';

const config = new IterableConfig();

// This line is `false` on their sample, setting it to `true` fixed this for me.
config.autoPushRegistration = true;

Iterable.initialize('<YOUR_API_KEY>', config);
nicolas6422 commented 2 years ago

@yarikpwnzer I'm running into this issue as well. Can you explain what you mean

Now from comment I see that I need to make event for creating user profile

The solution is to make an event?

@jehartzog Sounds like the mobile sdks is not capable of user creation anymore?

yarikpwnzer commented 2 years ago

@yarikpwnzer I'm running into this issue as well. Can you explain what you mean

Now from comment I see that I need to make event for creating user profile

The solution is to make an event?

@jehartzog Sounds like the mobile sdks is not capable of user creation anymore?

I was referred to @roninopf comment

vbabenkoru commented 2 years ago

A user is created when a push token is registered. By default, automatic push registration is enabled, and that creates the user. If automatic push registration is disabled, you need to add a call to registerForPush() or updateUser for the user profile to be created.

nicolas6422 commented 2 years ago

@vbabenkoru good to know. So assuming that happens automatically and I initialize the sdk and call Iterable.setEmail(...), I should be able to search that user email at https://app.iterable.com/users/lookup

Once I set the user email I can call Iterable.getEmail() and that does return the correct email address, however, when I try to search them online I always get an error "User does not exist: ..."

Does this indicate that automatic push registration is somehow how not working as I expected and I should do it manually?

Edit: we've discovered that this only affects iOS devices

param-finder commented 2 years ago

I'm facing the same issue. I've followed the steps, I'm getting the logging of successful userId being set. Yet, when I try to lookup the userId, it shows 0 results on dashboard. What's wrong with this SDK! Same luck with setEmailId too. @tapashmajumder @roninopf

Screenshot 2022-02-28 at 23 07 27 Screenshot 2022-02-28 at 23 07 53 Screenshot 2022-02-28 at 23 09 17
nicolas6422 commented 2 years ago

@param-finder I solved this by setting autoPushRegistration to false on iOS and then manually registering the token. We are also using RNNotification and my best guess is that these two libraries do not get along. Either that or Iterable's SDK is just buggy 🤷

param-finder commented 2 years ago

@nicolas6422 Just tried that too via [IterableAPI registerToken:deviceToken]; in AppDelegate.m but no luck. It's not working on Android either.

gle-intive commented 5 months ago

Has this issue been fixed or is there any update? I'm experiencing similar error where the user does not exist. I'm using the latest Iterable swift-sdk 6.5.2

davidtruong commented 5 months ago

@gle-intive When you mean experiencing a similar error. Did you call call registerToken to create a new user and it didn't appear on Iterable?

gle-intive commented 5 months ago

Yes, I did call registerToken. Anyway, I can confirm that this time the error was on my side. I was using a wrong Api Key. Will you close the issue or is there any unfinished work here?

gle-intive commented 5 months ago

Does it mean that it is impossible to send events without calling registerToken to create the user ?

davidtruong commented 5 months ago

If you don't already have an existing user then you would either have to call registerDeviceToken or updateUser. Otherwise the user will have to have been created by a means other than the mobile sdk.

StephenAchieve commented 3 months ago

I ran into this issue today, I am using the latest sdk and I use setEmail & setUserId however when I look up both the userId or Email in the audience list I get no results. I can confirm I have everything setup properly including API Keys and proper setting & updating users.

meicoder commented 3 months ago

@davidtruong How can I call registerDeviceToken from the Iterable SDK for React Native?