Skip to content

FYST-2312/add-intercom-to-pya#236

Merged
DrewProebstel merged 13 commits intomainfrom
FYST-2312/add-intercom-to-pya
Dec 8, 2025
Merged

FYST-2312/add-intercom-to-pya#236
DrewProebstel merged 13 commits intomainfrom
FYST-2312/add-intercom-to-pya

Conversation

@DrewProebstel
Copy link
Contributor

@DrewProebstel DrewProebstel commented Nov 24, 2025

Link to pivotal/JIRA issue

Is PM acceptance required? (delete one)

  • Yes - don't merge until JIRA issue is accepted!

Reminder: merge main into this branch and get green tests before merging to main

What was done?

  • Hooks up FYST intercom for PYA

How to test?

Screenshots (for visual changes)

Screenshot 2025-11-25 at 10 26 17 AM Screenshot 2025-11-25 at 10 26 06 AM

@DrewProebstel DrewProebstel changed the title Early work on integrating intercom FYST-2312/add-intercom-to-pya Nov 25, 2025
@anisharamnani
Copy link
Contributor

i remember rotating the intercom keys to be a bit tricky when i did it for vita-min. i don’t see the intercom workspace when i log into intercom. did you have a chance to do that?

@DrewProebstel
Copy link
Contributor Author

i remember rotating the intercom keys to be a bit tricky when i did it for vita-min. i don’t see the intercom workspace when i log into intercom. did you have a chance to do that?

Is rotating the key an important part of this work? Since we are using the FYST key can't it just rotate when we do our other rotations?

Drew Proebstel added 2 commits November 25, 2025 14:37
@anisharamnani
Copy link
Contributor

anisharamnani commented Nov 26, 2025

that’s fine. you don’t have to rotate them. i just wanted to call out setting the keys. have you set the keys for PYA? FYST and PYA have different ways of setting environment variables.

also, i don’t want to be a blocker, so feel free to slack me if you’re waiting on a response from me.

<%= javascript_importmap_tags "application" %>
<%= Sentry.get_trace_propagation_meta.html_safe %>

<%= render "layouts/intercom_jwt" %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed in the JIRA ticket it noted that it want the intercom widget to display on only these pages:

Year Selection: /year_select

Contact preference: /contact_preference

Entering email address: /email_address

Entering phone number: /phone_number

Entering verification code: /verification_code

Entering SSN/ITIN: /identification_number

Selecting mailing address: /mailing_address_validation

PDF download: /pdf

All offboarding & lockout pages

but would this display it on the whole site instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is the whole site actually.

# == Enabled Environments
# Which environments is auto inclusion of the Javascript enabled for
#
config.enabled_environments = ["development", "production"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should you add demo & staging here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our staging actually has production as the environment so we don't need to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm staging should not share the production creds 😬, that would mean if someone sent a message on the staging site it would go to the production intercom and confuse the client success folks right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The creds are stored and accessed using amazon secret key manager so the correct creds will be used here.

# The method/variable that contains the logged in user in your controllers.
# If it is `current_user` or `@user`, then you can ignore this

config.user.current = proc {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proc{} will return nil right? so this line can probably deleted if its the default current user other wise config.user.current = proc {other_name_for_current_user}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless you want all intercom chatters to look like logged out clients?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

IntercomRails.config do |config|
# == Intercom app_id
#
config.app_id = ENV["INTERCOM_APP_ID"] || "rtcpj4hf"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we do config.app_id = ENV.fetch("INTERCOM_APP_ID", nil) instead so its more obvious when env is missing and then put "rtcpj4hf" for all the test envs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea I am moving this into doppler

@@ -0,0 +1,13 @@
class IntercomService
def self.generate_user_hash(user_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this getting called? and maybe we don't need it since we are doing JWT stuff for security instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call

return nil unless intake

payload = {
user_id: intake.id.to_s,
Copy link
Contributor

@embarnard embarnard Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user_id should be a consistent identifier for intercom, what happens if there is a returning client with a new intake id? i think we will run into conflicts here if a user has more than one intake

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We won't have a user with multiple intakes because StateFileArchivedIntake functions as the user.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if a client uses the site in 2025 and then again in 2026 wouldn't this create two StateFileArchivedIntakes? or would it use the same object in the model?

Copy link
Contributor Author

@DrewProebstel DrewProebstel Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PYA doesn't have anything like a user so I think each intake would need to have its own chat.

@@ -0,0 +1,19 @@
# app/services/intercom_jwt.rb
require "jwt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess since we are using this we don't need to do the identity verification stuff i saw here that it says its deprecated so that we should use JSON Web Tokens instead, so nice work with this

https://www.intercom.com/help/en/articles/183-set-up-identity-verification-for-web-and-mobile-deprecated

Copy link
Contributor

@embarnard embarnard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more questions

return nil unless intake

payload = {
user_id: intake.id.to_s,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if a client uses the site in 2025 and then again in 2026 wouldn't this create two StateFileArchivedIntakes? or would it use the same object in the model?

# == Enabled Environments
# Which environments is auto inclusion of the Javascript enabled for
#
config.enabled_environments = ["development", "production"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm staging should not share the production creds 😬, that would mean if someone sent a message on the staging site it would go to the production intercom and confuse the client success folks right?

@DrewProebstel DrewProebstel merged commit 4fa1176 into main Dec 8, 2025
4 checks passed
@DrewProebstel DrewProebstel deleted the FYST-2312/add-intercom-to-pya branch December 8, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants