I am using Dialogflow with the the V2 C# client library. When the user provides the Chatbot with an address, I use a web-hook to send the address to my back-end.
My back-end then validates the address and does some other things (my back-end takes about 2 seconds).
However, I would like the chatbot to respond to the user with something along the lines of "Give me a second and I will validate the address you provided me" before my back-end has finished.
Then once my back-end has finished, respond to the user with the results of the address validation. I don't want to accept input during the 2 seconds my back-end is processing.
In summary, I would like to know, what is the best way to acknowledge a user's input with a message, not accept any further input until my back-end processing is complete and then finally responding to the user with the results of my back-end?
You need to manage this via contexts. If you are using Dialogflow SDK instead of the UI, you could control all of this via code which is more convenient.
If you are using the GUI, set an input_context and give it some lifetime as you see fit. On your web-hook's successful resolution, update or cancel respective input_context via an output_context to demonstrate completeness of a request.
By using contexts event if user asks any other question, you will not loose previous question and its answer will still be rendered to user.
Disengaging the chatbot by not taking any questions might not be a good user experience. If you really wanted to do it, you will need some JS to help you create a loading/processing sort of icon on your bot's interface for specific intents while you programatically control the mute & unmute commands on the UI.
Related
I am working in Dialogflow right now, is there any way to initiate chat using webhooks instead of using the common welcome massages given by dialogflow or some chat apps. Like I want to have my own initialize chats for many different situations. For example, today is my day to save money, then it will initiate a chat to make sure user get into save_money_daily intent. More details on the comment
There are few things that you wanted to do here that are not natural, I guess. Let me go on each:
How can I send an automatic chat for every possible case from the backend automatically?
Ans: You are building a google assistant on dialog flow, using as a chatbot, any chatbot can not send an automatic message(unless set by user), chatbots, and assistants are in the nature of the user interaction.
Let's any bot on Facebook, Skype, or any platform even the google assistant, they can't popup unwantedly with any information, it will be not user friendly.
There is a way to do, like if the user is interacting with your bot: You can ask like:
'Do you want me to remind you for saving money every day'
If user gives permission, save it in-app local cache and send app notification, via. Once the user get the app notification you can invoke the chat on the app notification click and open chat screen with your reply, but in the background when the user clicks on app notification you have to send a request to initiate chat.
And this solves your second problem as well.
Let me give you a high-level example:
Three Intent: With some user utterance
GetLatestMoive: ['get me the latest moives list']
GetLatestNews: ['Headline for today']
HealthCheck: ['I want health tips']
Create Notification and send it to the user via the app:
Based on the notification if the user clicks any of them, initiate your chat in-app with that utterance, it will automatically call the intent, and rest will follow based on your intent follow up a map and conversation design.
Hope this helps!
Hello I wonder is there a way to send push notifications with Django to a user.
I have a website that accepts/refuses vacation demands.
When a user sends a vacation demand my Django app sends email to the CEO to notify him that there was a new vacation request.
When the CEO accepts the demand it sends email to the user that the demand was accepted.
But since the CEO receives plenty of emails a day and he barely sees my emails i would like to make a browser notification whenever he opens the browser to see notification from my website that a demand is waiting to be approved/refused.
Is there a library that can do that for me,
I've tried django-webpush but I couldn't managed it to work even though I
followed all the steps.
Yes you can, since your have the information that your user accessed your server at least once. checkout this lib
https://github.com/jazzband/django-push-notifications
EDIT Gonna put more information about it
If you expect receive one response from your backend to your backend you can write some watcher to receive new data, or create one plugin, or use sockets or even make your frontend send one call to backend with some interval time to check if there is any new messages...
Lets split up a bit
1 - Watcher
Using watchers you can just watch your backend to any changes... build it from scratch i thing i a bit "hard", you can use some modern frontend framework that already have it like Angular, React, Vue... and capture new incomes messages from your backend and create Notification instance in your browser and your it to your user (i guess they will have to keep the page openned to do it... im not 100% sure)
2 - Plugins
You can build one plugin to add to your browser and receive the data from your server... since you already in browser is more easier to use browser functions
3 - Sockets
The common way to make 2 ways comunication from frontend to backend, most used with chats and things arround that, just create one channel of communications between this 2 sides and you will be able to send and receive messages from frontend or backend
4 - Dirty Way
If you not get the time to implement it like supposed to do with quality you can go the dirty way, just setup one ajax in your page to check your backend to new messages every 5 minutes? or more or less... and if find any new data (of course you will have to handle it on your backend like any other suggestions above) and then you create one new notification in your browser and show to your user...
Im sure there is bunch of libs that already do most of things to you, so just search a bit and test until you find anything that fits your need
Just a preface. You can skip to the next heading.
I'm working on a startup with a limited budget. Recently, I've been trying to design a RESTful API as a backend for the mobile app i'm working on. (A Web based SPA client is going to be developed in near future too). Of course it's not a public API but we know it "can" get revealed by tampering network activity or investigating the Web Client source files.
Almost all of the API methods are protected using JWT-based Token Authorization EXCEPT user registration method which accepts an email and a password and creates a user. So, the system would be vulnerable to spammers.
SMS as the best solution
You can skip to the next heading.
I've been investigating various approaches like IP rate limiting and CAPTCHA on mobile app (!) to block spammers but none of them were satisfying. So I came to the idea of E-mail verification which would not be the best approach either. Spammers can easily create fake E-mail addresses and parse incoming mail contents to validate their batch of registered accounts.
The best I found out so far is to use SMS verification. Phone numbers are not easy to fake and each of them will cost for the spammer. It's not perfect but minimizes the risk. So i decided to generate and store a key in DB, send it to the user via SMS, and require them to enter the code in the app. Then, if correct, register the user and store the phone number to prevent multiple usages of the same number. So far so good.
Telegram Bot as a replacement of SMS Verification
As the budget is limited, i've came to the idea of using Telegram beside SMS verification to reduce the costs related to SMS Service Providers. So here is the idea.
Telegram uses the same approach. It verifies the phone number on user registration. Thus, we can rely on the fact that each Telegram user is a real person with a valid phone number. So, I can develop a Telegram bot named like ValidatorBot, and use Deep Linking feature to start the bot with a parameter indicating the registration request which is going to be validated:
https://telegram.me/ValidatorBot?start=user_registration_token
And then show the link above as "Register Using Telegram". When the user opens the link and Clicks on START button of the bot screen, a message containing user_registration_token would be sent to my server, so i can mark the registration process identified by user_registration_token as a valid process and continue with registering the user and store their Telegram User ID to block multiple account creations with a single Telegram account.
I haven't seen any implementations like this before and could not find anything relevant on the web about it. Here are the different aspects that I could analyze so far:
It would not be a user friendly way to make them open Telegram, click on Start, then switch back to the app to be able to continue.
A Telegram User can be deleted. The spammer can delete their Telegram user, create a new one using the same phone number, and register again with a new Telegram UserID. Although, it's not such a big concern because Telegram denies multiple registration intents by a specific phone number in a limited time domain for at least 24hrs. (Three registrations per day I think).
What do you think? Do you see any gaps in this verification method? Any security flaws?
Would it be better not to rely on just pressing START button and show a code to user after pressing it, and requiring them to enter the code in app? (Like how it was in SMS method) Or getting START signal is enough?
You can request phone number by Telegram bot button and get real phone number of the user, so you can save your money for SMS price.
I am interested to add my service into the share functionality of the Google Glass, my flow is below:
1. Take photo / Record video
2. Share with -> My service
3. the photo or video should be uploaded to my site
Is this functionality possible? it is very similar to Facebook and G+ share options.
I will be happy to know how to do it, Thanks.
What you are looking for is what the Mirror API calls a Contact. Your Glassware can setup one or more Contacts, specifying what content type can be shared with you and/or if there are voice commands which will trigger the Contact.
You will also need to setup a Subscription which will be the public URL for an HTTPS enabled server that the Mirror API will use to send you the content that was shared with the Contact.
In general, the flow when a user first authorizes you to write to their time would be something like this:
Add a Subscription, so you can get callbacks.
Add one or more Contacts. In your example, you would want to register the Contacts to have acceptTypes of image/* and video/*, although you can also omit the acceptTypes to get everything (including text).
The callback you register with the subscription should be able to handle a JSON body, and should return HTTP code 200 as quickly as possible. A good procedure is to actually accept the body, place it on a job queue for processing later, and immediately return the 200 code. When processing the body, you may want to do something like
Confirm the userToken and verifyToken provided are valid.
Using the itemId, get the Timeline item, which will include attachment information about what was shared with you.
If the attachment is marked as isProcessingContent, then the content isn't ready for you and you should return the job to the queue and try again soon.
If isProcessingContent is false, you can use the attachment URL with the authentication token for the user to fetch the content itself.
There are a lot of details I've glossed over here. For a further overview of the flow, see https://developers.google.com/glass/develop/mirror/contacts
Description of how a webhook works from http://webhooks.pbwiki.com/ -
How do they work?
By letting the user specify a URL for various events, the application will POST data to those URLs when the events occur...Among other things, you can:
create notifications to you or anybody via email, IRC, Jabber, ...
put the data in another app (real-time data synchronization)
process the data and repost it using the app's API
validate the data and potentially prevent it from being used by the app
Who is using web hooks?
DevjaVu, BitBucket, GitHub, Shopify, Versionshelf, PayPal (IPN), Jott (Links), IMified, PBwiki, Facebook (Platform, sort of), Mailhook.org, SMTP2Web, Astrotrain, Notifixious, Assembla, ZenDesk, Google Code
Do you know of any good uses of webhooks?
AlertGrid is the webhook consumer. You can configure it to accept http calls from ANY source and raise alert (email, sms, phone) to a specified person or group of people (works worldwide!) whenever the parameters in the http callback meet your criteria or when the http call was expected but it didn't occur (kind of 'heartbeat' monitoring). There is a visual editor for you to easily create rules.
Apart from notifying people by sms or email it can also notify existing applications by sending the http requests to their APIs.
It can also visualise data received in http callbacks and show the history.
Unfortunately, the wiki is not the most up to date list of known implementations. I have my own list that I'll put on the wiki when I get around to reorganizing it. Some not mentioned in the current list:
Dropbox
Gnip
Google Code (Project Hosting)
Checkout by Amazon (both for notifications and as actual callbacks with return data)
Hubilicious
Beanstalk
Google Checkout
MailChimp
SurveyGizmo
Hey!Watch
MySpace (for app developers)
I know shopify is using webhooks quite successfully now. By extension so is fetchapp uses them as well. You either are sending an xml file, or receiving one and doing your own processing logic on it.
Oh and shopify's wiki in the link has a whole write up about how to implement it in your app.
OfficeAutopilot has an interesting version of webhooks.. they use their rule interface to trigger API posts. Can trigger in response to any system event.. email opens, clicks, page visits, purchases, etc, etc.
Kiln 1.2 uses webhooks much like GitHub, BitBucket, etc.
(Disclaimer: I'm a Kiln/FogBugz dev.)
Say for example you want to get data from any API( eg. twitter, facebook etc.,). Instead of you polling the data for every few minutes/seconds, it POSTS the data to the specified URL, whenever it is available.
By using this, you will avoid unnecessary polling like say you poll and data is not there yet.
StorageRoom is a JSON-based CMS that supports webhooks, so that you can notify other services or kick of some manual processing on your own servers.
(Please note: I created the service myself)
If you want to connect one service that supports webhooks to another service's API, you can check out IronWorker's webhook support. Here's a blog post that walks through connecting github webhooks to HipChat:
http://blog.iron.io/2012/04/one-webhook-to-rule-them-all-one-url.html
There are some other examples here too, one that takes a chargify callback and posts to Campfire.