Dialogflow CX | How to let the bot initiate the conversation? - google-cloud-platform

Dialogflow ES has an event called 'WELCOME' which makes it possible for the bot to initiate the conversation.
How can I do the same in Dialogflow CX?
There is no entry fulfillment option in the Start Page of Dialogflow CX.
Edit:
Delete the 'Default Welcome Intent' route.
I am unable to perform this. I get the following error.
In 'Default Welcome Intent' change the intent from 'WELCOME' to nothing.
I get the following error. I have set the condition to true. I have also set the page transition to 'onboarding' page.
Please let me know if more screenshots are required.

To accomplish what you're asking, the easiest way would be to:
Open the "Default Start Flow" and select its Start page.
Remove all routes and add a new one.
This new route takes a "custom condition" in the form of true (in the condition pane, click on customize expression and then just type true) and goes to a new page
called "Onboarding" (on the bottom of the route creation page, click on new page and name it Onboarding).
Go to the Onboarding page and add an entry fulfilment "Hello there, how are you doing today?"
in this way every time the default start flow is activated (window is opened) the bot will use that fulfilment.
EDIT:
ok, i tried creating a new agent and i think i solved the problem.
it seems as though we can't erase the default welcome intent, but it doesn't matter.
i created two pages: onboarding and first page. from start i added an always true route to the onboarding page, and i did the same with the onboarding and first page. As you can see from the testing console we only get the expected behaviour for the second transition, look at this:
start page:
onboarding page:
"first" page:
After looking for info on the documentation i think i understood this: from the testing console, google doesn't let you see the actual behaviour of the conversation. If you see the screenshots, when i say "hi" and go the the onboarding page, i get immediately brought to the next page by that "true" transition. Since the same exact sequence is on the start page, the same behaviour should apply there: you only can't see it in the console because "opening the window" in the console is not the same as opening the conversation "in real life".
So, what i suggest you to do is create a new integration or develop a testing environment for the bot, say a website with the messenger integration, a telephony integration or whatever else, and test this onboarding on there. Speaking from personal experience, try with the messenger one maybe: you get a link and you just embed the script in any webpage (works well and easy).
It should work, as in, as soon as you open the conversation, the bot should go the onboarding page and say "hello there!"

So, I'm not sure what your end use-case is, but DFCX (at it's core) isn't exactly designed to initiate an unsolicited message because it's really just a language model with a bunch of features built on top of it.
With that being said, if you want to create a pop-up window for your website chat-widget, you can actually configure this in the integration settings with your embed code. Here's an example:
//The DF Messenger element:
<df-messenger df-cx="true" chat-title="Agent Name" agent-id="<your agent ID>" language-code="en" expand="true"></df-messenger>
//The window load script :
<script src="https://www.gstatic.com/dialogflow-console/fast/messenger-cx/bootstrap.js?v=1"></script><script>
window.addEventListener('dfMessengerLoaded', function (event) {
const dfMessenger = document.querySelector('df-messenger');
const openText = ('<The Text You Want To Display On Page Load>');
dfMessenger.renderCustomText(openText);
});
</script>
Please note this will only work if you have the DF Messenger Integration enabled on your agent. See the docs for integrating DF Messenger here

1.Use the attribute intent inside the df-messenger tag in your UI/HTML page
2.Then create a Custom Event in Dialogflow CX (By clicking on Event handler '+' icon)
3.Check the 'use custom event' checkbox and provide event name and provide a text response in fulfillment section of this custom event.
4.Finally provide this custom event name as value to the attribute intent(mentioned in step 1)
please refer to this document for df-messenger HTML customizations https://cloud.google.com/dialogflow/cx/docs/concept/integration/dialogflow-messenger#html-customize

According to Dialogflow CX documentation, the WELCOME event (although not visible in the Start flow) is also available. As you can see in this link and the picture below.
To invoke this event, you have to use the detectIntent method of a Session client. You'll need to specify the event name in queryInput.event.event of the request used in detectIntent.
Hope this helps!

Related

how to get a welcome message in aws lex chat bot

I am creating a chatbot using amazon lex.
There is a use case for which I have to display a welcome message like 'Hello my name is LexC. How can i help you?'
How can I implement this? This message should be displayed without user type anything, so basically without invoking any intent.
Your Lex bot cannot display a "welcome" message without any prompts from the user. You would have to implement this functionality on the client side where the bot is integrated.
Since you mention that you're using the bot inside your web/mobile app, you can implement your own code to simply show a message to the user once your chat UI loads up in the app. For Slack however, you would have to look into their docs to see if something like that can be configured.
If you are trying it to do with Facebook Page, Then you can do this by following steps:
You can create a customized greeting from your Page that will appear in Facebook messages and in the Messenger app for iPhone, iPad and Android when someone begins a conversation with your Page for the first time. Your Page's greeting will appear before any messages are sent.
To create a Messenger greeting:
Click Settings at the top of your Page.
Click Messaging in the left column.
Next to Show a Messenger greeting, click to select On.
Click Change, edit the greeting, then click Save.

Azure LogicApp runs webjob and send email

