Functions and variables


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.

  1. There are no functions for code reusing and I need to make all “gateway” gambits from the scratch on all my bots.

  2. 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 {{}}
  • 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 {{}}
  • if email not passed by URL but asked on the conversation - referrence it as {{}}

But I want the one variable independently of request type, something like

if( is defined) {
 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?


Have you seen this?

Yes, but it’s doesn’t relate to my sutuiation.

@mvs The thing that you want to achieve, as i understood from your description, can be achieved from the conditional jump feature. You need to make the proper conditional branches in an initial gambit and then make seperate set of gambits, which will pull the ID data, either from URL param or from the API call.