Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Add non-student roles, job title, and grades into Intercom #1206

Closed
benetechMatt opened this issue May 20, 2020 · 16 comments
Closed

Add non-student roles, job title, and grades into Intercom #1206

benetechMatt opened this issue May 20, 2020 · 16 comments
Assignees
Labels

Comments

@benetechMatt
Copy link

For anyone that does not select that they are a student when signing up, this information should be added to Intercom as new custom fields
Role - teacher, non-teacher, etc.
grade
job title

Is there any additional information currently being asked or collected when users sign up?

@benetechMatt
Copy link
Author

would also like the change to be retroactive

@alexrcabral
Copy link

@benetechMatt That's the full list of information currently being asked during Teacher sign up, so I don't believe there's information in addition to that.

@alexrcabral
Copy link

alexrcabral commented Jul 14, 2020

To clarify from call today, this is asking for "user types", as well as "grades" and "role" for the teacher user type.

@benetechMatt
Copy link
Author

@johnhbenetech has added this information retroactively to Intercom. New fields of "Grade" "UserType" and "UserRole
Grade: K-5, 6-8, 9-12, 13+, none
UserType: teacher, other
UserRole: Teacher, technology coach, media specialist, special education, educator, curriculum, developer, administrator

@johnhbenetech will this information now automatically go to Intercom for new users as well?

@johnhbenetech
Copy link
Member

@benetechMatt I want to do an audit of that, so if it's okay I can put this in the backlog

rupeshparab added a commit that referenced this issue Jul 16, 2020
rupeshparab added a commit that referenced this issue Jul 16, 2020
@rupeshparab
Copy link
Collaborator

I have updated the role key to userRole

@bognasoldev89 bognasoldev89 self-assigned this Jul 17, 2020
@johnhbenetech
Copy link
Member

@rupeshparab something is still off here. The user get's registered in intercom, but still doesnt have the custom attributes.

I sniffed all the network packets and I dont see that data being passed to intercom. I see several events being passed - but they dont include the additional fields - nor are they in the initial ping.

Please audit the implementation as I wonder if there is some change to how intercom expects these values. They reference IntercomSettings instead of just passing in the event:
https://www.intercom.com/help/en/articles/179-send-custom-user-attributes-to-intercom#how-do-i-do-it

I worry the current react library we are using is dead. We probably need to pull it out and replace it with this one:
https://github.com/devrnt/react-use-intercom

Let me know if I'm missing something obvious

@rupeshparab
Copy link
Collaborator

@johnhbenetech
I checked it on QA, saw some warnings from Intercom: 'Intercom not initialized yet'.
It seems Intercom is not getting initialised by the time we are calling its api and it doesn't queue the requests to send the events after initailizing.

Also the library has been inactive for some time: nhagen/react-intercom#73

Will integrate react-use-intercom in its place

rupeshparab added a commit that referenced this issue Jul 21, 2020
#1206 - experimental change to check if intercom has booted
rupeshparab added a commit that referenced this issue Jul 21, 2020
rupeshparab added a commit that referenced this issue Jul 21, 2020
rupeshparab added a commit that referenced this issue Jul 21, 2020
rupeshparab added a commit that referenced this issue Jul 21, 2020
rupeshparab added a commit that referenced this issue Jul 21, 2020
@johnhbenetech
Copy link
Member

Hey @rupeshparab, I still think there is something going on here which warrants a closer look:

I think there are two issues here potentially:

  1. I created a new mathshare user on QA and it doesn't seem that they ever made it into Intercom. I guess it's possible it takes longer than I think for Intercom to display a new user, but inspecting the network traffic I see the event getting sent but I don't see the user email anywhere in the header or the form body, so I wonder if intercom is getting an event without an email:

Intercom Trace

  1. I think we also need to change where this data is sent. I think we should actually be using custom attributes and not an event for user details specifically:
    https://www.intercom.com/help/en/articles/2433372-custom-attributes-vs-events-what-s-the-difference

So those same data keys should be used, they just need to be passed to the component like here:
nhagen/react-intercom#31

I think we might be able to handle this with react-intercom as a quick fix, but should still get an estimate for how long we think it might take to switch to react-use-intercom.

@johnhbenetech
Copy link
Member

Also here's the trace of the first intercom ping (before the event), user details seems to be blank:

Intercom Ping Trace

rupeshparab added a commit that referenced this issue Jul 22, 2020
#1206 - integrate intercom custom attributes
@rupeshparab
Copy link
Collaborator

@johnhbenetech
Custom attribute seems to be solving the issue
Ping:
image

Event:
image

I will checkout the react-use-intercom for ETA on porting our current intercom api calls to it

@johnhbenetech
Copy link
Member

@rupeshparab This still isn't functioning as expected. We no longer need to pass the userType, userRole, and grades as metadata within an event.

Instead we need to pass them as part of the intercomAttributes as keys in addition to user_id, email, name

@rupeshparab
Copy link
Collaborator

@johnhbenetech
I have moved the user-details event data to custom attributes
image

@johnhbenetech
Copy link
Member

johnhbenetech commented Jul 23, 2020

Sorry @rupeshparab one more fix (it's my fault for not looking into this more)

So userType and userRole are working great now, thanks!

Unfortunately for grades, Intercom does not accept arrays for values, only text. So we will need to concatenate the array into a string (with comma-separated values, so like: "K-5,6-8,9-12,13+"

Let me know if you have other questions, sorry again!

rupeshparab added a commit that referenced this issue Jul 23, 2020
rupeshparab added a commit that referenced this issue Jul 23, 2020
@rupeshparab
Copy link
Collaborator

No worries John, I have pushed a fix for it

@johnhbenetech
Copy link
Member

Working!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants