I want to send the data from the frontend to the B...
# 🤝help
q
Have you checked #1132038253109837994 and #1120796649686573086 sections? Here I sent files (data) from the frontend to Botpress https://discord.com/channels/1108396290624213082/1189632494241321180
a
yes but not access the data
i want to fecth data in the Leaves section please check image and tell me what should i do
q
In the section you've highlighted with a red circle, you are sending data to the user in a Text card. Where do you want to store the fetched data? The text in that image is too small for me to understand it well.
I can also try to build something similar.
Basic idea is here

https://www.youtube.com/watch?v=FKH3b9NlyaI

a
i have tried not accessed
f
Can you try and hit publish, and then try it from your website
a
yes but it is not working can you help me for the access the data in the botpress
f
Yeah sure. Can you share your updated frontend code
a
i have send the userData, how to the access in the botpress
q
Did you check the tutorials and chatbots I mentioned?
Copy code
js
          window.botpressWebChat.sendPayload({
            type: 'text',
            text: "Here is my CV",
            payload: {
              name: inputValue,
              cv: textContent,
              fileName: fileName
            }
          })
Instead of doing it in window.botpressWebChat.init, do it like this.
There is also a bot which you can download, where everything works.
a
how to acess in the botpress
f
To access the userData you have to use the Get User Data in your workflow.
a
Can you please send the video how to send and how to access the data
here i have used the user data but not access the name those, i have sent in the code,how to the acess particular value from the userdata
f
Can you send me a screenshot of your Get User Data card, so I can see the variable that you have stored it to
f
Thank you, but that is your code. Can you send me a screenshot of your Get User Data card in Botpress
a
code is correct
i want to acess this name here how to access
i want to acess name here how to access
f
What variable did you store it in?
f
Try adding this in the text card
{{workflow.name.userDate.name}}
a
i have tried but not working
it work upto this
f
You should use {{workflow.name.userDate.name}}
That should show the name
When using it from your website
a
ok i will try
not working
can i send the video
f
Sure
f
You shouldn't use it in the emulator
You should hit publish and then try on your React app
a
yes have tried
f
Can you send me a video of you doing that
a
ok
please check
f
Try to refresh the page and then start the chat
a
yes it is working but the
here i want to show the "welcome jack black" message
but show the all the userdata
f
Use this {{workflow.userData.userDate.name}}
a
not working i have tried
userData array show the empty
but the chatbotshow the data
f
Can you try it from your website. It will be empty in the emulator but it should work on your website
a
yes i have tried
i have tried both approaches
yes it is working
f
That is good to hear!
a
we need to add the get user data card in the every where
f
You don't
It gets stored in the variable that you set
Which you can reference in that workflow
a
how to add in the another card this
welcome{{workflow.userData.userData.name}} now this is this working
i want to access the name in the another card use the same
f
You can always use this
{{workflow.userData.userData.name}}
in your workflow
a
ok and how to the create the form and send the data to the backend
f
You can use the Send Custom Event card
a
how to use this
i am not aware about that
f
You can search for "Send custom event" in the top right cornor of Discord, and then you can see all of the messages mentioning this. Then you can read about how they used it
a
ok i will try this
f
Back button for what?
a
goes to the previous menu & here i have acess the name in the first card this name i want to acess in the last leave card then show the error https://cdn.discordapp.com/attachments/1221143364276060170/1221890537104081058/workflow.png?ex=6614393d&is=6601c43d&hm=ce7e5bc124746a42387eca7f4204b026f2d1b6606e3d90e3f1b6e21f273571b2&
f
I am not sure that I fully understand you
a
thank you
user click on the Apply leave then redirct to this link http://localhost:3000/Applyleave
Please give me the solution
f
Can you export your bot to me
a
ok
in the Emulator redirect to the link but in the UI is show the error
const link = 'http://localhost:3000/Applyleave' window.open(link) i have used this for the redirecting but not working,it work in the virtual botpress
what happen bro
f
You want to use the Send Custom Event card
It can look like this
Then you want to add this to your JavaScript of your website.
Copy code
javascript
window.botpressWebChat.onEvent(
  function (event) {
    if (event.type === 'TRIGGER') {
      window.open("http://localhost:3000/Applyleave", "_blank");
    }
  },
  ['TRIGGER']
)
a
one more question
user open the bot then start automatically first time and show the first always open the bot
4 Views