cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Guides

Learn more about specific Flow features
Filter
Filter by Labels
Select any of the labels below to filter results.
Filters applied...
Sorted by:
Using SMS text messages it’s easy to start a conversation with customers. Some use cases are: Send a notification, like a delivery update Deflect a phone call to text messaging Bulk send a message to customers What you need To get started you’ll need the following: A Khoros instance that is connected to a phone number A registered bot user within the Khoros instance A Flow.ai account and organisation Getting started To start sending outbound messages you’ll need to connect Flow.ai with Khoros, configure the Flow.ai REST API and add a flow to trigger. 1. Connecting Flow.ai with Khoros Login into your Flow project Go to the Integration section Add a new Khoros integration within the customer service section Choose a bot name Provide the bot username and password (please contact Khoros support to create a bot user for your Khoros instance) Add your company key (check the Khoros developer settings to find the name) Choose the correct region (ask Khoros support if you do not know the region of your instance) Choose SMS as the channel Add the phone number connected to Khoros as the external ID Add the same phone number in the phone number field Add support@flow.ai as the contact email address Please see the installation documentation for more information. 2. Configure the Flow.ai REST API Using the REST API you can make a direct broadcast call to Flow.ai using a customer phone number (MSISN) that would trigger a specific flow. That way you can send text messages to customers through the Khoros SMS integration. Go to the organisation settings screen (top right) Choose “API Keys”. If you do not see this item, you do not have sufficient permissions for the organisation. Please contact the owner of the Flow.ai organisation. Create a new API key (choose the default settings) Go back to the project and open up the integration overview.  Add a new REST API integration Choose the API key from the dropdown and press save Copy the REST API token and store it for later usage 3. Creating a Flow to trigger We have everything ready to trigger a flow that will send an outbound message to a user. The only thing missing is a flow to trigger. Simply add a new flow and make it start with an event. For example name the event:  Send SMS . Below the event, drag and drop a text reply. Add some text like:  This is a test message Save the flow. Now we can test the entire setup! Testing You can test the broadcast using a CURL command to make a call to the REST API. The following is an example of a CURL command: curl --location --request POST 'https://api.flow.ai/rest/v1/broadcast/instant' \ --header 'Content-Type: application/json' \ --header 'Authorization: sk_ab12abcd9876543210abcdefgh012345' \ --data-raw '{ "audience": [{ "name": "John Doe", "phoneNumber": "+1234567890" }], "channel": { "channelName": "khoros", "externalId": "+0987654321" }, "payload": { "type": "event", "eventName": "Send SMS" } } ' Replace the information: Name Description API_TOKEN Rest API token copied in step 2 CUSTOMER_NAME Name of the customer (or  anonymous ) CUSTOMER_MSISDN Valid phone number in international format KHOROS_EXTERNAL_ID Khoros external ID (phone number) EVENT_NAME Event name of the flow to trigger curl --location --request POST 'https://api.flow.ai/rest/v1/broadcast/instant' \ --header 'Content-Type: application/json' \ --header 'Authorization: API_TOKEN' \ --data-raw '{ "audience": [{ "name": "CUSTOMER_NAME", "phoneNumber": "CUSTOMER_MSISDN" }], "channel": { "channelName": "khoros", "externalId": "KHOROS_EXTERNAL_ID" }, "payload": { "type": "event", "eventName": "EVENT_NAME" } } ' Troubleshooting Check the notification overview in the top right for any errors Check the Flow chat logs, choose “All messages” to view any inbound and outbound REST API calls
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
249
Import contacts and broadcast messages via your favorite messaging channel.  Ever thought about uploading a list of contacts so you can broadcast a message? If not, you should! It is a great way to engage with your customers by using their favorite messaging channels. Think about receiving a WhatsApp message or SMS when you've processed a new order. In this guide, we will show you how to upload a list of contacts and send a broadcast. If you already have a modern CRM system in place, you can even automate more! With webhooks and our broadcast API, you can even automate the complete process but for now, we focus on uploading a list of contacts in 3 steps: Create a CSV file Import your contacts Use import fields in the message content In our article about the broadcast feature, we will dive deeper into the broadcast functionality. 1. Create a .csv file To import your list of contacts make sure your file with contacts is a .csv file. Within that .csv file, the comma will be seen as the separator. Your file should include at least the following requirements: Required fields The .csv file that you want to upload should have at least the following 5 required columns: full name phone number first name last name language Additional field In addition to the required field, you have the option to add additional fields that you can use in the content of your messages. These fields will be stored as metadata. Let's think about the broadcast after an order. In that case, you might want to include fields like an address. Make sure to include the text 'metadata' in your header as indicated below. full name,phone number,first name,last name,language,metadata mykey Finn Haley,+380997605518,Finn,Haley,NL,myvalue 2. Import your contacts You can now import your file. Head over to the audience section, click on the plus icon, and select import. You can select and upload your .csv file. After that pick a channel and click on the import button.     3. Use import fields in the message content The next step is to use the content of the uploaded file to tailor the content of each message. We can do that by using string templates. To use string templates you can user double curly brackets to open "{{" and double curly brackets to close "}}". You can pick some of the following options: {{user.profile.firstName}} {{user.profile.lastName}} To use the additional fields you should include metadate: {{user.metadata.address}} You can now schedule your broadcast from the broadcast section.   Happy Broadcasting
View full article
by Khoros Staff Khoros Staff Dec 20, 2022
Labels (1)
  • Flow Guides

