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

User ID metrics is not easy to implement #479

Open
epetecof opened this issue Sep 22, 2020 · 1 comment
Open

User ID metrics is not easy to implement #479

epetecof opened this issue Sep 22, 2020 · 1 comment

Comments

@epetecof
Copy link

Now that Watson Assistant Plus and Premium are charged based on unique users per month it would be nice to have a msg.params.user_id property for the AssistantV2 node, in order to specify your unique identifier.

I was trying to do it using the msg.additional_context property for including context.global.system.user_id in my messages (as recommended in this link of the documentation), but after a few tries I saw that the analytics tab showed no data for unique users.

Looking at the code, I discovered that the msg.additional_context property is only suitable for adding variables in the user defined context (context.skills.main skill.user_defined). As a work around (for you that, like me, spent some time banging your head against the wall) I discovered that you can change the root context using msg.params.context, but you need to maintain the same pattern used in the original code (or it will break the msg.additional_context logic), like this:

msg.params = {
        context: {
            global: {
                system: {
                    user_id: msg.twilio.From
                }
            },
            skills: {
                'main skill': {
                    user_defined: {}
                }
            }
        }
    }

Please let me know if there is already a better way to do this, I didn't find it. Thanks!

OBS: If you are using Twilio, like me, it is a good idea to use the Body.From property as your identifier

@chughts
Copy link
Member

chughts commented Oct 5, 2020

I think the best way would be for the node to allow global system level context setting. Keeping this issue open allowing for pull requests with suggested resolutions.

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

No branches or pull requests

2 participants