Hi!
I’m trying to implement something like “gateway” in the front of my bots: use ID (currently lead ID from CRM that will use to save answers in chats) passed by URL param else use email passed by URL too else ask user to provide the email. And dispaly some friendly error messages and advices like call the support or try with another email again.
It’s very simple logic on most programming languages but I stuck with it at the Tars.
-
There are no functions for code reusing and I need to make all “gateway” gambits from the scratch on all my bots.
-
There are no variables and assigments and I don’t know how to solve situations like this:
- If
id
param passed by URL I need to referrence it as{{urlp.id}}
- if
id
param not passed by URL but finded by email with external CRM request -{{pre.getIDByEmail.result[0].ID}}
- if
email
passed by URL - referrence it as{{urlp.email}}
- if
email
not passed by URL but asked on the conversation - referrence it as{{ursp.email}}
But I want the one variable independently of request type, something like
if(urlp.id is defined) {
id = urlp.id
} else {
id = pre.getIDByEmail.result[0].ID
}
So I have the only one idea - use FaaS (AWS Lambda and so on) for all “gateway” logic and call it by API config in the Tars.
What the Tars team think and paln about this situations?