0
251
After designing your chatbot it is recommended to test the experience on WhatsApp. Read how you can test your WhatsApp chatbot with your own mobile phone.       WhatsApp for Business is a channel with great potential for customer service and marketing. To reach this potential is important to create a chatbot business case and to test your conversational experience. You can test your WhatsApp chatbot in 2 ways: The 'Try it out' window in Flow.ai WhatsApp Testing Testing in "Try it out" If you are logged in into the Flow.ai platform you will find a button above with the text "Try it out". Here you can directly test your bot. This functionality is mainly used during the design process. WhatsApp Testing Is your chatbot design ready for WhatsApp native testing? Then head over to the integration section and select WhatsApp. There, you can enter your own mobile phone number. Your number is now connected to your chatbot. Now select 'WhatsApp' next to the 'Try it out' and send a message to your bot. If you do not use WhatsApp for desktop, you can also send a WhatsApp message via your phone to: +316 335 679 93 You will now experience how your chatbot behaves in WhatsApp without requesting access to the official WhatsApp Business API. If your prefer testing with multiple employees, simply add their phone numbers and they're good to go.       Ready for Launch When your bot is ready for an official release, you can request access from within Flow.ai. Head over to Integration section and select Request Access from the WhatsApp integration and our team will contact you.
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
262
Use Facebook's m.me link to boost your brand. 1. What are m.me links? Facebook Messenger's m.me links are links that allow you to directly start a conversation through Messenger. By clicking that link a chat window will open within messenger, ready to type a message. These links even allow you to trigger a specific event from your Flow design. These m.me links allows you to boost conversion and works on smartphones as well desktops. 2. How to create m.me links? Messengers m.me links all have a similar format where PAGE_NAME is the Facebook page the bot is linked to. Let's take Flow as an example: http://m.me/<PAGE_NAME> https://m.me/theflowai On top of that we can also trigger an event that is designed in your Flow project: http://m.me/<PAGE_NAME>?ref=<EVENT_NAME> http://m.me/theflowai?ref=TEST_DRIVE Make sure to enable a getting started button from your messenger integration settings in Flow. 3. How to use m.me links?     These m.me links are great for redirecting to a specific event or flow in your design. Also you will receive some data of the user. This allows you to: Create personal experiences Boost conversion Let's imagine you have a Facebook Ad running to pre-order your newest products. The current call to action is to visit your home page or a specific landing page. Now what if they could pre-order your product within messenger without entering all their contact details on that website. By using a conversational pre-order process in messenger, you can already fill in data that you have from their profile, reducing the steps to pre-order your product. The easier and faster your process, the higher your conversion.
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
263
One of the challenges that many companies face when starting with AI chatbots and conversational interfaces is the channel that they want to integrate with. At Flow, we encourage you to be there, where your customer wants you to be in a channel-agnostic way. Being channel agnostics means that you are focussing on the message and person that you want to deliver your message to and not thinking in channels. To enable companies to design omnichannel experiences we’ve launched our channel-specific design.     Channel-Specific Design Creating 1 chatbot to rule all channels sounds great, and it is, but… Each channel has its own advantages and disadvantages. Take WhatsApp for example, in Europe that is the most popular messaging channel which offers a lot of potential for customer interactions. On the other hand, WhatsApp does not support Cards, Carousels and buttons. For reference have a look at the pros and cons of a WhatsApp chatbot. Those Rich UI elements like buttons, cards and carousels, can enhance the Customer Experience and are supported in Facebook Messenger and the Web Widget but not in WhatsApp. That means that if you’re using these elements, you should alter your workflow for WhatsApp. And there we go, our Channel Specific Design feature is here to help! Create an omnichannel chatbot in 3 steps 1. Enable Channel Specific Design After enabling Channel Specific Design in the Project settings you can start using the feature from within the Flows sections. So head over to Flows! 2. Create shared elements Within the shared tab, you can only drag & drop elements that are supported by all your selected channels. In our example, text replies is one of the elements that is supported by WhatsApp, Messenger and Web so let’s drag and drop that onto our canvas. 3. Tailor to each channel specific After creating shared elements, we can now start tailoring the elements to each channel. Let’s have a look at the Web Widget that supported rich UI elements such as cards and buttons.       As WhatsApp does not support these cards, buttons and carousels we can now easily alter the workflow with elements that are supported by WhatsApp such as text.     Test your Omnichannel chatbot We know it’s exciting but don’t forget to test your experience properly. You can ask colleagues and friends to try it out on different channels. Try it out with WhatsApp Testing or share the Web Widget URL. After testing, improve your bot and repeat the process until it’s ready for a first launch!
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
257
Cloud code actions provide an easy way to make your bot truly dynamic. These are some of the best practices we like to share. Use async Cloud code is a single JavaScript (ES6) function. We advise everyone to write async functions. async payload => { // your code there } Before, you had to write nested code with callbacks. Using async allows you to write better readable pieces of code. // The old way (function(payload) => { request('https://awesome.org/1') .then(response1 => { // Do something with the first response request('https://awesome.org/2') .then(response2 => { // Do something with the second response }) .catch(err => { console.error('Error', err) }) }) .catch(err => { console.error('Error', err) }) }) Async functions allow you to write simple code like: // The old way async payload => { try { const response1 = await request('https://awesome.org/1') // Do something with the first response const response2 = await request('https://awesome.org/2') // Do something with the second response } catch(err) { console.error('Error', err) } } Keep it short and simple It's better to break up different actions. Check if a parameter exists Optional parameters can be empty! Always check to see if they are present or not. Since a parameter are always lists (arrays) you can use something like: if(Array.isArray(payload.params.myparam)) { // We have a param } Use return instead of reply The  reply()  method is only intended for callback functions. If you can try to use the  await  calls and return messages instead of using the reply method. Use triggers instead of messages Using triggers as much as possible for static content allows you to keep all content inside the flows editor. This makes it far easier to build cross-language code and maintain it. Read more on the Code-based actions:  Channel specific flows Conversational Calculator How to use Math in your Chatbot Create a location-aware chatbot and find the nearest store locations around the user Create quick replies in Cloud Code Actions How to add a delayed opening to the web widget How to build a chatbot quiz for WhatsApp How to catch API errors within Code actions How to check and verify user input How to check if an object property is undefined How to create a dynamic opening based on the part of the day How to create a Dynamic URL How to create a Webview in 3 steps How to let your bot handle images in 3 steps How to retrieve data from a database How to retrieve filtered values from an external database with multiple properties How to route back to the last flow or event How to route your chatbot for numbers that are greater/less than or equal to a specific number How to send a confirmation of receipt by email How to send chatbot data to a database How to send emails to multiple recipients How To Use Dynamic Google Maps Images How to use QR codes for AI chatbots on Web, Messenger, and WhatsApp How to use Javascript Comments in actions How to Store Parameters The easiest way to capture and validate an address Where to find your Organization ID Working with dates How to add a Web Widget to your Wordpress website How to check if the user is on mobile or desktop pc How to check if the user is on the homepage or a specific page How to combine functions in Javascript How to set profile attributes when a user is anonymous  
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
294
Change your flows based on the channels of your user Flow is able to connect with multiple channels. Each channel has it's own strenghts. The strenghts of a channel like Facebook Messenger or WhatsApp is that you will already receive some user data that you can use while this is not the case when using the Web Widget. A common case where it is recommended to change your flows based on the channel of the user is within Customer Service. When your user reached out through the Web Widget, that person is still anonomous. Therefore you might want to ask for name, e-mail and phone. On the other hand, if a users contacts you through Facebook Messenger you will receive user data so that you can get back to him later. Check the user's channel Let's start by checking the channel of the user. Drag and drop an action onto you canvas and use the code below. The code below checks if the channel of the user is messenger or if it the web socket. If the channel of the user is messenger, then we'll trigger an event called 'Channel-Messenger'. If the channel equals socket, then we'll trigger an event called 'Channel-Socket'. async payload => { let channel = payload.channelName if(channel === 'messenger'){ trigger('Channel-Messenger') } if(channel === 'socket'){ trigger('Channel-Socket') } } Create channel specific flows Make sure that you channel specific flows start with an event and make sure that the name of that event is equal to the name in your cloud code. In this case that is 'Channel-Messenger' and 'Channel-Socket'. Design your channel specific flows and depending on you channel, you can extract data of the user by using entities. Other channels Besides the example above that covers the "messenger" and "socket" channel you can also use the following channels. channels = ["alexa","events-webhook","google","mavenir", "rbm","rest","telegram","whatsapp"]      
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
211
Learn how to divide, multiply, add and subtract with your chatbot and go beyond simple tasks like answering questions. Why to use math in a chatbot If you really want to go beyond simple chat bot functionalities like understanding simple questions, you might want to use math in your chatbot. When your AI bot understands math, various new possibilities arise, depending on your use case. Let me give you some examples: For chatbots in the hotels & hospitality industry, you could have a standard rate per night. Then you could ask the user for how many nights they would like to stay and multiply that with the rate per night to inform them about the total costs. Restaurant chatbots could use math for determining the group size of a booking. If somebody says something like “I’d like to book 2 tables for 4 persons each”, the bot can understand that it will be about 8 persons in total. You could even use math for personal trainer fitness bots:   Different types of math In this guide, we will teach you how to implement 4 types of math in your chatbot: Multiplying Dividing Adding Subtracting Different Types of Math Questions The first step is to create an intent that detects when somebody wants the chatbot to calculate something. Someone could ask a generic question, like “Do you understand math?” or “Can you calculate something for me?”. If that’s the case, you could simply let the bot ask for what it should calculate. Sometimes the user already gives some more specific information about the math question, like “What is 8 divided by 4?” or “8/4=?”. In that case, you can make your calculator chatbot already save that information, so it won’t have to ask again. This is better for the user experience since it reduces the amount of needed effort from the user. Creating a Math Intent Now we discussed some ways people can let the bot know they want it to solve their math problem; it’s time to create an intent for it: You can see the intent is using 3 entities: number_first number_second math The first and second numbers in the intent are separately captured because for dividing and subtracting, you’d need to know which number should be divided/subtracted from the other number. Both number-entities use the default system entity for numbers. The Math Entity The third entity (math) is a custom entity. It contains the 4 types of math we already discussed briefly, along with some synonyms for them:     Requiring all Entities Now we have the entity and the intent in place, it’s about time to look at the actual flow. All 3 entities will need to have a value to enable the bot to solve the math question, so the first step is to set all of them to be required:   This will add sections underneath the intent for when one of the entities isn’t known after matching the intent. Click on all of them and add a Text Reply that instructs to give it a value. Mathematical Conditions Since we have 4 types of math, we need to add 4 conditions that check which type the chatbot should use. The image below shows how to check with a condition if the math type is “Minus”. Do the same for “Multiply”, “Divide,” and “Plus” in the other conditions.   Also, add a 5th Else condition without any rules, so we can give an error message when the bot wasn’t able to match any other condition due to some unforeseen problem we missed. String Templates Now it’s finally time to actually implement the math itself. This is easier than you might think! We will simply use String Templates. To calculate the value of the entity number_first minus the value of number_second, use the following String Template: {{number_first.first.match | minus: number_second.first.match}} If you change “minus” to the other math types, you get the following flow:   Resetting parameters When we now test our flow twice, you can see the second time it doesn’t work correctly yet. The parameter number_first still contains the value from our first test.     That’s because we haven’t reset the parameters before giving them new values. Simply solve this by resetting the values after each response, as shown in the image below.       As you can see, the problem has now been solved!     And that’s how you teach math to your chatbot!   Learn More There are way more possibilities with String Templates, so have a look at our documentation if you want to learn more. You can also join our free Slack Support Channel. It’s a great place for getting inspired and asking questions about your chatbot project!
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
409
Learn how to use the location of your users to find the nearest store locations   Is your chatbot able to handle tasks based on your customer or client's location? No? Then it's time to take your bot to the next level. Imagine a virtual assistant on WhatsApp or Facebook Messenger that is able to tell your customer where the closest repair service, servicepoint or collectionpoint is. In this knowledge base article we will demonstrate how to use the location of the user to find the nearest store. To find a store or location that is closeby, we will need two things: Location or Address of the User Store Locator API 1. Location or Address of the User Within Flow you can use the Location trigger and an Any Text trigger to obtain input that we can use. Even though sharing a location is cool, some users prefer entering an address as they don't want to share their current location. Therefore, it is recommended to use both options. As most store locators work with the latitude and longitude as input, we need to convert a shared location or an address to a long and lat value.     Location When using the Location trigger you will receive the lat and long values. Read more in our location docs or use the code below to create an Action and convert the location of the user to a lat, long value. async payload => { var lat = "-" var long = "-" // If the user shares location if(Array.isArray(payload.params.location)) { lat = payload.params.location[0].value.lat long = payload.params.location[0].value.long } Address A second option to obtain the long and lat value is use an address entered by the user. But how do we convert that into a long and lat value? A fairly simple solution is to use the Google Maps Geocoding API. Have a look at our article about using the Google Maps Geocoding API or use the code below and add it to your existing Action. if(Array.isArray(payload.params.address)) { try { const { params, user } = payload const { address } = params const lastAddress = address[address.length - 1].value // For this example we show the API key in code // but best practice is to use Configuration // https://flow.ai/docs/actions/code_configuration const key='YOUR SECRET API KEY' // Construct a Google API URL const url=encodeURI(`https://maps.googleapis.com/maps/api/geocode/json?address=${lastAddress}&key=${key}&language=${user.profile.locale || 'en'}`) // Call the API const { data } = await request(url) const { status, results } = data lat = results[0].geometry.location.lat long = results[0].geometry.location.lng } catch(err) { console.error(err) // This is not good.. reply(new Message('Here you will find the closest stores: https://flow.ai/')) } } 2. Locate the nearest store Now, we've got our long- and latitude values, and these values can be used to find a location near the user. At this point you've got 2 options: use an existing API of your company or calculate the distance to the location yourself. Some things to keep in mind during your design: Make sure you sort your results based on distance Display one or multiple results Display multiple results in Carousel (if Supported by your channel) Cover edge cases Store Locator API Some retailers already have a store locator API in place. If that's the case you should be able to make an API call to that service and include the user lat- and longitude. A store locator API usually returns an array of available locations that need to be mapped to a text reply. Calculate distance within Flow Not all companies have a Store locator API in place. No worries we can calculate the distance in the same Flow Action as it allows you to create advanced logic. To calculate the distance between 2 objects you will need the lat- and longitude of both objects. A simple database that contains locations as rows would be sufficient here. We can retrieve locations with their long- and latitude and calculate the distance between the user and the location by using the function below. For reference have look at geodatasrouce. // Function to calculate distance function distance(lat1, lon1, lat2, lon2, unit) { var radlat1 = Math.PI * lat1/180 var radlat2 = Math.PI * lat2/180 var theta = lon1-lon2 var radtheta = Math.PI * theta/180 var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta); if (dist > 1) { dist = 1; } dist = Math.acos(dist) dist = dist * 180/Math.PI dist = dist * 60 * 1.1515 if (unit=="K") { dist = dist * 1.609344 } if (unit=="N") { dist = dist * 0.8684 } return dist } Map result to text reply After having an array of location sorted on distance to the user, we can map these results to text reply. // Map sorted array of objects to reply // Fallback default var message = (`To find a location have a look at www.flow.ai`) // Bij gevonden locaties if (arrOfObj.length > 0) { message = (`These are the closest locations:`) for (var i in arrOfObj) { message += `\n ${arrOfObj[i]["City"]}, ${arrOfObj[i]["address"]}` } } reply(new Message(message)) Covering any edge cases Your API, both the Google API and your Store Locator API might work while testing but what do you do: If the API returns an error If the API did not give any valid results If the API returns us multiple addresses In the example code above we simply return a text message with a link. With that link the user is still able to find the nearest store him or herself. Read more Working with locations Creating code actions Google Maps Geocoding API
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
159
Quick replies are buttons that you can add to a reply to improve the Customer Experience. You can add quick replies in the "Flows" section or within cloud code actions. This article will focus on adding quick replies by using actions. Quick replies in Cloud Code Actions The following code is an example of a text with two quick reply buttons. async payload => { const text = new Text('We have a 40" screen for sale. Want to preorder it?') text.addQuickReply(new QuickReply({ label: '👍', value: 'Yes' })) text.addQuickReply(new QuickReply({ label: '👎', value: 'No' })) const message = new Message('Fallback text').addResponse(text) return message }  
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
181
An interaction between bot and user can be initiated by the user and by the bot. When you want your bot to initiate the conversation you can use the the 'Auto open' or 'Auto send message' scripts as described in our Web Widget docs. A more advanced technique is to initiate a conversation after 5 or 10 seconds. When your user is on your page for longer then 5 or 10 seconds this could be a user that: Cannot find what he or she is looking for Is interested in your product or services Why not add the right moment to your engagement strategy? The following script can be added to your page to open the web widget after 5 seconds and trigger the event 'Opening'. Make sure to change the event name in your script or within your flow design. <script> setTimeout(function() { __flowai_webclient_app.open() }, 5000) // 5 secs window.__flowai_webclient_autoTriggerEvent = 'Opening' </script>
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
146
Learn how to to build a chatbot quiz for WhatsApp, Messenger, and web Create your own quiz chatbots and engage with your users on WhatsApp, Messenger, Web or other channels or simply download the quiz chatbot template. Quizzes are a great way to engage with your users as a good quiz increases the customer journey. A second use quiz can we find in product recommendations. I wouldn’t really call it quizzes but based on the input of the user you can do some great product recommendations. If you are looking for a way to create a quiz bot or a way to use the input of a user for a follow-up workflow then this article will help you out. We will create a quiz bot that is able to: Ask questions Check answers Save answers Quiz chatbot Template Two concepts that we’ll be using here are capturing or extracting user input and conditions. Asking questions The first step is to onboard your users. WhatsApp click-to-chat links are great for onboarding, you can even combine them with scannable QR-codes. When using Messenger or Web you can directly trigger events within Flow. Now we can get started with the quizzes. Text replies can be used to ask a question. We want to extract the user’s answer and save it as a parameter and we can use the Any Text Trigger for that! Let’s have a look at three types of questions: Open Questions True/False Questions Multiple Choice Questions Open Questions The image below shows you how to use a ‘text reply’ to ask a question and an additional ‘any text’ trigger to extract the answer of the user.   True/False Questions A True/False question is quite similar to in terms of your design. When designing for Web, Messenger or Telegram you could add quick replies to improve the customer experience.These quick replies or buttons are not supported by the WhatsApp channel.     Multiple Choice Questions Last but not least, we’ve got multiple-choice questions. These types of questions are created by using Webviews. You can use them at WhatsApp, Web, Messenger, and Telegram.      Checking answers So far we’ve asked questions and we’ve stored the answers in a parameter by using the ‘Any text’ trigger. To check if the answer is correct we can use Conditions. What are conditions? These components are if/else statements and allow you to check if the answer is correct. If the answer is true, then we proceed with the correct branch. Else, we proceed with the incorrect branch. If you would like to loop back and ask the same questions again before proceeding, have a look at looping flows.  Store answers Checking answers can be enough. But if you’re want to create some sort of report you’ll need to store these answers somewhere. This option is quite extensive as it all depends or what you would like to do with these answers. For product recommendations and interacting with other services, you can use Actions to connect with your own API or you can use the existing Zapier integration to fill e.g. a Google Spreadsheet. Quizbot Template You can find the template that belongs to this article within the Flow platform. Head over to the login page. Create a new project and add the Quiz Chatbot from the available templates. Can't find it? Make sure to your Brains set to English (see Project settings -> Brains).
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
790
Code actions allow you to make API requests. Sometimes these requests fail and you want to get more info to see the reason that caused the error. API errors can be caught within code actions using a simple try catch block. Within the catch the error object holds any request information, including an optional response sent by the server. The following code demonstrates how you can handle different error states. async payload => { try { // Make a request const result = await request.get('MY API ENDPOINT') // ... } catch(err) { if (err.response) { // The request was made and the server responded with a status code // that falls out of the range of 2xx console.error('Failed with response', err.response.data) } else if (err.request) { // The request was made but no response was received console.error('Failed request', err) } else { // Something happened in setting up the request that triggered an Error console.error('Failed in general', err) } } }
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
144
For several cases it you might want to check the user input before proceed. A case that we encounter often is a check for the order number. A number verification or check can be created in flow before proceeding the process. To create a verification step you'll need data to verify and some verification rules. Data to verify First, we'll need some data that we can verify. You can use entities to extract parameters or you can use the complete user query. For more information about parameters please consult Params docs. Verification rules To verify your data you'll need a couple of rules that you'll implement. When have your rules in place, you can translate them to Java script code within actions or cloud code. In this example we got the following rules for the parameter: The parameter is between 7 and 12 characters The first 4 characters consist of "2019" or "2020" If correct, trigger the event "filenumber correct" If incorrect, trigger the event "filenumber incorrect" Make sure to create an event with the corresponding names otherwise you'll be stuck within the action code. const filenumber = // use input query or param here const years = [`2019`, `2020`] if(filenumber.length > 7 && filenumber.length < 12 && years.includes(filenumber.slice(0,4))){ trigger('filenumber correct'); } else { trigger('filenumber incorrect'); }
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
265
In JavaScript you can check if the property of an object is undefined. Based on the outcome you can adjust your flows. Within your chatbot you can work with several objects that contain properties. Based on these properties you can adjust your flow. Consider the following example: You customer service bot is available as a Web Widget and is active in two places: Behind a login On your home homepage (no login required) When the chat between end-user and bot requires a handover or takeover, you might want to adjust your flow based on the information that you have from your end-user. In the case where the hand-over is behind a login, you will be able to get back to the end user as name and email is visible for you. When the user enters the handover from the homepage, his or her profile is undefined and you might want to ask for his or her first name and e-mail address. The  typeof  operator You can use the  typeof  operator in JavaScript to check the type of an object property. The  typeof  operator will return a string that contains one of the following: "object" "string" "number" "undefined"   In the following example we will adjust our flow based on the user's email address. If the email address of the user exists (e.g. "crew@flow.ai"), the  typeof  operator will return 'string'. If the user is Anonymous it will return 'undefined'. If the returned value is a string we can assume that the email address is known. Therefore we trigger an event "Profile-Known". If the returned value is not a string, it can be an object, number or undefined. In that case we trigger an event "Profile-Unknown". Make sure to create events that match those names in your design. async payload => { // check if a string will be returned if(typeof [payload.user.profile.email][0] === 'string') { // Trigger an event trigger('Profile-Known') } else { // Trigger other event trigger('Profile-Unknown') } }
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
140
Personalize the experience and tailor opening messages. A general opening is great but with Actions, you can personalize the experience even more. One of our power-users shared a piece of code that he’s using to tailor an opening message based on the part of day. 1. Create a Trigger To get started we first need to create an intent/text trigger or event. Create a new flow and drag and drop a text trigger onto your canvas. Give a name to your intent and save your design.     2. Create your action One of Flow's key features is the possibility to use actions. Actions are pieces of code (JavaScript) that you can use for all sorts of custom building blocks. It allows you to make API-calls, incorporate advanced business logic, and to tailor bot replies. Head over to actions and create a new action. Name your action and copy and paste the code below. async payload => { var date = new Date() var time = date.getHours() if (time >= 7 && time < 12) { greeting = 'Good morning' } if (time >= 12 && time < 18) { greeting = 'Good afternoon' } if (time >= 18 && time < 24) { greeting = 'Good evening' } if (time >= 24 && time < 7) { greeting = 'Wow some people never sleep' } // Create a message and quick reply const message = new Message(`${greeting}, how can I help?`) message.addQuickReply(new QuickReply({ label: 'Book a table', value: 'Book a table' })) return message } 3. Select your action Within the Flow section, you can now select your action from the dropdown menu. Are you planning on incorporating your chatbot in multiple time zones? No worries the timezone of the user is stored in payload.user.profile.timezone With some JavaScript skills, you can incorporate the timezone in the code above and turn it into a universal solution.
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
1006
If you're planning to use a chatbot to refer to different pages on your website this might be a useful article. One essential part is that your website is well structured. When having a lot of URL's for different products or features it will save you lots of manual work if you build URL's in a dynamic way. To do that within your chatbot you can use the following three steps: Create an entity list Create a flow and capture the entity Use actions to create a dynamic url Create an entity list First we need to create an Entity List. Select Entity types from the menu and create a new list. You can add synonyms and an id as well. Make sure the keyword matches with the your target link. In our example this would be features, solutions, pricing or docs.   Create a flow and capture the entity After creating the entity list, it's time to create a flow and start with a text trigger. Select the entities and mark them as parameter of the entity list that you've just created. In this example we make the parameter "required and must be a valid entry".     The image below shows you that the parameter should be valid, thus part of our entity list.     Use actions to create a dynamic url Your entity list is set, your flow is ready, now let's add some code so we can build a dynamic URL. As rich UI elements such as card and carousels enhance the customer journey we will create a dynamic url within a card. Let's start with two variables. The variable "page" contains the valid value of the captured entity and the variable URL contains the URL that we will be referring to. async payload => { const page = payload.params.pages[payload.params.pages.length - 1].value const URL = `https://flow.ai/${page}` } Almost there, let's check if actually have a value and if we have one, we'll create a button and add it to a card to enhance UX. if(Array.isArray(payload.params.pages)) { // Create a Button const button = new Button({ type: 'url', label: `More about ${page}`, value: URL }) // Create a card const card = new Card({ title: "Flow.ai Navigation bot", subtitle: "" }) .addButton(button) // Create a message with fallback speech const message = new Message('More info at Flow.ai') message.addResponse(card) return message } And we're done!     Find the complete code below: async payload => { const page = payload.params.pages[payload.params.pages.length - 1].value const URL = `https://flow.ai/${page}` if(Array.isArray(payload.params.pages)) { // Create a Button const button = new Button({ type: 'url', label: `More about ${page}`, value: URL }) // Create a card const card = new Card({ title: "Flow.ai Navigation bot", subtitle: "" }) .addButton(button) // Create a message with fallback speech const message = new Message('More info at Flow.ai') message.addResponse(card) return message } }
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
158
Use Flow to create webviews and improve the customer journey. This article will show how to create webviews in 3 steps.     A Webview is a separate view that can be opened within your chatbot. This allows the user to interact in a more intuitive way for several cases. If you want to incorporate 1 or more of the following 5 items in your chatbot, it might be wise to use a Webview. Article Date picker Radio select Multiple select Terms Webviews are created within cloud code. Use the following 3 steps to build your Webview. 1. Create Webview item Creating your Webview starts with a new action where you create your Webview. The following cloud code creates a Radio select Webview that contains 3 options: Audio Display Camera When the user selects one of the items, a new parameter 'category' will be created with the corresponding value. When completed, the event 'select' will be triggered. Make sure to have that event in your design. async payload => { const url = await webview.radioSelect.create({ ref: 'category', title: 'Choose a category', items: [{ title: 'Audio', subtitle: 'Sound, music and noise', onSelect: { eventName: 'select', params: new Param('category', 'audio') } }, { title: 'Display', subtitle: 'Screen, video and pixels', onSelect: { eventName: 'Select', params: new Param('category', 'display') } }, { title: 'Camera', subtitle: 'Lenses, posture and flashes', onSelect: { eventName: 'Select', params: new Param('category', 'display') } }] }) 2. Create a Button to access the Webview The Webview is now created but we are not showing any link or button towards that Webview. Let's build a button so our users can click the button to access the Webview. ... const buttons = new Buttons('Select a category') buttons.addButton(new Button({ label: 'Choose category', type: 'webview', value: url })) ... 3. Return a message The last step is to create a message with a button that we can return to the user. ... const message = new Message(`Select a category ${url}`) message.addResponse(buttons) return message ... Find the complete code for this RadioSelect Webview below async payload => { const url = await webview.radioSelect.create({ ref: 'category', title: 'Choose a category', button:{ label:'Done', }, items: [{ title: 'Audio', subtitle: 'Sound, music and noise', onSelect: { eventName: 'RadioEvent', params: new Param('category', 'audio') } }, { title: 'Display', subtitle: 'Screen, video and pixels', onSelect: { eventName: 'RadioEvent', params: new Param('category', 'display') } }, { title: 'Camera', subtitle: 'Lenses, posture and flashes', onSelect: { eventName: 'RadioEvent', params: new Param('category', 'display') } }] }) const buttons = new Buttons('Select categories') buttons.addButton(new Button({ label: 'Choose categories', type: 'webview', value: url })) const message = new Message(`Choose categories ${url}`) message.addResponse(buttons) return message }
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
204
Ever thought about letting the bot handle images that are being sent by the user? A chatbot can do much more than answering simple FAQs. Ever thought about letting the bot handle images that are being sent by the user? It can be very helpful if the user can simply upload a picture of a payment receipt. Let’s have a look at how we can handle those images. 1. Create an entry point Users don’t just randomly upload an image. We need to instruct and prepare the user to upload a picture or image. A common case is when a user asks if there is any warranty. In most cases, there is, but the organization needs a payment receipt. We can ask the user if they have a payment receipt. If so, we can start ‘upload receipt’ procedure.   2. Handle the images After introducing the user to uploading an image you can now ask them to upload the image. Drag and drop a trigger/image onto your canvas. Also, create a branch that will work as a fallback. If the user can’t find the image or for some reason is unable to upload it, always provide a solution. 3. Handling images with code The uploaded images will be hosted in the cloud with a specific url for reference. In the example below, we will show how to send the image url to a pre-defined email address by using Actions. async payload => { var image = "-" // Check if the param "image" exists if(Array.isArray(payload.params.image)) { var image = payload.params.image[0].value } toolbelt.email({ to: 'name@domain.com', // <-- Your email address subject: 'New image via chatbot', message: `image url: ${image}, <br/>` }) } Go beyond simple automation When you’re confident with the procedure above you can bring image extraction to the next level by incorporating: Image recognition as a simple check if the user is actually uploading a payment receipt An excellent bot to human handoff to save time and improve the customer experience
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
144
Retrieve data from a database and personalize the customer journey In this guide, we will show you how you can enhance your customer experience by integrating your chatbot with a database. To be more specific, we will look at how we can retrieve information from a database and use that in conversations with your bot. We will do that by showing you how to: Extract data or user input Retrieve data (GET) Personalize the experience In addition to retrieving data from a database, it is also possible to push data to a database (POST). Read more about how to integrate your chatbot with a database. Extracting data and user input Before we start extracting data from our database, we need some data that we can use to extract only the relevant information from the database. Extracting data can be done by capturing user input and by using the payload. Read more about it in working with databases. In this example, we will use the phone number of the user that we receive by the payload as the user interaction via WhatsApp Retrieve data (GET) In this example, we’ll be working with a database from Restdb. Setting up and filling the database is part of a previous is step, as described in working with databases. At this stage our, database contains only 1 record.   To retrieve data from your the RestDB database, we’ll be working with APIs. If you’re using RestDB you can access developers mode by clicking the gear/settings icon in the top right. Then head over to API docs -> Javascript. From there, you can copy and paste the GET code from RestDB to action in Flow.       The next step is to alter the code in Flow's Action, so that we can retrieve only relevant data. In this case that is, data that is related to a user that’s sending a message. We can do that for example by using the name that is related to the user’s profile. To increase security you could also use the phone number, date of birth, or a combination. async payload => { var fullName = "" // Check if name exists if("fullName" in payload.user.profile) { fullName = payload.user.profile.fullName } const options = { method: 'GET', url: `https://integratedb-74ce.restdb.io/rest/userdata?q={"name": "${fullName}"}`, headers: { 'cache-control': 'no-cache', 'x-apikey': 'YOUR SECRET API KEY' } }; let result try { const { data } = await request(options) result = data } catch (err) { console.error(err) throw err } const { name, email } = result[0] // notice API may return more then 1 item in the array return new Message(`Hi ${name}, is ${email} still your email address?`) } Personalize the experience We now have more data that is related to this specific person. For example, we can send him a confirmation email. Don’t forget to ask for confirmation, just to check if the e-mail address is up to date. If not, we can use a PUT request to update the database. But that’s to much detail for now. The get request will return information in code. That means that we need code to display our message to the user. You might be familiar with our drag & drop interface but under the hood that’s all code as set out in our code replies. Let’s see if we can make something nice out of our GET request.    
View full article
by Khoros Staff Khoros Staff Jun 19, 2021
Labels (1)
  • Flow Guides

0
662