Digital Assistant and Mobile

Get Involved. Join the Conversation.

Topic

    Sikaar Keita
    Accessing userid and channel type from the dialog flow and...Answered
    Topic posted November 12, 2018 by Sikaar KeitaGreen Ribbon: 100+ Points, last edited January 16, 2019 by Arijit ChakrabortyBronze Trophy: 5,000+ Points, tagged Alexa, Facebook, OMCE, Tip 
    147 Views, 6 Comments
    Title:
    Accessing userid and channel type from the dialog flow and custom component
    Summary:
    I am looking ofr a proper way to access user information and channel information
    Content:

    Hi,

    I am looking for a proper way to access user information and channel information, from both Dialog Flow and Custom Component.

    My Bot is running on 3 different channels ( Alexa, Facebook Messenger, Website) and i would like :

    1) to have a switch proposing various options based on the invoking channel, thus my need to acces the channel type from the dialog flow. I have tried many things (channelType ... ) but nothing worked out. Same when trying to access it from a custom component.

    2) to have acess to userId, so i can access and store data. in the custom component i have tried body.message.channel.userId with no success

    3) For Alexa and FBM, i owuld also like to dig the account linking topic - ie capture the amazon id or facebook id of the user. So far with FBM i properly capture firstname and last name, how could i go further ? I couldn't find any details in the online documentation.

     

    Best Regards

    Best Comment

    Ruben Rodriguez

    Hello,

    This is how we are getting facebook userid: conversation.request().message.channelConversation.userId

    You can get the channel type from custom component with: conversation.request().message.channelConversation.type (facebook, test)

     

    regards, Ruben,

     

    Comment

     

    • Abhishek Singh

      Hi Sikaar,

      I am looking for some guidance to integrate Alexa to my Chatbot which is currentlly using facebook channel and android. Could you please provide some links for well detailed documentation or steps.

       

      Thanks,

      Abhishek

    • Ruben Rodriguez

      Hello,

      This is how we are getting facebook userid: conversation.request().message.channelConversation.userId

      You can get the channel type from custom component with: conversation.request().message.channelConversation.type (facebook, test)

       

      regards, Ruben,

       

      • Sikaar Keita

        Thanks a lot, as simple as it seems I did not found the right way to do it but it now works perfectly !!!!

         

      • Sikaar Keita

        Any clue on how to access the Channeltype from the dialogflow ?

        for ressources optimization reasons , i would rather get this information in the bots rather than from a custom component .

    • Luc Bors

      Hi Sikaar,

      I did some PoC work with Alexa. Regarding your question:

      For Alexa and FBM, i owuld also like to dig the account linking topic - ie capture the amazon id or facebook id of the user. So far with FBM i properly capture firstname and last name, how could i go further ? I couldn't find any details in the online documentation

      Here is how I did this: For Alexa, I use the Alexa conversation ID as userId to send to the Digital Assistant as this is what uniquely identifies the Alexa Conversation. This way, one user could have multiple active conversations. Next you could add an extra parameter, lets call it Additional Properties and add whatever extra info you need:

      [additionalProperties] --> 

      {
        "profile": {
        "firstName": 'John',
        "lastName": 'Doe'
        "age": 22,
        "clientType": 'Alexa'
        }

      Next in your flow you can access this information via the profile.firstName, profile.clientType etcetera.

      This is more or less explained in the developer guide (https://docs.oracle.com/en/cloud/paas/mobile-suite/use-chatbot/bot-channels.html#GUID-96CCA06D-0432-4F20-8CDD-E60161F46680​), in section 

      Inbound Messages --> The call for sending messages to your bot must have:

      1. An X-Hub-Signature
      2. A JSON object with userId, userProfile, and messagePayload properties

      Thanks

    • Frank Nimphius

      Hi,

      the new ODA (just being released) allows you to access this information more easily using expressions

      –${system.message}
      •Prints the complete JSON response
      •Any content is accessible using a dot ('.') notation
      –${system.message.channelConversation.channelName}
      •Prints the name of the channel as defined in digital assistant
      –${system.message.channelConversation.type}
      •Prints information about the messenger used: 'test', 'facebook' 'webhook' etc.