react-native-sdk icon indicating copy to clipboard operation
react-native-sdk copied to clipboard

SDK is unable to create new users

Open jehartzog opened this issue 3 years ago • 15 comments

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

  • Using client sdk w/ valid mobile token, call Iterable.setUserId or Iterable.setEmail
  • If that userId or email doesn't exist, create a new user with those entries

Actual

  • SDK makes no API calls. Any follow on calls (Iterable.trackEvent) fail since user does not exist.

Versions

  • react-native 0.64.0
  • @iterable/react-native-sdk 1.0.26

jehartzog avatar Apr 08 '21 15:04 jehartzog

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!

roninopf avatar Apr 10 '21 00:04 roninopf

@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.

jehartzog avatar Apr 12 '21 16:04 jehartzog

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("[email protected]");

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?

dwrz avatar Jul 08 '21 15:07 dwrz

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",

trungls1706 avatar Aug 12 '21 07:08 trungls1706

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...

yarikpwnzer avatar Sep 08 '21 14:09 yarikpwnzer

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);

migue1s avatar Sep 08 '21 14:09 migue1s

@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?

nicolas6422 avatar Feb 10 '22 23:02 nicolas6422

@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

yarikpwnzer avatar Feb 11 '22 00:02 yarikpwnzer

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.

vbabenkoru avatar Feb 11 '22 04:02 vbabenkoru

@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

nicolas6422 avatar Feb 11 '22 17:02 nicolas6422

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

param-finder avatar Feb 28 '22 23:02 param-finder

@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 🤷

nicolas6422 avatar Feb 28 '22 23:02 nicolas6422

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

param-finder avatar Feb 28 '22 23:02 param-finder

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

gle-intive avatar May 13 '24 13:05 gle-intive

@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?

davidtruong avatar May 13 '24 18:05 davidtruong

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 avatar May 14 '24 19:05 gle-intive

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

gle-intive avatar May 15 '24 14:05 gle-intive

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.

davidtruong avatar May 15 '24 17:05 davidtruong

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.

StephenAchieve avatar Jun 28 '24 17:06 StephenAchieve

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

meicoder avatar Jul 24 '24 17:07 meicoder