I want to create an Azure LogicApps that has to launch and verify the status of a webjob. This is because I want to take an action if the webjob finishes its activities with an error and, in this case, the LogicApps has to send an email with an alert and restart the webjob.
I have tried to find some documentation about it on LogicApps site and in the editor but I can't find any connectors.
Any ideas, documentation or samples? Thank you
I thought my way could meet your requirements.
You could use a HTTP trigger to get the latest_run property with GET method. The URI would look something like https://{webapp-name}.scm.azurewebsites.net/api/triggeredwebjobs/{webjob-name}/. Then click advanced options, choose Basic Authentication. You could get username and password from publish profile or go to Webjobs on the Kudu then click the Properties. The trigger would be like the pic shows.
Then add a compose action, use HTTP Body as Inputs. After this , you could judge the status property. The whole flow would be like the below pic.
Note:when you use condition to judge status, you need to switch Designer to Code view, then change the value. The value should be "#outputs('Compose')['latest_run']['status']". Or you could refer my code view page.
Hope this could help you , If you still have other questions, please let me know.

How to track click event on server side in sitecore

How to track the user click event on the server side in sitecore?
Our requirement is to track few external clicks on the site and register them as goals. I can track the clicks through client side js script but then I would like to achieve this through server side. Any idea as to how to track?
Which event\processor actually holds the clicked links info/?
There are no events and no processors which are execute when a link on a page is clicked.
You have 2 options if you want to register external link click as Sitecore goal:
Add onclick javascript background call to the server and send the information about the link which was clicked. Then register it as a goal on server side.
Create "External link" item in Sitecore and link to that page instead of linking to the external page directly. Then add a goal to that page and instead of displaying it, redirect client to the external site.
A click to an external page will not pass through Sitecore anymore, so the system will not be able to track that ootb. Like Marek said, you have a few options to do this yourself. I wrote a blog post on it (https://ggullentops.blogspot.be/2016/02/integrating-addthis-with-sitecore-goals.html) a while ago explaining (with code) how to do this with javascript on the client and a controller to register the goals on the server.
We just post to the controller which takes care of the triggering the goal. Code in short looks like this (check the post for full code - also with obligatory null checks):
var visit = Tracker.Current;
var page = Tracker.Current.Session.Interaction.PreviousPage;
var registerTheGoal = new PageEventItem(goalItem);
var eventData = page.Register(registerTheGoal);
eventData.Data = goalItem["Description"];
eventData.ItemId = goalItem.ID.Guid;
eventData.DataKey = goalItem.Paths.Path;
Tracker.Current.Interaction.AcceptModifications();
Tracker.Current.CurrentPage.Cancel();

Selenium Python: auto click allow for notification requests

I a have small scraper for Facebook that uses chromedriver.
However every time I login after a couple of seconds I have to click some button to allow Facebook notifications. Is there a way to do it automatically?
I've seen some suggest to press tab three times and then enter but I don't know when exactly I'll be prompted by the request and I don't want to press stuff at the wrong time.
Is there anything that can be one when creating the webdriver?
Most likely, this is because every time you start a new ChromeDriver instance you get an entirely new Chrome profile, just like if you opened a new private browsing session. So all the client specific settings that the page you want to test has defined via cookies will be lost and have to be set again. (The main reason why this is a good thing is that for automated testing, you'd like the page to be in the same state every time a new test visits it.)
There are however ways to emulate cookies for testing with WebDriver.
Example
Consider the page http://www.cnn.com for example. Every time you run a new test against that page, a bar at the bottom of the page will pop up asking you to accept their cookie policy:
The page stores the fact that you once clicked the "I agree" button in a cookie itself. You can use the Chrome content settings to identify which cookies a certain web page sets. Details on that can be found here: https://superuser.com/questions/244062/how-do-i-view-add-or-edit-cookies-in-google-chrome
For this particular page, the name of the responsible cookie is "CNNtosAgreed" and the value it is set to once you click the "I agree" button is "true".
In your WebDriver script you can use the manage cookies functionality to set specific cookies, so that the page you're testing thinks you have been visiting it before.
In the Java client bindings this would look like that:
Java
driver.get("http://edition.cnn.com/");
driver.manage().addCookie(new Cookie("CNNtosAgreed", "true", ".cnn.com", "/", null));
driver.get("http://edition.cnn.com/");
Notice how the first time Chrome navigates to the page, the confirmation dialog pops up, but not the second time.
Here are some examples of what the cookie API exactly looks like in Python: How to save and load cookies using python selenium webdriver

How to insert timeline card in new user account for first time

I've followed the Glass quick start guide for Glass for Python.
I'm able to run the server locally and can insert timeline cards to my account using the Admin Panel in Quick Starter. So far so good. But how the flow would look like for a new user? I'm creating a glassware similar to weather updates. In Quick starter, I had to trigger the "post" thru a "form" element. How does it work when someone installs Glassware from store. What triggers that person to get "very first" timeline card. I'm quite confused here. Any useful information will be helpful.
When a user turns on your Glassware in MyGlass, they will be redirected to your auth URL and taken through an OAuth flow (just as would happen if you visit that URL manually without going through MyGlass when you're developing). After they go through that authorization, you can perform any post-auth tasks that you need, such as inserting contacts or timeline items.
The relevant code in the Python Quick Start can be found in the _perform_post_auth_tasks method of the OAuth request handler, which is called at the end of the get request before redirecting to the Glassware's main page.