In my first Dialogflow project, there are certain points where I've got to send some response and move on to another intent (which also sends text) directly after that.
I tried using a webhook to send that message and make a FollowupEventInput with the code below.
final SessionName sessionName = SessionName.parse(webhookRequest.getSession());
final WebhookResponse.Builder builder = WebhookResponse.newBuilder()
.addFulfillmentMessages(
Intent.Message.newBuilder().setText(Intent.Message.Text.newBuilder()
.addText("This is the text I want to send.")
.build()))
.addOutputContexts(
Context.newBuilder().setName(ContextName.of(sessionName.getProject(), sessionName.getSession(), "Oilchange-haventchecked-followup").toString()
).setLifespanCount(1)
.build())
.setFollowupEventInput(EventInput.newBuilder().setName("StandstillQuestion").setLanguageCode("en"));
return builder.build();
}
The expected result would be:
bot: This is the text I want to send.
bot: This is the text from the next intent
The result I got:
bot: This is the text from the next intent
After that, I researched what the problem was and came upon this stackoverlow question where basically the same was asked (but in Python).
There wasn't a suitable answer to the question.
So I decided to ask it again.
How would I solve this?
I cannot simply add the text from the one intent to the other, because there's multiple intents that have to direct to that second one.
That is the expected behavior as when you set a followup event it basically tells dialogflow to trigger another work flow. But to get around this issue what you would want to do is when you set the followup event, also set a context with the first sentence that you want to say with the second sentence. Then in the fulfillment of your follow up intent, check if that context is set and has any value, if it does then say that too.
Related
I am using UserConsentAPI for reading SMS in Android App, In that there is a method
startSmsUserConsent()
In this method we need to pass sender Number/Name, For example my sender name is ViCARE,
I received VT-ViCARE, BT-ViCARE, AD-ViCare like that each time.First two character of sender name is dynamically changed. If I give below like that reading particular sms from "VT-ViCARE" it works fine, How to read the sender contain "??-ViCARE" using User Consent API?
smsRetrieverClient.startSmsUserConsent("VT-ViCARE")
I did research a lot but currently can't find an exact answer to your question but here is a workaround. How about you call the String's contains method, check if the sender name contains ViCARE, and then pass it to startSmsUserConsent ?
Boolean sender = "YourDynamicSender".contains("ViCARE");
if (sender) {
val task1 = SmsRetriever.getClient(applicationContext).startSmsUserConsent("YourDynamicSender")
}
I want to set the signing order in an embedded signing envelope, which means that I have 2 recipients that sign the document one by one. On the sandbox UI that I can tick the checkbox to set the signing order and have 2 recipients there. The second one receives the email after the first one finished. I am wondering how can I implement the same logic by code.
I ve already tried to set the routing order but not what I want.
TemplateRole signer = new TemplateRole();
signer.setEmail(signerEmail);
signer.setName(signerName);
signer.clientUserId(String.valueOf(xxx));
signer.setRoleName("signer");
signer.setRoutingOrder("1");
TemplateRole signer1 = new TemplateRole();
signer1.setEmail("xxx");
signer1.setName("xxx");
signer1.clientUserId(String.valueOf(123));
signer1.setRoleName("signer1");
signer1.setRoutingOrder("2");
envelopeDefinition.setTemplateRoles(Arrays.asList(signer, signer1));
This is what I want:
enter image description here
Not this:
enter image description here
First, if you're referencing a template you'll need to set up the routing order there. When using using TemplateRoles, it's not necessary to set the routing order in the signer definition.
Second, in your code you're hitting signer.setRoutingOrder() twice, looks like you left the 1 off the second reference.
Third, I don't believe "0" is a valid position in the routing order. Try 1 & 2 instead.
I am building a reply keyboard oriented bot using java and I need it to treat differently two scenarios in which the latest message's text is the same based on the text of the previous message. How can I get or store the text of the previous message as a public variable?
My conceptual modelling is as follows:
I have a large If-Else-If statement where the condition for each If block goes along the lines of if(update.hasMessage() && messageText.equals("aaa")) where "aaa" is some text that appears on a reply keyboard that popped up for the user earlier (since the keyboard buttons send the string on them as text and there is no option for a button press event in Telegram bot's api). messageText is defined as update.getMessage().getText().
I want the code to treat differently two scenarios in which messageText is the same based on the message that came before it. if(update.hasMessage() && messageText.equals("aaa") && previousMessage.equals("bbb")) { } else if(update.hasMessage() && messageText.equals("aaa") && previousMessage.equals("ccc")){}. How can I store the previous message without it getting updated upon a new message recieved?
There are lots of patterns that you can use for controlling the state of users, But as a simple trick what I did in my telegram bot, you can generate next message data based on current message response. For example when user send "aaa" as the first message response, and you want to generate the next message you can add first message data to it's callback like this: "aaa,bbb" and when calls the api you notice that previous message was "aaa" by splitting the callback data with ','.
I am currently taking a course in app development and I am trying to use Facebooks API for GET requests on certain events. My goal is the get a JSON file containing all comments made on a certain event.
However some events return only a an "id" key with an id number such as this:
{
"id": "116445769058883"
}
That happends with this event:
https://www.facebook.com/events/116445769058883/
However other events such as (https://www.facebook.com/events/1964003870536124/) : returns only the latest comment for some reason.
I am experementing with facebook explore API:
https://developers.facebook.com/tools/explorer/
This is the following GET requests that I have been using in the explorer:
GET -> /v.10/facebook-id/?fields=comments
Any ideas? It's really tricky to understand the response since both events have the privacy set to OPEN.
Starting from v2.4 of the API, the API is now declarative which means you'll need to specify what fields you want the API to return.
For example, if you want first name and second name of the user, then you make a GET request to /me?fields=first_name,last_name else you will only get back the default fields which are id and name.
If you want to see what fields are available for a given endpoint, use metadata field. e.g. GET /me?metadata=true
Can somebody give a simple example for java code of a native app passing a string to a website?
For example: when a string has the value Hello everybody, the text Hello everybody should get pasted into the Google search field.
For the most simple use, you can try:
public static void browseURL(Activity activity, String url)
{
try
{
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
activity.startActivity(intent);
}
catch (Exception e)
{
message(activity, "Sorry, failed to view the desired page.");
}
}
and then call:
browseURL("http://www.google.com/search?q=Hello+World")
Do you want to fill the fields and submit them? If so, just do the request with the request parameters filled, and parse the response given by the server. Look into Apache HttpClient.
You don't actually have to add text to the Google search field explicitly. You can send a URL with a query string.
Depending on the website the query string will always be different. For Google it is http://www.google.ca/search?q=something . Anything after a ? is considered a query string which any good web developer will include in a webpage. That query string takes custom commands in the form of ?command=query for command&command2=query for command 2.
Since this is tagged blackberry, I assume you want to implement a blackberry app, and you don't explicitly explain what you want to do, so you have two options,
Invoke the browser
On that page it describes how to open a browser session. So within the
browserSession.displayPage("http://http://www.google.ca/search?q=searching%20for%20something");
If you need a class for URL encoding, let me know and I'll send one your way.
Http Request to pull the html of the webpage into the code. To do that, you'll have to look at my blog this week as I'll be posting a full in code network class either tomorrow or tuesday, which I'll edit this post to contain a link to.
OR you can send me a message if you need it NOW and I can email the non-cleaned up code to you.