I am trying to build a bot with the help of google dialog flow.
The use case is to book a ticket. I did build a BOT.
But the user can say yesterday's or already completed date and time.
I want to add conditions to check whether the said time and date are in the past or future.
If they are in the past, I want to ask date and time again.
Can you point me to some links and blogs to learn how to do so?
Related
I'm creating a chatbot in Dialogflow in which the user is expected to enter a frequency of time, followed by specifying the time. i.e :
Bot: how many entries will you make on that day? (Or what so the frequency of your entries)?
User: Twice daily or two times a day.
Bot: Please enter those times.
User: 9 am and 7 pm
Now the problem is even if I enter more than two times it will still get accepted as the time by Dialogflow.
I need to implement a check here that will take only times if the user enters twice daily and accept three times if the frequency is thrice daily.
Is it possible to do this by manipulating entities and intents? I want to avoid doing this in the webhook.
Also the webhook I'll be implementing is in python. So can't use Node.js inline editor.
No, this can't be done in the Intents only. Remember that an Intent represents what the user has said, and not how you are using.
As you surmise, the best place to check these values are in your webhook fulfillment. Since you already have a webhook, it isn't clear why you are avoiding this.
In terms of design, you may wish to skip asking for the frequency and just ask the user to tell you when they'll be making the entries. You can then confirm that was all that they wanted, accept more if they needed more, etc.
I have an application that uses subscriptions for each member that joins. I'm having some issues with dates and calculations related with it. For example, let say a member joins on 2/10/2020 at 10:00. When the user submit the request to the server to process the subscription (the server is using UTC) the date that is being calculate is 2/10/2020 16:00 (because I'm -6:00 hours from UTC). This scenario is OK at this point, because the date is still the same (no matter the time). But, if we replicate this scenario when the user joins for example 2/10/2020 at 19:00, when the request is received and calculate the date, the result is 2/11/2020 01:00, and that produces an error in the invoice because the billing date of the invoice is wrong (one day after). What is the best way to implement this? I have read a lot of this topic, but most of the pages and questions are related in the other way, server to client, to parse of format dates to display to the user.
I have several questions related with this process.
Should I sent the date for the UI to the API? Or the timezone and
based on that, calculate the date in the API? (since the server have
UTC)
Moment.js library have a way to solve this or should be better with vanilla Javascript using Date?
Is there any HTTP header for the request to handle the time or date?
This really depends on what behavior you want to have. Before you try to fix anything, think through and decide on the exact requirements for what the billing date should be based on.
Is the user's time zone relevant? If so, you'll likely need to know what the user's time zone is. You'll be potentially assigning different dates to different invoices even if they're using the same UTC point in time. Your business might get confused on why some customers have invoice dates before or after the business day.
Or maybe the time zone of your company is more relevant? Many business work that way. All of your invoices will be aligned, but some customers might get confused on why their invoice date is before or after their current date.
Or maybe some customers snap to time zones of nearby offices, in the case of businesses with offices around the world.
Only you and your company can decide this. There are probably other options I'm not thinking through here. It's a business decision, not a technical one.
On your three questions:
That depends on what you decide above.
Libraries are a good idea for simplifying your code, but they're not a hard requirement. You can use the Date API, if you know what you're doing, but you may find libraries easier to work with. Also, Moment is in maintainance mode. For new development, the Moment team recommends you use Luxon instead of Moment. There are other popular modern libraries also, including date-fns and js-Joda.
There's the date header, but that's not going to help you with this.
Hello this is my first time attempting to create a slackbot using this resource https://botkit.ai/ , the slackbot I am trying to create should notify me if someone' post on a slack channel is not answered after a period of time,say after 30 minutes
So far I have been able to make my slackbot respond to specific keywords
//make slackbot hear for specific keywords and then reply without directly being mentioned
let now = new Date()
controller.hears(['help', 'I need help', 'stuck', 'question'],['ambient'], function (bot,message) {
// do something to respond to message.
bot.reply(message,'Hello <#'+message.user+'> someone needs help!' );
});
At first I was hoping that botkit already had some time tracking features, but it doesn't seem like it does, how can I make my slackbot notify me of posts that have not been answered after a specific period of time??
I would look into storing state someplace. You can query for the messages in a channel and then store off when they were posted. Then, every minute (or more, depending on your needs), you can run through all those and see if they were answered. Now, it is going to be hard to know what "answered" means, unless you can control that answers are either:
in a thread keyed off the question
reference the original question via a link
tag the original question asker (and then you'd have an issue if someone asked two questions in a row)
marked with a token (like 'ANSWERED') (and then you'd have the same issue as the tag solution)
I can't think of any other way to associate an answer with a question.
Anyway, you can store off the time in a database, google spreadsheet or other solution (depending on where you are running your node code). I'm not familiar with botkit, but Transposit (disclosure, I work for them) has integration with Slack and with Google Sheets, and is free to use.
I am doing a mobile game server using node.js. I used the Express and postgresql
I have two questions.
This game has a Inapp is 30 daily gems that user can get the gems in 30 days period. But I don't know how to implement the method let the server know the user bought this item and send the reward to this user every day.
This game has a special offer item in InApp. For example, a Christmas pack in 25/12 - 27/12. But I don't know how to set this 3 days can show this pack.
I am beginner in node.js. So I hope that you don't think my question is stupid. Thanks
Speaking at a high level, you have quite a few options.
For your gems requirement, you would probably have a field or table that represents this gem purchase, e.g a start date. If a user bought this package say on 1/1/2019 then your node server can have a process that runs once a day that queries the purchase table and give gems to any user where the current date is less than 30 days ahead of the purchased date.
Your table may look like:
user_id
date_purchased
gems_per_day
To implement this as a function that will run once a day, you may want to create a singular script for it and run it on a cron job once per day or create a Timer type class within Node that will run your function every 24 hours.
For your special offers, as part of your Store code, let's say you have a function that updates what items are currently available in the store, you run this code once per day (as one of the 2 methods mentioned above) and probably storing these items in your database. Similarly, you can check each day if the current date is within this "special offer period" and if it is, you can set that product within your database to be active.
Your table may look like:
product_id
enabled
or
product_id
start_dayMonth
end_dayMonth
Hope this gives you a few ideas of how you can lay this out. Happy to answer any questions
So basically i have written a small python script that will automatically visit stackoverflow every day in the event that i am away for whatever reason or forget to visit the site. As much as i enjoy using this site on a daily basis, on several occasions i've reached over 50-60 consecutive days but the following day i have not visited stackoverflow for various reasons and my badge counter has been reset back to 0 and i have to start all over again, and i really want the fanatic badge!
Would this method of obtaining a fanatic badge be deemed as being against the true spirit of earning badges?