How to obtain Workplace Account Info/Details


(Elmer Arapoc) #1

I am connecting my bot to Workplace and I need to obtain the Workplace user account info (Full Name, Email, Job Title, Dept, etc.) when the bot is called. {{context.session.UserContext.}} or its variations are not working. Is this supported? Thanks


(Yoga Ramya Mendu) #2

Hi @arapoc_elmer,

Please print the context.session.UserContext and then check the response.

According to the response, you can retrieve the Full Name, Email, Job Title, Dept with the appropriate field name.

Kindly send us the screenshot of the response from context .session.UserContext so that we can help you further.

Regards,
Yoga Ramya.


(Javier Otero) #3

Hello @yogaramya.mendu,

I have the same question as the original poster. Our Workplace channel is setup and able to receive/respond to bot messages, however, the UserContext object appears to be missing all profile data.

I’ve printed the entire context object (and redacted sensitive information) to give a better picture of what’s going on. As you can see, the UserContext is mostly empty and missing fields from the Workplace profile I used to communicate with the bot. Please let me know what else I should do to troubleshoot.

{
    "bot": "Task Tracker STAGING",
    "botid": "REDACTED",
    "taskid": "REDACTED",
    "intent": "Welcome",
    "intentType": "dialog",
    "entities":
    {},
    "entityErrorCount":
    {},
    "amendEntities":
    {},
    "userInputs":
    {
        "originalInput":
        {
            "sentence": "Hi",
            "timestamp": 2717161755
        }
    },
    "message_tone": [],
    "dialog_tone": [
    {
        "tone_name": "positive",
        "level": 1,
        "count": 3
    },
    {
        "tone_name": "sad",
        "level": 0.33,
        "count": 1
    },
    {
        "tone_name": "angry",
        "level": -0.67,
        "count": 1
    },
    {
        "tone_name": "disgust",
        "level": -0.33,
        "count": 1
    },
    {
        "tone_name": "fear",
        "level": -0.67,
        "count": 1
    }],
    "currentNodeId": "message2",
    "currentNodeName": "DEBUG_Context",
    "previousNodeId": "message1",
    "previousNodeName": "WelcomeMessage",
    "updatedOn": "2019-03-21T20:32:35.900Z",
    "session":
    {
        "EnterpriseContext":
        {
            "Enterprise_Prod_Ravindra_Email": "id labore ex et quam laborum",
            "EC1": "Enterprise Context session variable fromintializer",
            "Enterprise_G_Ravindra_Email": "ravindra.balleda @kore.com ",
            "kitentkey": "kitentkey",
            "entkey": "entkey",
            "testdata - u": "testing",
            "enterprisecontext": "enterprisecontextvalue"
        },
        "BotContext":
        {
            "preferences":
            {
                "users": [
                {
                    "id": "u-f61cf505-8a6b-5a3b-95d4-343ac089ee68",
                    "briefingTime": "T10:00:00+00:00",
                    "optedIn": "Yes , I would like to opt in"
                }]
            }
        },
        "UserContext":
        {
            "workinghours":
            {
                "workdays": "mon,tue,wed,thu,fri",
                "workstart": "8:00 AM",
                "workend": "5:00 PM"
            },
            "profImage": "no-avatar",
            "jTitle": "",
            "dept": "",
            "profColour": "#00ff7f",
            "activationStatus": "active",
            "firstName": "",
            "lastName": "",
            "orgId": "o-e31a1a45-c24a-5074-b4b7-d44396e6e4ac",
            "_id": "u-f61cf505-8a6b-5a3b-95d4-343ac089ee68",
            "customData": null,
            "identities": [
            {
                "val": "REDACTED/wfacebook/100024596131044",
                "type": "mapped"
            }]
        },
        "UserSession":
        {
            "briefingTime": "T10:00:00+00:00",
            "optedOut": false
        },
        "BotUserSession":
        {
            "channels": [
            {
                "type": "wfacebook",
                "from": "REDACTED/wfacebook/100024596131044",
                "to": "618351071942809",
                "isMention": false,
                "body": "Hi",
                "streamId": "st-89fa436c-d78b-5823-941f-f6ebe8e2ad44",
                "companyId": "REDACTED",
                "enable": true,
                "message": "The bot is disabled via Workplace by Facebook. You can still talk to the bot via Workplace by Facebook.",
                "activeChannels ": "Workplace by Facebook.",
                "app_token": "REDACTED",
                "app_id": "REDACTED",
                "app_secret": "REDACTED",
                "isMentionEnabled": true,
                "isChatEnabled": true,
                "tokens": [],
                "userId": "u - f61cf505 - 8 a6b - 5 a3b - 95 d4 - 343 ac089ee68",
                "requestId": "ms - b1d52c48 - afa8 - 58 cb - bea0 - de0967f2d2a6",
                "botLanguage": "en"
            }],
            "lastMessage":
            {
                "channel": "wfacebook",
                "messagePayload":
                {
                    "object": "page",
                    "entry": [
                    {
                        "id": "618351071942809",
                        "time": 1553200355072,
                        "messaging": [
                        {
                            "sender":
                            {
                                "id": "100024596131044",
                                "community":
                                {
                                    "id": "183964045548961"
                                }
                            },
                            "recipient":
                            {
                                "id": "618351071942809"
                            },
                            "timestamp": 1553200354595,
                            "message":
                            {
                                "mid": "OFo3LkWiXp8RI7cNFimtjSVxSeXpprcMXax6Lj_sOryBmVFPmA97aYLlvL-spKXwO60PHC0y_wuQDQWZg98OZA",
                                "seq": 709,
                                "text": "Hi"
                            }
                        }]
                    }]
                }
            }
        },
        "opts":
        {
            "userId": "u-f61cf505-8a6b-5a3b-95d4-343ac089ee68",
            "streamId": "st-89fa436c-d78b-5823-941f-f6ebe8e2ad44"
        }
    }
}

(Yoga Ramya Mendu) #4

Hi @javier,

We are checking this and will update you shortly.

Regards,
Yoga Ramya.


(Javier Otero) #5

Great, thank you Yoga!


(Swagata Sengupta) #6

Hello @javier and @arapoc_elmer,

Just wanted to let you know that we are still working on this… The set up of workplace is taking some time. Once it is done we should be able to provide an answer soon. Please stay tuned!


(Javier Otero) #7

Hi @swagata.sengupta,

Following up to see how your investigation on this issue is going? Thank you!