Capture user input to create tickets, make API-calls or to integrate with external services.
Captured data can be used to:
- Create a ticket in your CRM tool
- Make API-calls
- Integrate with external services
Entities vs. Any Text
The two most common ways to capture user input are by using Entities and by using Any Text.
Entities
Entities are variables you give your bot to categorize and interpret user input. Entities are great for picking variables out of sentences such as arrival city or destination city.
Any Text
The Any Text Trigger can be used to capture any text that the user types. This option does not require any AI and therefore doesn't need training examples.
You can combine Any Text with Actions to Check user input.
Use extracted data or input
Your parameter has now been created and contains a value. You can use this data to send an e-mail or to make API calls for several solutions. Have a look at our Code Actions Best Practices.
Send e-mail with extracted data
To send an e-mail with the extracted data you can use an action. In the example below the following three parameters are incorporated:
- name
- message
Make sure to extract them before sending the e-mail. Otherwise you'll be missing some valuable content.
async payload => {
var name = "-"
var email = "-"
var message = "-"
// Check if the param "name" exists
if(Array.isArray(payload.params.name)) {
var name = payload.params.name[0].value
}
if(Array.isArray(payload.params.email)) {
var email = payload.params.email[0].value
}
if(Array.isArray(payload.params.message)) {
var message = payload.params.message[0].value
}
toolbelt.email({
to: 'yourname@yourdomain.com', // <-- Vul hier een email adres in
subject: 'New message via chatbot',
message: `name: ${name}, <br/>
email: ${email}, <br/>
message: ${message}`
})
}