https://discord.gg/botpress logo
Associate intention with name
# 🤝help
f
Greetings. I added an intent (2723) on a node that leads to another node that has a name capture card, but..... how do I associate the intent with the name card? For example 2723 (Intent) to be equal to Camilla.
e
Hey @flaky-receptionist-85416 I can help bind intent 2723 directly to the "Camilla" value in the name capture node using slot-filling or custom payload mapping—depends on your setup. Could you confirm the platform you're using (Dialogflow, Rasa, etc.) and if the name card has predefined entities?
f
Cool, first time I hear about custom payload mapping. I'm working on botpress and no, I don't have predefined values on the name capture card.
e
Nice! In Botpress, we can link intent 2723 to the name "Camilla" by adding a condition in the transition flow and using a variable update action. I can help you get that done. Quick q: should “Camilla” always be assigned when intent 2723 is triggered, or does it vary?
f
Right, I want to replicate the idea for future entries, for example: 2723 = Camila 2724 = Vanessa , etc
e
Perfect @flaky-receptionist-85416, We can create a mapping object (like
{ 2723: "Camila", 2724: "Vanessa" }
) and use a custom action to assign the correct name based on the triggered intent. Want me to mock up a reusable action code snippet you can plug into Botpress?
f
It would be great to have this code, it would be very useful for me.
e
Awesome! Here's a reusable Botpress action you can drop in: // actions/mapIntentToName.js const intentNameMap = { '2723': 'Camila', '2724': 'Vanessa', // Add more mappings as needed }; const intentId = event.nlu.intent.name; if (intentNameMap[intentId]) { temp.userName = intentNameMap[intentId]; } else { temp.userName = 'Unknown'; // fallback } This sets temp.userName to the mapped name. You can now use {{temp.userName}} in your flow. Let me know if you’d like it triggered automatically or need help integrating it in the flow!
f
One question, I use the code in a code execution card before the name capture card, right?