Skip to content

add intercom_user_jwt #2858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ const subscriptions: Subscription[] = [
else: { '@path': '$.context.Intercom.userHash' }
}
},
intercom_user_jwt: {
'@if': {
exists: { '@path': '$.context.Intercom.intercom_user_jwt' },
then: { '@path': '$.context.Intercom.intercom_user_jwt' },
else: { '@path': '$.context.Intercom.intercomUserJwt' }
}
},
hide_default_launcher: {
'@if': {
exists: { '@path': '$.context.Intercom.hideDefaultLauncher' },
Expand Down Expand Up @@ -368,6 +375,46 @@ describe('Intercom.update (user)', () => {
user_hash: 'x'
})
})

test('allows passing a intercom user jwt', async () => {
const context = new Context({
type: 'identify',
userId: 'id',
traits: {},
context: {
Intercom: {
intercom_user_jwt: 'x'
}
}
})

await identifyUser.identify?.(context)

expect(mockIntercom).toHaveBeenCalledWith('update', {
user_id: 'id',
intercom_user_jwt: 'x'
})
})

test('accepts snake/camel case for intercom_user_jwt', async () => {
const context = new Context({
type: 'identify',
userId: 'id',
traits: {},
context: {
Intercom: {
intercomUserJwt: 'x'
}
}
})

await identifyUser.identify?.(context)

expect(mockIntercom).toHaveBeenCalledWith('update', {
user_id: 'id',
intercom_user_jwt: 'x'
})
})
})

describe('Intercom.update (user) widget options', () => {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const action: BrowserActionDefinition<Settings, Intercom, Payload> = {
},
user_hash: {
description:
'The user hash used for identity verification. See [Intercom docs](https://www.intercom.com/help/en/articles/183-enable-identity-verification-for-web-and-mobile) for more information on how to set this field.',
'The user hash used for identity verification. See [Intercom docs](https://www.intercom.com/help/en/collections/12295815-messenger-security) for more information on how to set this field.',
label: 'User Hash',
type: 'string',
required: false,
Expand All @@ -103,6 +103,20 @@ const action: BrowserActionDefinition<Settings, Intercom, Payload> = {
}
}
},
intercom_user_jwt: {
description:
'The intercom user JWT is used to secure your messenger for your users. See [Intercom docs](https://www.intercom.com/help/en/collections/12295815-messenger-security) for more information on how to set this field.',
label: 'Intercom User JWT',
type: 'string',
required: false,
default: {
'@if': {
exists: { '@path': '$.integrations.Intercom.intercom_user_jwt' },
then: { '@path': '$.integrations.Intercom.intercom_user_jwt' },
else: { '@path': '$.integrations.Intercom.intercomUserJwt' }
}
}
},
company: {
description: "The user's company.",
label: 'Company',
Expand Down