Definition
Addins are pieces of code executed by the agent, accessible from athena.
Using the VCP Platform, you can write your own addins.
Using the Satisfaction Platform, you only have access to predefined addins.
Syntax
? HELLO
- @name.function()
The addin is composed of : @ char as first char, followed by the identifier of the addin, a dot and the function to call.
An addin can have multiple parameters :
? HELLO
- @name.function("arg1", "arg2")
An addin can have successive calls :
? HELLO
- @name.function1("arg1", "arg2").function2()
This is true when function2 is available through return value of function1.
Predefined Addins
response
This addins helps to update the response that will be sent to the user
addData
key : The key of the data.
value : The value of the data.
Add technical data to the outgoing message
? HELLO
-: @response.addData("xbrain.web.navigate","""{"url":"/hello"}""")
- Hello
addDataFromObject
key : The key.
dataKey : The data key. Can be scenario or session data.
Adds the data from object.
? HELLO
-: %data = @core.createObject()
-: %data.url = "/hello"
-: @response.addDataFromObject("xbrain.web.navigate","data")
- Hello
sendData
key : The key of the data.
value : The value of the data.
Send technical data without waiting the response to be sent
? HELLO
-: @response.sendData("xbrain.web.navigate","""{"url":"/hello"}""")
- Hello
sendDataFromObject
key : The key.
dataKey : The data key. Can be scenario or session data.
Sends the data from object.
delay
time : The time expressed in seconds.
Delay the current template by X seconds. The value 0 cannot be used, but a low timer “0.1” works.
? HELLO
- Hello
-& How are you? @response.delay("5")
delayAll
time : The time expressed in seconds.
Delay all continuation templates by X seconds. The value 0 cannot be used, but a low timer “0.1” works.
? HELLO
-: @response.delayAll("2")
- Hello
-& How are you?
nothing
Tells the athena engine that the current template has no associated text.
[SET_VALUE(value)]
-: %myParam = "%value"
- @response.nothing()
Returns :
analytics
Add information on human machine interractions
push
tag : The tag.
values : The values.
Pushes the specified tag. The tag will be retrieved afterwards into the mass export If the tag is used several times into a same turn, values will be grouped into a list
? HELLO ANALYTICS
-: @analytics.push("tag", "hello world")
- hello
Returns :
connector
This addin helps finding the right connector/communication channel to use.
equals
connectors : One or multiple connectors.
Determines if the connector used by the user is one of the specified connectors. Known values for connector are: sip, facebook, skype, ms-teams, slack, chatra, twilio-sms, ws, soap
? HELLO
- Message will be sent to all other
-| @connector.equals("sip")
- Message will be sent to sip sessions
-| @connector.equals("facebook", "skype")
- Message will be sent to facebook and skype
Returns : true if the user is using one of the specified connectors; otherwise, false.
addAdditionalMode
value : The value.
Add allomedia mode to the outgoing data.
addAdditionalData
json : object
Add additional data to the outgoing data specific to the connector. Objects will be merged if addAdditionalData is executed multiple times in the same context. json property only accepts objects, no array or value
has
connector : The connector. One of
Determines if the agent has the specified connector activated. Known values for connector are: sip, facebook, skype, ms-teams, slack, chatra, twilio-sms, ws, soap
[DEFAULT]
- I don't seem to be able to hear you correctly. Could you please repeat?
-| @connector.has("twilio-sms")
- Sorry I did not get that. If you don't mind, could we continue this conversation by text?
? YES
- @sms.defaultToText("TEXT_LABEL_CONVERSATION")
Returns : true if the agent has the specified connector activated.
context
get
key :
contextUser
This addin helps to save, retrieve and compare user context values. User context values are always accessible, even after a reconnection If connected as anonymous, the userContext uses the sessionContext
get
key : The context key.
Get the context value based on given key
[CONFIRM_EMAIL]
- Do you confirm this email : @contextUser.get("email")
Returns : value of the specified key. if key does not exists, returns NOTHING
set
key : The context key.
value : The context value.
Set the context using key and value.
? UDPATE EMAIL
-: @contextUser.set("email", "demo@satisfaction.ai")
- demo email has been set
? GET EMAIL
- Your email is @contextUser.get("email")
equals
key : The context key.
value : The value to compare.
Determines wether user context value belonging to the specified key equals the specified value.
[CONFIRM_EMAIL]
- Do you confirm this email : @contextUser.get("email")
-| @contextUser.equals("email", "admin@satisfaction.ai")
- No confirmation needed for you :)
Returns : true if value of the specified context key equals the specified value; otherwise, false
has
key : The context key.
Determines whether the specified key is present in the user context.
[SIGNIN]
- What is your email address?
-| @contextUser.has("email")
- {ASK_PASSWORD}
Returns : true if the user context contains the specified key; otherwise, false.
remove
key : The context key.
Removes the key value pair from the user context.
? UDPATE EMAIL
-: @contextUser.set("email", "demo@satisfaction.ai")
- demo email has been set for the session
? FORGET IT
-: @contextUser.remove("email")
- The email does not longer exist in context
core
This addin helps to save, retrieve and compare scenario context values. Scenario context values are accessible until the user reaches the end of the scenario (no sub scenarios exists)
createObject
Creates an object and returns it.
? WHAT THE WEATHER LIKE IN
-: @entities.extract("city")
-: %query = @core.createObject()
-: %query.city = "%city"
-: %query.token = "mySecretToken"
-: @rest.bodyFromObject("query").post("http://api.weather.com")
- Current weather is %rest.response in %query.city
Returns : A new object that needs to be assigned to a variable.
parseJSON
json : The json string to parse.
Creates an object/array and returns it.
? WHAT CAN DO WITH
-: %query = @core.createObject()
-: %query.ingredients = @core.parseJSON("""["apple", "strawberry"]""")
-: @rest.bodyFromObject("query").post("http://api.cooking.com")
- Here is a list of recipe you can do
Returns : A new object/array that needs to be assigned to a variable.
select
objectName : Name of the object to be found in scenario or session context.
jsonPath : The json path query.
Extract a JSON element from the specified contact object, based on the JSONPath provided Returns : Element if JSONPath match an element, null otherwise
selectMany
objectName : Name of the object to be found in scenario or session context.
jsonPath : The json path query.
Extract JSON elements from the specified contact object, based on the JSONPath provided Returns : Elements if JSONPath match some, null otherwise
exists
objectName : Name of the object to be found in scenario or session context.
jsonPath : The json path query.
Test the existence of an elment in the specified contact object, based on the JSONPath provided Returns : true if JSONPath match an element, false otherwise
contextScenario
This addin helps to save, retrieve and compare scenario context values. Scenario context values are accessible until the user reaches the end of the scenario (no sub scenarios exists)
get
key : The context key.
Get the context value based on given key
[CONFIRM_EMAIL]
- Do you confirm this email : @contextScenario.get("email")
Returns : value of the specified key. if key does not exists, returns NOTHING
set
key : The context key.
value : The context value.
Set the context using key and value.
? UDPATE EMAIL
-: @contextScenario.set("email", "demo@satisfaction.ai")
- demo email has been set for the scenario
? GET EMAIL
- in this context, "email" does not exists.
equals
key : The context key.
value : The value to compare.
Determines wether scenario context value belonging to the specified key equals the specified value.
[CONFIRM_EMAIL]
- Do you confirm this email : @contextScenario.get("email")
-| @contextScenario.equals("email", "admin@satisfaction.ai")
- No confirmation needed for you :)
Returns : true if value of the specified context key equals the specified value; otherwise, false
has
key : The context key.
Determines whether the specified key is present in the scenario context.
[SIGNIN]
- What is your email address?
-| @contextScenario.has("email")
- {ASK_PASSWORD}
Returns : true if the scenario context contains the specified key; otherwise, false.
has
key : The context key.
checkContextSession : Check also context session is set to true. If in session, the scenario context is updated with the session context key value.
Determines whether the specified key is present in the scenario context. This methods also allows use to check the session context as well.
? HELLO
-: @contextSession.set("email", "demo@satisfaction.ai")
- The email exists now in session context
[SIGNIN]
- What is your email address?
-| @contextScenario.has("email", "true")
- {ASK_PASSWORD}
Returns : true if the specified key exists in context; otherwise, false.
transferToSession
key : The context key.
Transfers the scenario context key value to the session context.
? UDPATE EMAIL
-: @contextScenario.set("email", "demo@satisfaction.ai")
- demo email has been set for the scenario.
? REGISTER IT
-: @contextScenario.transferToSession("email")
? GET EMAIL
- in this context, "email" does not exists in scenario context, but in session (if the user says REGISTER IT)
remove
key : The context key.
Removes the key value pair from the scenario context.
? UDPATE EMAIL
-: @contextScenario.set("email", "demo@satisfaction.ai")
- demo email has been set for the scenario
? FORGET IT
-: @contextScenario.remove("email")
- The email does not longer exist in context
clear
Clears the scenario context from all its data.
? RESET CTX SCENARIO
-: %first = "hello"
-: %second = "world"
- %first %second // output is hello world
? CONTINUE
-: @contextScenario.clear()
- %first %second // output is %first %second
contextSession
This addin helps to save, retrieve and compare session context values. Session context values are always accessible, unlike contextScenario
get
key : The context key.
Get the context value based on given key
[CONFIRM_EMAIL]
- Do you confirm this email : @contextSession.get("email")
Returns : value of the specified key. if key does not exists, returns NOTHING
set
key : The context key.
value : The context value.
Set the context using key and value.
? UDPATE EMAIL
-: @contextSession.set("email", "demo@satisfaction.ai")
- demo email has been set
? GET EMAIL
- Your email is @contextSession.get("email")
equals
key : The context key.
value : The value to compare.
Determines wether session context value belonging to the specified key equals the specified value.
[CONFIRM_EMAIL]
- Do you confirm this email : @contextSession.get("email")
-| @contextSession.equals("email", "admin@satisfaction.ai")
- No confirmation needed for you :)
Returns : true if value of the specified context key equals the specified value; otherwise, false
has
key : The context key.
Determines whether the specified key is present in the session context.
[SIGNIN]
- What is your email address?
-| @contextSession.has("email")
- {ASK_PASSWORD}
Returns : true if the session context contains the specified key; otherwise, false.
remove
key : The context key.
Removes the key value pair from the session context.
? UDPATE EMAIL
-: @contextSession.set("email", "demo@satisfaction.ai")
- demo email has been set for the session
? FORGET IT
-: @contextSession.remove("email")
- The email does not longer exist in context
clear
Clears the session context from all its data.
? SET CTX SCENARIO
-: $first = "hello"
-: $second = "world"
- %first %second // output is hello world
? RESET CTX SCENARIO
-: @contextSession.clear()
- %first %second // output is %first %second
datetime
This addin helps dealing with datetime operations
isWeekDay
Determines if current day is between Monday and Friday
? HELLO
- Welcome, just a reminder that our human task force won't be available today
-| @datetime.isWeekDays()
- Welcome, at anytime, ask me if you want to speak to one of our human agent
Returns : true if current day is between Monday and Friday; otherwise, false.
isWeekEnd
Determines if current day is Saturday or Sunday
? HELLO
- Welcome, at anytime, ask me if you want to speak to one of our human agent
-| @datetime.isWeekEnd()
- Welcome, just a reminder that our human task force won't be available today
Returns : true if current day is Saturday or Sunday; otherwise, false.
isOneOfDay
days : The range of days.
Determines if current day is within the specified range of days. Accepted values are : week day number (0, 1, 2, 3, 4, 5, 6), or week day name (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) Week day number 0 is Sunday, 1 is Monday …
? HELLO
- Welcome, just a reminder that our human task force won't be available today
-| @datetime.isOneOfDay("1", "2", "3")
- Welcome, at anytime, ask me if you want to speack to one of our human agent
-| @datetime.isOneOfDay("Thursday", "Friday")
- Welcome, at anytime, ask me if you want to speack to one of our human agent
Returns : true if current week day is one of the specified days; otherwise, false.
getTimestamp
unit : The unit. (specify if “s” or “ms”)
Gets the current timestamp value based on specified unit The unit could be either s or ms. s for timestamp in seconds, ms for timestamp in milliseconds
? TIME
-: %ts = @datetime.getTimestamp("ms")
- current milliseconds timestamp is %ts
Returns : timestamp in the specified unit
fromTimestamp
timestamp : The timestamp.
unit : The unit. (specify if ‘s’ or ‘ms’)
Gets a datetime object based on timestamp and unit Available properties of the datetime object are: year, month, day, hour, minute
? HELLO
-: %time = @datetime.fromTimestamp("527079600", "s")
- The date was %time.day/%time.month/%time.year
Returns : A datetime object.
now
Gets a datetime object that is set to the current date and time of this agent. Available properties of the datetime object are: year, month, day, hour, minute
? HELLO
-: %time = @datetime.now()
- The date is %time.day/%time.month/%time.year
Returns : A datetime object
inTimeRange
from : Start time range.
to : End time range.
timeZone : The time zone. see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for a full list of available timezones
Determines if current time is between the specified range of time Time are defined in 24H format : hh:mm Timezones are defined here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
? HELLO
- hello
-| @datetime.inTimeRange("08:00", "11:00", "Europe/London")
- Good morning England
-| @datetime.inTimeRange("17:00", "22:00", "Asia/London")
- Good evening London
-| @datetime.inTimeRange("08:00", "11:00", "Asia/Ho_Chi_Minh")
- Good morning, Vietman
-| @datetime.inTimeRange("08:00", "11:00", "Asia/America/New_York")
- Good morning, America
Returns : true if current time is in the specified range; otherwise, false
entities
This addin helps extracting entities from user sentences All extracted entities are saved into scenario context
extract
entityTypes : The entity types to extract.
Extract entities from the current sentence All extracted entities are saved into scenario context
? MY EMAIL IS
-: @entities.extract("email")
- your email is %email
extractMultiple
entityTypes : The entity types to extract.
Extract multiple entities of the same type from the current sentence All extracted entities are saved into scenario context
? MY EMAIL IS
-: @entities.extractMultiple("email")
- %email.length emails in your sentence, first is %email[0]
extractFromMessageId
messageId : The message identifier.
entityTypes : The entity types.
Extracts entities from an identified message.
? MY EMAIL IS
-: %emailMessageId = %lastUserMessage.messageId
- What's your phone number?
???
-: @entities.extractFromMessageId("%emailMessageId", "email")
-: @entities.extract("phone_us")
- %email %phone_us
extractMultipleFromMessageId
messageId : The message identifier.
entityTypes : The entity types.
Extracts multiple entities from an identified message.
? MY EMAIL IS
-: %emailMessageId = %lastUserMessage.messageId
- What's your phone number?
???
-: @entities.extractMultipleFromMessageId("%emailMessageId", "email")
-: @entities.extract("phone_us")
- %email.length emails in your sentence, first is %email[0] %phone_us
extractFromText
text : The text.
entityTypes : The entity types to extract.
Extract entities from the specified text All extracted entities are saved into scenario context
? EMAIL
-: @entities.extractFromText("demo@satisfaction.ai", "email")
- The email is %email
extractMultipleFromText
text : The text.
entityTypes : The entity types to extract.
Extract multiple entities from the specified text All extracted entities are saved into scenario context
? EMAIL
-: @entities.extractMultipleFromText("demo@satisfaction.ai no-reply@satisfaction.ai", "email")
- %email.length emails in the text, first is %email[0]
escalating
This addins helps dealing with unexpected user sentences.
reset
Resets the default escalating error counter
[DEFAULT]
- Sorry I did not get that, could you repeat please?
-| @escalating.isFail("2")
- I still don't get it. You'll be transfered to a human teammate. @escalating.reset()
reset
name : The name of the counter to reset.
Resets the specified escalating error counter
[ASK_EMAIL]
- What is your email?
???
-: @entities.extract("email")
- Sorry I did not get that. {ASK_EMAIL}
-| @contextScenario.has("email")
- Your email is %email @entities.reset("ask_email_failure")
-| @escalating.isFail("ask_email_failure", "1")
- I could not get it. @escalating.reset("ask_email_failure")
increment
Increments the default escalating error counter
[DEFAULT]
-: @escalating.increment()
- Sorry I did not get that, could you repeat please?
-| @escalating.equals("2")
- I still don't get it. You'll be transfered to a human teammate. @escalating.reset()
increment
name : The name of the counter to increment.
Increments the specified escalating error counter
[ASK_EMAIL]
- What is your email?
???
-: @entities.extract("email")
-: @escalating.increment("ask_email_failure")
- Sorry I did not get that. {ASK_EMAIL}
-| @contextScenario.has("email")
- Your email is %email @entities.reset("ask_email_failure")
-| @escalating.equals("ask_email_failure", "1")
- I could not get it. @escalating.reset("ask_email_failure")
equals
current : The number or errors that are compared to the current default error counter.
Determines if the default error counter equals the specified value
[DEFAULT]
-: @escalating.increment()
- Sorry I did not get that, could you repeat please?
-| @escalating.equals("2")
- I still don't get it. You'll be transfered to a human teammate. @escalating.reset()
Returns : true if the default error counter equals the specified value; otherwise, false.
equals
name : The name of the error counter.
current : The number or errors that are compared to the current specified error counter.
Determines if the specified error counter equals the specified value
[ASK_EMAIL]
- What is your email?
???
-: @entities.extract("email")
-: @escalating.increment("ask_email_failure")
- Sorry I did not get that. {ASK_EMAIL}
-| @contextScenario.has("email")
- Your email is %email @entities.reset("ask_email_failure")
-| @escalating.equals("ask_email_failure", "1")
- I could not get it. @escalating.reset("ask_email_failure")
Returns : true if the specified error counter equals the specified value; otherwise, false.
isFail
count : The number or errors that are compared to the current default error counter.
Auto increment and determines if the default error counter equals the specified value
[DEFAULT]
- Sorry I did not get that, could you repeat please?
-| @escalating.isFail("2")
- I still don't get it. You'll be transfered to a human teammate. @escalating.reset()
Returns : true if the default error counter equals the specified value; otherwise, false.
isFail
name : The name of the error counter.
count : The number or errors that are compared to the current specified error counter.
Auto increment and determines if the specified error counter equals the specified value
[ASK_EMAIL]
- What is your email?
???
-: @entities.extract("email")
- Sorry I did not get that. {ASK_EMAIL}
-| @contextScenario.has("email")
- Your email is %email @entities.reset("ask_email_failure")
-| @escalating.isFail("ask_email_failure", "1")
- I could not get it. @escalating.reset("ask_email_failure")
Returns : true if the specified error counter equals the specified value; otherwise, false.
clear
Clear all escalating errors variables.
log
This addins helps adding log and traces
info
message : The message.
Log a message with info level
? HELLO
-: @log.info("user said hello")
- Hello
warning
message : The message.
Log a message with warning level
? NOT WORKING
-: @log.warning("maybe something is not working")
- Could you help me finding what's not working?
error
message : The message.
Log a message with error level
? ****INSULT****
-: @log.error("user is mad at me")
- I'm sorry
trace
message : The message.
values : The values.
Log a custom trace with message and values
? HELLO
-: %ts = @datetime.getTimestamp()
-: @log.trace("user said hello", "%ts", "%email")
- Hello
misc
This addins contains several usefull functions
repeat
Repeats the bot’s last sentence and continues the scenario. This addin does not returns the last sentence, see usage.
? REPEAT
- @misc.repeat()
handleSilence
timeout : Timeout in seconds before the label is executed.
label : The label to execute.
arguments : The arguments given to the label.
Executes the specified label after X seconds of user silence If timeout is invalid, the default value (2 sec) will be used
? HELLO
-: @misc.handleSilence("10", "STILL_THERE")
- Hi there, how are you?
[STILL_THERE]
- 10 seconds you didn't tell anything, are you ok?
Returns :
sendEmailFromConfiguration
recipient : The recipient.
subject : The subject. You can use a named variable instead of plain text.
body : The body. You can use a named variable instead of plain text.
isBodyHtml : whether the body is HTML or not. true/false value expected
Sends the email and uses settings knowledge file for smtp configuration. The settings: { “smtp”:{ “host”: “mysmtpserver.com”, “port”: 25, “from”: “mybot@myprovider.com”, “username”:””, “password”:”” } }
username and password are optional.
? SEND EMAIL
-: @misc.sendEmailFromConfiguration("mathias.herbaux@xbrain.ai", "subject", "body", "false")
- ok
? SEND EMAIL FROM OBJECT
-: %mailSubject = "My Subject"
-: %mailBody = "My Body"
-: @misc.sendEmailFromConfiguration("mathias.herbaux@xbrain.ai", "mailSubject", "mailBody", "false")
- ok
Returns : NOTHING
sendEmail
recipient : The recipient.
subject : The subject.
body : The body.
from : From.
isBodyHtml : The is body HTML.
smtpHost : The SMTP host.
smtpPort : The SMTP port.
username : The username.
password : The password.
Sends the email.
? SEND EMAIL
-: @misc.sendEmail("mathias.herbaux@xbrain.ai", "subject", "body","mysmtpserver.com","25","myUserName","myPassword" "false")
- ok
? SEND EMAIL FROM OBJECT
-: %mailSubject = "My Subject"
-: %mailBody = "My Body"
-: @misc.sendEmail("mathias.herbaux@xbrain.ai", "mailSubject", "mailBody", "false")
- ok
Returns : NOTHING
queue
This addins helps to keep a list of labels to execute sequentialy
enqueue
labels : The labels.
Add one or more labels at the end of the queue
? HELLO
-: @queue.enqueue("ASK_EMAIL", "ASK_PHONE", "CONFIRMATION")
- @queue.dequeue()
[ASK_EMAIL]
- What's your email?
???
-: @entities.extract("email")
- Sorry I did not get that {ASK_EMAIL}
-| @contextScenario.has("email")
- @queue.dequeue()
...
shuffle
Shuffle the current queue
? HELLO
-: @queue.enqueue("RANDOM_QUESTION_1", "RANDOM_QUESTION_2", "RANDOM_QUESTION_3")
-: @queue.shuffle()
-: @queue.enqueue("CONFIRMATION")
- @queue.dequeue()
remove
count : The number of label to remove.
Remove x label from the beginning of the queue
? HELLO
-: @queue.enqueue("RANDOM_QUESTION_1", "RANDOM_QUESTION_2", "RANDOM_QUESTION_3")
-: @queue.shuffle()
-: @queue.remove("1")
-: @queue.enqueue("CONFIRMATION")
- @queue.dequeue()
dequeue
Remove and executes the first label of the queue
? HELLO
-: @queue.enqueue("ASK_EMAIL", "ASK_PHONE", "CONFIRMATION")
- @queue.dequeue()
[ASK_EMAIL]
- What's your email?
???
-: @entities.extract("email")
- Sorry I did not get that {ASK_EMAIL}
-| @contextScenario.has("email")
- @queue.dequeue()
...
clear
Clear the current queue
? HELLO
-: @queue.clear() //In case the user says HELLO during the previous queue
-: @queue.enqueue("ASK_EMAIL", "ASK_PHONE", "CONFIRMATION")
- @queue.dequeue()
[ASK_EMAIL]
- What's your email?
???
-: @entities.extract("email")
- Sorry I did not get that {ASK_EMAIL}
-| @contextScenario.has("email")
- @queue.dequeue()
...
rest
This addins helps to make http request and store reponse in scenario context
headers
headers : The headers.
Set the headers of the current request The Headers must be a json object.
? HELLO
-: @rest.headers("""{"Authorization":"token"}""")...
- You're not authorized to be here
-| %rest.authenticated
- What can I do for you today?
body
body : The body.
Set the body for the current request
? HELLO
-: @rest.headers("""{"Authorization":"token"}""").body("""{"user_id":"%user_id"}""")...
- You're not authorized to be here
-| %rest.authenticated
- What can I do for you today?
bodyFromObject
dataKey : The data key.
Set the body for the current request from a variable in context. This will first check the contextScenario, and the contextSession if the key is not found in contectScenario
? HELLO
-: @contextScenario.create("myObject")
-: %myObject.value = "Hello"
-: @rest.bodyFromObject("myObject").post(...
- data has been posted with this : {"value": "Hello"}
Returns :
remove100Continue
remove a default header named remove100Continue
? HELLO
-: @rest.remove100Continue()...
- You're not authorized to be here
-| %rest.authenticated
- What can I do for you today?
timeout
value : The value expressed in seconds.
Set a timeout on the current http request
? HELLO
-: @rest.timeout("10")...
- ok
-| %rest_response.statusCode == 408
- Timeout
async
callbackLabel : Label to call when getting the API response
Call the rest API asynchronously, the label will be triggered when Athena will get a response
? HELLO
-: @rest.async("CALLBACK")...
- processing the request
[CALLBACK(response)]
- an error occured
-| %response.statusCode == 200
- %response.data
debug
Internal use only, requires log access.
get
url : The URL.
varName : use a variable name to retrieve the response
Executes a GET request When using variable, the content of the response is set in the data property
? HELLO
-: @rest.headers("""{"Authorization":"token"}""").body("""{"user_id":"%user_id"}""").get("http://www.google.com/admin")
- You're not authorized to be here
-| %rest.authenticated
- What can I do for you today?
? HELLO
-: @rest.headers("""{"Authorization":"token"}""").body("""{"user_id":"%user_id"}""").get("http://www.google.com/admin", "response")
- You're not authorized to be here
-| %response.data.authenticated
- What can I do for you today?
-| %response.statusCode == 500
- An internal server error occured
post
url : The URL.
varName : use a variable name to retrieve the response
Executes a POST request
? HELLO
-: @rest.headers("""{"Authorization":"token"}""").body("""{"user_id":"%user_id", "email":"%email"}""").post("http://www.google.com/email")
- You're not authorized to be here
-| %rest.authenticated
-| %rest.success
- Your email address has been set
? HELLO
-: @rest.headers("""{"Authorization":"token"}""").body("""{"user_id":"%user_id"}""").post("http://www.google.com/admin", "response")
- You're not authorized to be here
-| %response.data.authenticated
-| %response.data.success
- Your email address has been set
-| %response.statusCode == 500
- An internal server error occured
put
url : The URL.
varName : use a variable name to retrieve the response
Executes a PUT request
? HELLO
-: @rest.headers("""{"Authorization":"token"}""").body("""{"user_id":"%user_id", "email":"%email"}""").put("http://www.google.com/email")
- You're not authorized to be here
-| %rest.authenticated
-| %rest.success
- Your email address has been updated
? HELLO
-: @rest.headers("""{"Authorization":"token"}""").body("""{"user_id":"%user_id"}""").put("http://www.google.com/admin", "response")
- You're not authorized to be here
-| %response.data.authenticated
-| %response.data.success
- Your email address has been updated
-| %response.statusCode == 500
- An internal server error occured
CallRestApi
url : The URL.
method : The method.
varName : use a variable name to retrieve the response
Executes a [METHOD] request Returns :
scenario
Scenario addin helps generating analytics report for scenarios
start
scenarioName : Name of the scenario
version : Version of the scenario (Optional)
Starts a new scenario record Returns :
addStep
step : step name
Add a step to the scenario record
?! ask_weather
-: @scenario.start("weather")
- It is 23C right now
? TOMORROW
-: @scenario.step("next")
- Tomorrow it will be 19C
Returns :
addData
key : Key
value : Value
Add data to the scenario record
?! ask_weather
-: @scenario.start("weather")
-: @rest.get("weather_api", "response")
-: @scenario.addData("queryId", "%response.data.queryId")
- It is 23C right now
Returns :
end
exitName : name of the exit
Ends the scenario
?! ask_weather
-: @scenario.start("weather")
-: @rest.get("weather_api", "response")
- It is 23C right now. Would you like to know more?
? YES
-: @scenario.end("know_more")
- The sky will be clear.
? NO
-: @scenario.end("exit")
- ok
Returns :
semantic
This addin contains functions for text semantic
mostSimilarFromLastMessage
array : The array of elements.
propertyPath : The property path. Needed if the comparison is made on objects.
Compare the syntaxic distance between the last user message and elements of an array, returns the best match or none
? HELLO WORLD
- You say something similar to hello, world or hello world
???
-: @rest.get("http://www.mocky.io/v2/5bbfcb7c32000088006a3016", "stored")
-: %bestMatch = @semantic.mostSimilar("stored.data.array", "text")
- nothing matched
-| %bestMatch.success
- %bestMatch.item.id
Returns : The best match result. Contains two property: success : true if a match has been found, otherwise false item: element in the array if a match has been found, otherwise null
mostSimilarFromLastMessage
array : The array of elements.
propertyPath : The property path. Needed if the comparison is made on objects.
lowestScore : lowestScore to trigger a match (between 0 and 1)
Compare the syntaxic distance between the last user message and elements of an array, returns the best match or none
? HELLO WORLD
- You say something similar to hello, world or hello world
???
-: @rest.get("http://www.mocky.io/v2/5bbfcb7c32000088006a3016", "stored")
-: %bestMatch = @semantic.mostSimilar("stored.data.array", "text", "0.6")
- nothing matched
-| %bestMatch.success
- %bestMatch.item.id
Returns : The best match result. Contains two property: success : true if a match has been found, otherwise false item: element in the array if a match has been found, otherwise null
mostSimilar
reference : The reference.
array : The array of elements.
propertyPath : The property path. Needed if the comparison is made on objects.
Compare the syntaxic distance between the reference and elements of an array, returns the best match or none
? HELLO WORLD
-: @rest.get("http://www.mocky.io/v2/5bbfcb7c32000088006a3016", "stored")
-: %bestMatch = @semantic.mostSimilar("helo", "stored.data.array", "text")
- nothing matched
-| %bestMatch.success
- %bestMatch.item.id
Returns : The best match result. Contains two property: success : true if a match has been found, otherwise false item: element in the array if a match has been found, otherwise null
mostSimilar
reference : The reference.
array : The array of elements.
propertyPath : The property path. Needed if the comparison is made on objects.
lowestScore : lowestScore to trigger a match (between 0 and 1)
Compare the syntaxic distance between the reference and elements of an array, returns the best match or none
? HELLO WORLD
-: @rest.get("http://www.mocky.io/v2/5bbfcb7c32000088006a3016", "stored")
-: %bestMatch = @semantic.mostSimilar("helo", "stored.data.array", "text", "0.6")
- nothing matched
-| %bestMatch.success
- %bestMatch.item.id
Returns : The best match result. Contains two property: success : true if a match has been found, otherwise false item: element in the array if a match has been found, otherwise null
session
This addins contains usefull functions about session
lastMessage
Return the user’s last text message
? HELLO
- you said @session.lastMessage()
? MY EMAIL IS
-: %lastMessage = @session.lastMessage()
-: @entities.extractFromText("%lastMessage","email")
- %email
Returns : Last user text message
close
Close the current session
? GOODBYE
-: @misc.handleSilence("5","CLOSE_SESSION")
- Goodbye
[CLOSE_SESSION]
- @session.close()
id
Get the id of the session
userInfo
paramName : Name of the parameter.
Get the value of the specified key in the userInfo
? HELLO
- your external unique id is @session.userInfo("euid")
Returns : The userinfo value
addSessionObjectData
key : Key of the data
value : Value
Add data to the session object
[WELCOME]
-: @rest.post("https://example.com/register", "response")
-: @session.addSessionObjectData("registrationId", "%response.data.registrationId")
- Hello
template
This addin helps you retrieve your templates defined in satisfaction.
getTemplate
filename : The filename of the template.
format : The format applied to the content. Accepted formats are : l (remove line return)
Gets the content of the template. Returns : The template file content
sessionHandler
Contains functions to interract with the live session handler
sendIsWaiting
state : true if user is currently waiting, false otherwise.
Notify physical agents that the current session is waiting to be taken over Default Value is True
condition
findOut
intentCode :
entities :
disamb
This addins helps to handle a disambiguation
getIntentLabel
intentName : Name of the intent.
Gets the intent label
?! hello
- Are you talking about @disamb.getIntentLabel("hello")
Returns : the intent label of the specified intentName
selectIntent
firstIntent : The first intent.
firstScenarioId : The first scenario identifier.
secondIntent : The second identifier.
secondScenarioId : The second scenario identifier.
messageId : The message identifier.
Try to match an intent using the user utterance
electIntent
intentName : Name of the intent.
scenarioId : The scenario identifier.
messageId : The message identifier.
Elects the intent.
atmosphere
Contains functions for atmosphere
get
Get the atmosphere of the last message Returns : {“score”:double, “polarity”: “”} or null if an issue occured.
get
text : The text that needs the atmosphere
Get the atmosphere for the specified text Returns : {“score”:double, “polarity”: “”} or null if an issue occured.
getConversationAtmosphere
Get the conversation atmosphere Returns : {“score”:double, “polarity”: “”} or null if an issue occured.
sms
This addins helps dealing with texts
defaultToText
text : The content of the sms.
Sends the SMS.
sendSMS
text : content to attach to the sms
Send a SMS to this session, assuming it is a sip session Returns : true if delivered, false otherwise
sendSMS
text : content to attach to the sms
phoneNumber : recipient of the SMS, internal phone number format required
Send a SMS to the specified phone number Returns : true if delivered, false otherwise
sip
This addin gives several functionalities over the phone connector
hangUp
Terminate the current phone call. When combined with text, the hangUp signal is sent after the text has beed read.
? GOODBYE
- Have a good day. @sip.hangUp()
transfer
phoneNumber : The phone number.
Transfers the current call to the specified phone number.
registerDtmfCallback
digitSize : Size of the digit.
label : The label.
Registers the DTMF callback. Point to an existing label, your label should take one parameter (the digit pressed by the user)
? HELLO
-: @sip.registerDtmfCallback("5", "ON_USER_ACCOUNT_CODE")
- Hi, please enter your access code in order to access your account
[ON_USER_ACCOUNT_CODE(user_code)]
- Do you confirm your code is: %user_code
registerDtmfCallback
digitSize : Size of the digit.
label : The label.
timeout : The timeout in seconds.
timeoutLabel : The timeout label.
Registers the DTMF callback. Point to an existing label, your label should take one parameter (the digit pressed by the user) With this addin function, you can also point to a timeout label.
? HELLO
-: @sip.registerDtmfCallback("5", "ON_USER_ACCOUNT_CODE", "20", "ON_USER_ACCOUNT_CODE_TIMEOUT")
- Hi, please enter your access code in order to access your account
[ON_USER_ACCOUNT_CODE(user_code)]
- Do you confirm your code is: %user_code
[ON_USER_ACCOUNT_CODE_TIMEOUT]
- Are you still there?
userPhoneNumber
returns the phone number of the caller Returns : international phone number (+xxxxxxxxxxx)
addSpeechHints
hintKey : The hint key.
Adds the speech hints. Returns :
entityRecognition
entity : The entity type to extract.
timeout : The timeout period.
Prepare the system for an entity extraction that requires extra time.
makeCall
phoneNumber : international formatted phone number to call
Initiate a call from the agent to the specified phone number
? HELLO
- Hi, if you'd like, we can continue this conversation by phone
? YES
- Ok, what is your phone number?
???
-: @entities.extract("phone_us")
- @sip.makeCall("%phone_us")
entityRecognition
entity :
timeout :
validationTime :