Skip to content
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

Feature request: allow passing custom attributes to initialize method (web) #466

Open
Frank3K opened this issue Oct 3, 2024 · 4 comments
Labels
platform-web Specific to Web platform support Asking for help writing an application

Comments

@Frank3K
Copy link

Frank3K commented Oct 3, 2024

Description

In the Intercom JavaScript SDK, it is possible to pass additional properties to the boot method, not just the appId, as is currently done in intercom_flutter_web. This could allow developers to initialize Intercom with more user-specific data.

For reference, here’s an example of how the boot method can accept additional properties:

Intercom('boot', {  
    app_id: 'abc12345',  
    email: 'john.doe@example.com',
    created_at: 1234567890,
    name: 'John Doe',
    user_id: '9876'
});

Source: Intercom SDK Documentation: boot Method

Currently, the intercom_flutter_web package only passes the appId during boot, as shown here:

globalContext.callMethod(
'Intercom'.toJS,
'boot'.toJS,
updateIntercomSettings('app_id', appId).jsify(),
);

Feature Request

Would it be possible to add support for passing additional properties to the boot method? While I know it’s possible to inject these properties using window.intercomSettings, I’d prefer to handle this within Flutter for consistency.

@deepak786
Copy link
Collaborator

deepak786 commented Oct 3, 2024

You can use updateUser API to pass the additional data and custom attributes.

@deepak786 deepak786 added platform-web Specific to Web platform support Asking for help writing an application labels Oct 3, 2024
@Frank3K
Copy link
Author

Frank3K commented Oct 3, 2024

You can use the updateUser API to pass the additional data and custom attributes.

Yes, I’m aware of the updateUser option. However, in our use case, some data is already available during the application's bootstrap, so it would be beneficial to submit this information directly during the initialization of Intercom. This would avoid an additional ping request to Intercom, making the initialization more efficient.

I’ve tried calling updateUser immediately after awaiting the initialize method, but unfortunately, the updateUser call does not seem to send a ping request in that case. I'm still investigating the cause—it could be due to Intercom not being fully initialized at that point, or perhaps the call is being debounced.

Would you be open to a PR that adds this functionality, allowing properties to be passed during the initial boot as described in the feature request?

@deepak786
Copy link
Collaborator

If we allow passing some additional data only from the web during the initialization then it will be inconsistent with other platforms (Android and iOS). So I don't recommend this.

The ideal way is to chain the updateUser call after the initialize.

@Frank3K
Copy link
Author

Frank3K commented Oct 3, 2024

If we allow passing some additional data only from the web during the initialization then it will be inconsistent with other platforms (Android and iOS). So I don't recommend this.

The ideal way is to chain the updateUser call after the initialize.

Thanks for your answer. I understand. I'll try to debug why the immediate updateUser does not fire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-web Specific to Web platform support Asking for help writing an application
Projects
None yet
Development

No branches or pull requests

2 participants