versolearning / meteor-intercom

Reactive intercom integration for Meteor
47 stars 15 forks source link

Not sending custom data #35

Open isAlmogK opened 7 years ago

isAlmogK commented 7 years ago

It seems that the package does not support custom data, here is my code

Also the name is not sending

// Intercom

 IntercomSettings.userInfo = function(user, info) {
      // add properties to the info object, for instance:
      info.email = profile.email;
      info['name'] = profile.name;
      info.created_at = profile.createdAt;
      info.user_type = type;
      info.user_created_at = profile.createdAt;
      info.last_activity_in_a_loop_at = lastActivityInALoopTimestamp;
      info.program_invited_at = programInvitedAtTimestamp;
      info.program_name = program[0].name;
      info.program_self_service_modal = selfServiceModal;
      info.program_created_at = programCreatedAtTimestamp;
      info.mentee = mentee;
      info.mentor= mentor;
    };
  });
dburles commented 7 years ago

Hey @AlmogRnD are you sure the fields you're referencing contain data? you should be probably referencing the user argument.

isAlmogK commented 7 years ago

This var contain data 100% i.e. profile.createdAt ect.. I just removed the package and used the single page js script and it's working.

Also in your example / docs you have info['name'] = profile.name; Which does not work

dburles commented 7 years ago

You really should reference the user via the user argument. e.g. user.profile.name.

isAlmogK commented 7 years ago

What do you mean?

If I want to send custom your saying it should be like so

user.program_name = program[0].name;

and not

info.program_name = program[0].name;

What does this have to do with "user.profile.name"

dburles commented 7 years ago

The current user is passed through to the IntercomSettings.userInfo function

info.name = user.profile.name;
info.created_at = user.profile.createdAt;

etc