Smart Assist - Get Callers Phone Number

Hi,

I’m Using SmartAssist and for some reason I cannot find the phone number in context.session.BotUserSession.lastMessage

Please see attached JSON:

image

@moishe
Which channel are you using? Are you trying to use the dialer for testing the SmartAssist bot?
Also, if you are using a webhook, please share the cURL (feel free to obfuscate the auth/ bearer, etc.).

I’m using Smart Assist to get a phone number that is connected to a Kore automation

Hi Moishe,

Please follow the below process in order to get the From number from the context variable.

  1. Add a script task node in the Smart Assist Experience flow with the below mentioned code.
    setCallFlowVariable('caller',context.BotUserSession.channels[0].handle.Caller);
    var caller = getCallFlowVariable('caller');
    userSessionUtils.put("Caller", caller);

  1. We can access the from number directly from the smart assist or from the XO platform

    a. To Access from the Smart Assist message node, Please use the below code in the message node.
    {{context.caller}}

b. To Access from the XO platform you may use the below code in the message node’s Advanced section.

var Caller = context.session.UserSession.Caller
print(Caller)

If you are directly testing from the Smart Assist dialer then you will be seeing the User-Id as the number.

Please note that based on the channel the number can be differently populated.

Hope this information helps and solves your query.

4 Likes

@jyotheendra.doddala Welcome!

Thanks for the answer, It works!

ok i need the dialed number by the caller