I have done my Dialogflow voice conversation chatbot using python, But currently I am running the conversation chatbot using loop. So my conversation is running till the loop end. The cloud is developed by using webhook and dialogflow intent.
So how can I end the conversation once the chat is end in cloud to end notification in python application.
I have added the following print in my python code, so there I have got the end_conversation intent, below I added the end_conversation log.
print('Fulfillment text: {} \n'.format(query_result))
End conversation log:
intent_detection_confidence: 1.0
diagnostic_info {
fields {
key: "end_conversation"
value {
bool_value: true
}
}
Related
I have a unity project in which I send subscribe to firebase and receive a callback every time a field changes - which I need to process according to the status of the fields.
FirebaseDatabase.Net is installed in the project
Problem 1, although my subscription invokes the callback func nicely when I change fields in the firebase, then I then build it for apk and install it on VR Pico G24K, I receive no connection from the firebase.
Problem 2: When I attempt to Query the firebase when not inside the callback func, both unity and pico will stuck.
Query func
private async Task<Device> QuerySingleDeviceAsync(string serial)
{
return await _firebaseClient.Child(Fields.DEVICES_ROOT).Child(serial).OnceSingleAsync<Device>();
}
Can anyone here point on something I might be missing (package I need to install for VR usage, or alternative function of questioning the firebase outside the observe's callback so I can better debug the no-comm issue?
I have a nextjs project and I integrated twilio programmable chat. It basically works. Next step is to add notifications and I have very big problems due to the not updated or lack of doc. I tried this guide for web push notifications but I gave it up because after the step7 I don't know what to do and can't find anything about it.
What I want to do now is to get the status of the messages and eventually update them once I read them. First of all is it possible to do it? I don't find anything about twilio web notifications on the internet.
For example if I want to get the messages of a specific room I do as follows:
const response = await getTwilioClient(token, unique_room_name);
const messages = await response.channel.getMessages(MESSAGES_LIMIT);
messages has the following shape:
{
hasNextPage: boolean,
hasPrevPage: boolean,
items: Message[],
nextPage: () => Message[],
prevPage: () => Message[],
}
And Message looks like this:
So how can I see the status of a message?
Message read status is actually stored on the Member object. A Member is the object that represents a User in a Channel and it has a lastConsumedMessageIndex property which relates to the last message they read.
In order to read the lastConsumedMessageIndex property, you need to set where the member has read up to, using the Channel methods advanceLastConsumedMessageIndex, setAllMessagesConsumed or setNoMessagesConsumed.
I recommend you read the documentation on the Message Consumption Horizon and Read Status.
As an extra note, I see you're asking questions about Twilio Chat, however Twilio Chat will be coming to the end of life in July 2022. We recommend that you migrate to the Twilio Conversations API instead.
I have a web API over net core 3.0 and my API is using a mail DLL where I do some operations.
Web API controller:
_mailService.SendEmail();
Mail DLL:
public void SendEmail()
{
Console.Writeline("Registering at database");
RegisterAtDatabase(); //Do some stuff at database
SendMailToUser(); //Send mail to user. His operation takes about 1 minute
Console.Writeline("End mail proccess");
}
private void SendMailToUser()
{
Console.Writeline("Creating and sending mail");
//Here some stuff to send the mail. It takes about 1 minute
Console.Writeline("Mail sended");
}
I want to call _mailService.SendEmail() and not wait for the whole process. I want to write at the database and not wait for email sending process. So console output should be....
Registering at database
Creating and sending mail
End mail proccess
//After 1 minute
Mail sended
Is that possible using Task Async and await in some way?
I wanna return the control to the API while the email is sending.
Thanks
Is that possible using Task Async and await in some way?
No, that's not what async is for.
The proper solution is to write the work (e.g., "send this message to this email address") to a reliable queue (e.g., Azure Queue / Amazon SQS / etc), and then have a separate background process read and process that queue (e.g., ASP.NET Core background service / Azure Function / Amazon Lambda / etc).
You can use background Task queue for this kind of works and run them in the background.
full info at Microsoft Documents Background tasks with hosted services in ASP.NET Core
Taking as an example the flow described in the Corda documentation (see here), how can Bob receive the notification that the transaction he just signed has been completed, without polling his own vault?
Does a specific callback exist?
I need that the CorDapp running on Bob node communicates to another system the status of the transaction in real-time
Thanks a lot
Two ways you could achieve this:
1. Subscribe to update using Client
cordaRPCOPS.vaultTrack(<YourState>.class).getUpdates().subscribe( update -> {
update.getProduced().forEach(stateAndRef -> {
// Action to be Performed on State Update
});
});
2. Subscribe to update using CordaService:
getServiceHub().getVaultService().trackBy(<YourState>.class).getUpdates().subscribe( update -> {
update.getProduced().forEach(stateAndRef -> {
// Action to be Performed on State Update
});
});
In addition to Ashutosh's answer,
Inside a SpringBoot webserver that identifies an API to start your flow, you can use proxy.startTrackedFlowDynamic() (where proxy is your node's RPC connection); it returns a FlowProgressHandle which you can use to subscribe to flow events.
I was hoping to trigger a Pub/Sub function (using functions.pubsub / onPublish) whenever a new Pub/Sub message is sent to a topic/subscription in a third-party project i.e. cross projects.
After some research and experimentation I found that TopicBuilder throws an error if the topic name contains a / and it defaults to "projects/" + process.env.GCLOUD_PROJECT + "/topics/" + topic (https://github.com/firebase/firebase-functions/blob/master/src/providers/pubsub.ts).
I also found a post in Stack Overflow that says that "Firebase provides a (relatively thin) wrapper around Google Cloud Functions"
(What is the difference between Cloud Function and Firebase Functions?)
This led me to look into Google Cloud Functions. Whilst I was able to create a subscription in a project I own to a topic in a third-party project - after changing permissions in IAM - I could not find a way associate a function with the topic. Nor was I successful in associating a function with a topic and subscription in a third-party project. In the console I only see the topics in my project and I had no success using gcloud.
Has anyone had any success in using a function across projects and, if so, how did you achieve this and is there a documentation URL you could provide? If a function can't be triggered by a message to a topic and subscription in a third-party project can you think of a way that I could ingest third-party Pub/Sub data?
As Pub/Sub fees are billed to the project that contains the subscription I would prefer that the subscription resides in the third-party project with the topic.
Thank you
Google Cloud Functions currently does not not allow a function to listen to a resource in another project. For Cloud Pub/Sub triggers specifically you could get around this by deploying an HTTP-function and add a Pub/Sub push subscription to the topic that you want to fire that cross-project function.
A Google Cloud Function can't be triggered by a subsription to a topic of another project (since you can't subscribe to another project's topic).
But a Google Cloud Function can publish to a topic of another project (and then subscribers of this topic will be triggered).
I solved it by establishing a Google Cloud Function in the original project which listens to the original topic and reacts with publishing to a new topic in the other project. Therefore, the service account (...#appspot.gserviceaccount.com) of this function "in the middle" needs to be authorized by the new topic (console.cloud.google.com/cloudpubsub/topic/detail/...?project=...), i.e. add principal with role: "Pub/Sub Publisher"
import base64
import json
import os
from google.cloud import pubsub_v1
#https://cloud.google.com/functions/docs/calling/pubsub?hl=en#publishing_a_message_from_within_a_function
# Instantiates a Pub/Sub client
publisher = pubsub_v1.PublisherClient()
def notify(event, context):
project_id = os.environ.get('project_id')
topic_name = os.environ.get('topic_name')
# References an existing topic
topic_path = publisher.topic_path(project_id, topic_name)
message_json = json.dumps({
'data': {'message': 'here would be the message'}, # or you can pass the message of event/context
})
message_bytes = message_json.encode('utf-8')
# Publishes a message
try:
publish_future = publisher.publish(topic_path, data=message_bytes)
publish_future.result() # Verify the publish succeeded
return 'Message published.'
except Exception as e:
print(e)
return (e, 500)
google endpoints can be a easier solution to add auth to the function http.