I’m looking for a way to calculate fees and other small tasks as a feature in the bot. I pitched adding a fee calculator to the MVD bot system as we have a lot of requests asking what things cost and the answer is usually more complicated than giving them a base price. Age is a factor in some cases. Vehicle registration costs are determined through a formula based off the age of the vehicle, MSRP, county-specific fees etc. I believe I can use the conditional jump logic to assist with some of the steps, but not the calculation portion. Any thoughts on this?
If set up a certain way, we could also implement this to show total price for ecommerce bots by calculating based off of option val maybe?
What you can essentially do is assign a value to each user response(if it’s buttons or image cards) and the response directly if it’s a text input. And then you can do any sort of calculations on top of it.
Very cool! This will definitely work for calculating fees for customers. We also have pretests for different driving tests that people can take in the different manuals. I think I will build a quiz feature for them like the demo.
So I want to create a bot that calculates price based on a certain amount of profiles.
For the category 2 to 5 profiles, the amount is 597 + X*547 where X is the amount of profiles.
How do I set up my Gambit to use the mathjs API?
Hi Marcel - you should check out this video tutorial which explains how you can use mathjs API to do simple calculations in the bot. Let me know how it goes
OK, I can make that work with regards to calculations. How about referencing the text input and validating it is a number between 2 and 5 if I ask to enter the amount of profiles?
Here’s an example of bot function I built using Auto-Suggest list in conjunction with conditional jump logic, conditional jump logic to direct users based on age, and Option Val that “calculates” fees for users. I put the quotes up because I initially accomplished this using the Math.js API, but I realized that I could accomplish this task within the bot with Option Val only. However, I will use the Math API in another calculation that is a little more intricate. Anyway, enjoy!
If anyone cares to see what the nuts and bolts of this look like, I will happily post up some screen shots.
As a side note, I have also set this up to launch the bot in the widget by clicking a button on the webpage (Calculate My Fee) that launches to a specific gambit point. This gambit makes it look like the the calculator is loading up by displaying the text “Initializing.” then “Ready.” forcing the user to select “Start”. Later when the user is offered button options to calc another fee, go back to the main menu, or select “Done, thanks!”, I added a conditional jump logic that references the original startgid for the user response “Start” AND “Done, thanks!” and directs the user to a gambit that instructs them to close the widget to continue. If the user came to the fee calculations through the main menu or via another bot, the user will be directed to rate the bot, etc. These are my early experiments on fully wrapping a bot into a website experience.
@vinit & @ish taking this one step further, I added a preferred payment option. If the user selects credit card, I make two API calls to Math.js. The first calculates the services fee associated with the credit transaction, and the second rounds the total since it is based on a percentage. The only hiccup is the math.js devs have not added a second argument for ceil which would allow you to identify the decimal that will always round up. Right now it only rounds to the nearest whole number.
However, there is already a discussion thread on GitHub about adding this feature. I commented on my user case, so here is hoping they add it. If anyone else is interested in them including this feature, leave a comment on the thread https://github.com/josdejong/mathjs/issues/1021 You can add a rounding function with a second argument, but this will round either up or down depending on whether the number is less than five or greater than or equal to five. Those pennies add up, so I wouldn’t suggest going this route as rule of thumb. However, if you are okay with rounding to the nearest dollar than your API calls would look something like this:
The previous gambit filters users based on age. In this case anyone renewing a license that is 20-67 years old will jump to this gambit as the fee is 41.72 for this age bracket. Other ages have adjusted fees (this particular fee calculator has nine gambit outcomes the user will jump to based on age)
Now taking this one step further, this could be used to apply discount codes and whatnot to an order. I’m thinking that a paypal/square API integration shouldn’t be too hard to implement. If we could make these payment methods make the call on the totals ran through math.js, in theory we can add a simple payment method within bots that calculates totals of items, calculates discounts, and hands off the totals to Paypal/Square/etc.
Glad that the video tutorials are helpful.
They are a bit quicker to make too, compared to the help docs or articles, with all the screenshots and annotations and everything.
Yes, I think simplifying the payment option would be a huge step forward in TARS bot capability, and one that I hope will be explored in the near future. I think this will be a major selling point to a number of industries. Also, as I mentioned on another thread (building bots that feature businesses within an industry), this type of bot would be 1,000 times more practical if users could book and pay for services to that business through the bot. This would be something Servicebotz could then sell as a feature upgrade within the bot (e.g. to be included with a picture, a place on the map, and a link to their website is free, featured content and the ability for users to book appointments through the bot is extra (looking for solutions to this right now), and the ability to accept payments would be the “premium” plan and make the bot very powerful in terms of conversion and value to businesses).