Lead captions
# 🤝help
b
Hello people! I am creating a chatbot and would like to ask something. This is a part of the flow where I capture leads to sent later to a webhook. Is there any way to have 3 or 4 in the same card instead of having to create one for each lead? If there are lots of users interacting with the bot it would be a lot of messages used and would like to reduce the ammount. Thanks in advance! https://cdn.discordapp.com/attachments/1231965149854695465/1231965150295232643/image.png?ex=6638dff4&is=66266af4&hm=16d17463f7d5489990c33df250d7ed16e4c5b9b15559bb74fcecd56b623ba9eb&
f
100%. Schemas are perfect for this https://botpress.com/docs/cloud/studio/schemas/

https://www.youtube.com/watch?v=LYyZLFN5SWI&t

f
Its for everyone
You will have to create a schema first
Roberts video shows you how to do it
b
as Decay says, you can use schemas (which you'll have to create first before setting them as a variable type)
alternatively, you can also do this using an AI task, which might be simpler to set up, but is a slightly more brittle solution as it relies on an LLM to parse the information for you
I also show how to do that in the video!
b
Alrightttt, I got it, I though the scheme was already created. I have created myself and it works great. Thank you very much guys!
b
fantastic!
b
f
Yup, but you don't need an AI task for that. You can just do it with an execute code card to same you some money 🙂
b
But how would the system be able to determine the proper text it has to be included in the variable? I thought the AI was the responsible one for extracting the variables correctly. Mine have to be interpretated to be stored. I think the AI task would be a good thing there. The problem is as {{event.preview}} takes just the last answer, I can't store them all
How could I do it Decay? Thanks!
f
Doing school work right now, but I can build a simple example later 🙂
b
Thanks mate. I appreciate it! This is my schema. What also happens now is that the data is sent to the webhook, but it's blank 😦 https://cdn.discordapp.com/attachments/1231965149854695465/1232005917331947581/zui.txt?ex=663905ec&is=662690ec&hm=57ec3afa08ecb561b431ef6e59926da032cb2d535c3d218768dacbfded23bd46&
This is the webhook code, but as I changed they way to make the variables it doen't work. Don't really know how to change it. Tried using chatgpt, but it gets it wrong https://cdn.discordapp.com/attachments/1231965149854695465/1232006514974130289/zui_code_webhook.txt?ex=6639067a&is=6626917a&hm=42ce0819ca01d97d84cdbe74cd500dde20634e46758eb3ad08f4744357c331b3&
f
You should create a new help post about that last issue
b
On it!
I could fit ix with Claude. I now need a little help with the zui schema problem hehe.
f
Okay
You can push it to an array or object, depending on the kind of structure that you need
If your variables are a list of values and you don't need to reference them by name, you can use an array.
If you need to reference these variables by name, it might be better to use an object. This allows you to assign keys to each value, making your data easier to manage
Code for object:
Copy code
javascript
workflow.combinedObject = {
  name: workflow.name,
  age: workflow.age,
  isStudent: workflow.isStudent,
  favouritePlatform: workflow.favPlatform
}

console.log(workflow.combinedObject)
console.log(workflow.combinedObject.name)
console.log(workflow.combinedObject.age)
console.log(workflow.combinedObject.isStudent)
console.log(workflow.combinedObject.favouritePlatform)
https://cdn.discordapp.com/attachments/1231965149854695465/1232035194450612356/image.png?ex=6627fdb0&is=6626ac30&hm=f6dc78cd7820ac10e7448ee4b25f6b8fccc9f1f62fca8920e7e9962e6a930614&
b
Damn... I wish I knew more... Everything sounds a bit greek to me haha.
f
Code for array:
Copy code
javascript
workflow.combinedArray = [workflow.name, workflow.favPlatform];

console.log(workflow.combinedArray)
console.log(workflow.combinedArray[0]);
console.log(workflow.combinedArray[1]);
https://cdn.discordapp.com/attachments/1231965149854695465/1232036503350149200/image.png?ex=6627fee8&is=6626ad68&hm=e7005216f3e551f790bd87de281be43b4ae3dc241221820e771405480107c84b&
b
Currently I have this but. In all the leads I have all information that I need (13 or 14 leads). Then a code that should get all leads and merge them in one, but it is nor working https://cdn.discordapp.com/attachments/1231965149854695465/1232036504948179044/image.png?ex=6627fee8&is=6626ad68&hm=39b7e77a5ca09535d6050d47c52711c0643bc0b7111d05e92d134a712655ceee&
f
You can just ask ChatGPT to explain it.
b
But what you have sent me is individual cards, right? But if I wanted to extract, let's say in the first raw input card the name, email and phone number, then in the second card age, height and weight and so on. How could I do it?
And then the .Person variable would store all infontmation with an AI Task telling the variable what to store and which is which
f
Ah okayt
Probs just schemas
Like you are doing
Save them all to variables
Different
Then use the AI Task to take all of the information from the variables and store it in a schema
Let them all be strings
The variables
Except the one that the AI Task should output the information to, it should be a Schema, like Robert showed
b
I did. They all have different variables as the picture shown above. lead1 to lead6. and then I created the .Person variable with the schema and all data I need to pull (name, email, number, etc).
But somehow it doesn't work. I'm doing something wrong, but I don't know what it is. Maybe giving wrong instructions to the AI Task
f
Did you watch how Robert did it?
b
I did. I tried it with individual cards and it worked. But the problem comes when there are multiple leads to get from one card
f
What is the variable type that you are storing each variable in?
b
They are all string
f
Do you get any errors?
And can you try and use a similar prompt to what Robert used
the AI task has the store result in variable: workflow.Person
f
Take a look at how Robert set up the input.
b
I did Decay. The task instruction is the same he used. But on the AI Task input I can't use {{event.preview}} becuase I have 6 leads and the event.preview just gets the last iteraction. I tried with chatgpt and claude, but they coulnd't help, nothing worke 😦
Now not even following Robert's tutorial works. Not even the same he was doing it in the video. I did exactly the same. Before it worked and now it doesn't. There must be some kind of bug
f
You have to use workflow.lead