How to save user response in DB or External System in watson assistant - watson-assistant

I'm new in IBM Watson Assistant. I have a use case where i have to ask user for their interest. and i need to save the response in db or call some API and post the user response. any how i want to capture user response in my own system.
I have done basic handson on Watson Assistant. Not able to figure out how to save user response in external system.
If the question is What is your favorite Mobile Brand.
Options: Apple , Samsung , Sony
If user Response with Apple. Then I need to save this in my system. So in future i can offer products according to customer interest.

The messages API Response includes everything you'd need. You could store that response in your database each time, or configure your application to only store specific responses (e.g. when a certain intent or entity is detected, since the response includes those data elements).
Put more simply, your application is already controlling the flow of information between the user and the Watson Assistant API, so you're in full control over when and how to capture the API Response data and store it wherever you'd like.

Related

Simple Esri/ArcGIS Online connection using a link or iframe

I was asked by a potential client if I can have my software interact with Esri/ArcGIS Online.
Use case: users is logged into SomeRandomSoftwareApp and is looking at a Widget, this Widget includes an Esri asset id, the user clicks a link that passes that ID to Esri/ArcGIS Online and behind the scenes the user is logged into Esri and they see the data associated with the Esri/ArcGIS Online.
Thanks, Keith
If I understand correctly, you have two options for this: API Keys or Application Credentials.
The first one, is a permanent token generated by the owner of the data that will allow the application easy access to it. This is still in beta, and it was not ready for use the last time I check some time ago.
The second one, the owner of the data will generate credentials for your application. With this credentials you will have to request a token each time you want to access the data, all this via OAuth 2.0.
Check the docs for more details ArcGIS Services - Security

Using Web Services to Load Customer Orders using .Net

I would like to create web service(s) that I can publish to external facing network to allow our customers team to send us CRUD operations on customer orders.
What would be the best practice in this case of using Microsoft or Open-Source technologies to serve the customer reqeusts?
Option1:
The web service accepts data XML/JSON
Stores the data locally in a file
A task picks up the file and attempts data load it in the background
Send an email for records that failed
Drawback here is the response from the web service will not be realtime and validation will be limited.
Option2:
The web service accepts data XML/JSON
Attempt data load
Respond immediately if load was success or failure
Drawback here is if the volume of orders increases increases several folds in near future if the infrastructure can handle it.
I am open to using REST with WCF or Web API and any other helpful technologies that can be scaled when demand grows.
Have you tried message queueing?
Basically, in this architecture, there is a client application (called producer) that submits a message to the message broker (message queue), and there is another application (called consumer) that connects to the broker and subscribes for the message to be processed.
The message can be just simple information or a task that will be processed by another application.
The application can act both as producer and consumer.
There are many message queue software, one of them is rabbitmq.
Here is the complete intro about this: https://www.cloudamqp.com/blog/2015-05-18-part1-rabbitmq-for-beginners-what-is-rabbitmq.html
Since the communication is done through the middleman (aka the message queue) it will not provide an immediate response. But you don't need to send the process result (i.e. Order processing in your case) to the email since the application can subscribe for the message of the result.
It is perfect to handle a huge load of processes. As always you can start small (even free) and scale up in the future.
Take a look at the pricing details https://www.cloudamqp.com/ that provides rabbitmq software as a service.
I do this using ActiveMQ as a central message broker (you can also use Azure Service Bus if you have an Azure subscription) and pre-baked domain objects. For your scenario it might look like:
The web service accepts data XML/JSON
yes, you have a REST service that accepts multipart requests, lets say JSON as it's easier to work with on the client side. Before you can send messages it's usually best to convert the incoming client message to a domain message, so all message consumers know the exact format to expect and can therefore validate the message. I usually create these using xsd.exe on Windows using an XSD file that describes the format of the object. xsd.exe turns that XSD into a C# class. It's then just a process of taking the JSON fields and populating an Order class. That Order then gets sent as a message to the broker. At that point you're now in guaranteed messaging land as JMS will take care of that and ActiveMQ will take care of message persistence.
Stores the data locally in a file
rather than a file, you convert the incoming JSON to a domain class, e.g. an Order instance. You'll never see JSON or XML beyond this point as it's all domain classes from here.
A task picks up the file and attempts data load it in the background
yes, the broker has routes defined in a Camel config that tells it to, for example, send messages coming in on the /client topic to the /orders topic. The task is set up as a durable topic subscriber so automatically gets that Order domain object.
Send an email for records that failed
if the Order object contains information about the client (email etc) then the task can send the email on failure but a better pattern is to route the failed Order to the /error topic where a different task, which again is a durable topic subscriber picks it up and logs/sends email/audits etc
if the volume of orders increases increases several folds in near
future
you can cluster the brokers and run multiple Order consumers. If you separate the failure handling into another route, all the order task has to do is process the order and route the message to either the /error or /success topic depending on the outcome. So each route provides a small piece of the puzzle and you can scale up the pieces if the puzzle gets too big.

How to take user input from api.ai(dialog flow) and store it in mysql database using php?

I want to take the user inputs through api.ai(dialog flow) chatbot and store it in MySQL database like asking the user details of name, age, contact num through chatbot and then the user details are to be stored in my database i.e.., MySQL database. After storing, at last, the chatbot should show the summary to the user for confirmation.
I am able to interact and continue the conversation with my chatbot but unable to store the user's inputs.
I was searching at different places but I can't get the right process. I am comfortable with PHP to get the data from api.ai and to store in MySQL database.
Any help would be appreciated.
"Thanks in Advance!"
You need to create a webhook to handle fulfillment from Dialogflow. This will be a publicly accessible URL that can take an HTTPS POST, with a JSON body. In your case, this will be your Heroku URL that you will enter into the Fulfillment tab in Dialogflow.
See https://dialogflow.com/docs/fulfillment for information about the JSON you are sent, the JSON you'll need to reply with, and other information you need to setup fulfillment.
In your PHP code - you can do whatever you want with the data being sent to you, including storing it in MySQL. You'll then send back JSON (see the above URL for the format) indicating how you want to reply to the user.

Microsoft Teams - Parameters for HTTPPost in webhook

I have created a simple incoming webhook for Teams that will send information to a channel when a new high-priority ticket is generated in our ticketing system. I want to add a button to the connector card that will allow a user to directly assign the ticket to themselves from Teams via an HttpPOST request.
I have the button and everything else in place, but I am having trouble determining how, if possible, I can send the user's account ID back to our ticketing system. Our system is connected via LDAP so usernames are the same across both platforms.
Is there general info on what is sent by default with an HttpPOST request? I looked through the Teams connector reference information, but could not find what I was looking for.
You need to include that account id you referred as a parameter in your url or JSON (if you post the it).
Microsoft Teams does not know anything about actions your use will attempt to make.

Implementing IoT PowerBI table schema

I'm currently implementing an IoT solution that has a bunch of sensors sending information in JSON format through a gateway.
I was reading about doing this on azure but couldn't quite figure out how the JSON scheme and the Event Hubs work to display the info on PowerBI?
Can I create a schema and upload it to PowerBI then connect it to my device?
there's multiple sides to this. To start with, the IoT ingestion in Azure is done tru Event Hubs as you've mentioned. If your gateway is able to do a RESTful call to the Event Hubs entry point, Event Hubs will get this data and store it temporarily for the retention period specified. Then stream analytics, will consume the data from Event Hubs and will enable you to do further processing and divert the data to different outputs. In your case, you can set one of the outputs to be a PowerBI dashboard which you can authorize with an organizational account (more on that later) and the output will automatically tied to PowerBI. The data schema part is interesting, the JSON itself defines the data table schema to be used on PowerBI side and will propagate from EventHubs to Stream Analytics to PowerBI with the first JSON package sent. Once the schema is there it is fixed and the rest of the data being streamed in should be in the same format.
If you don't have an organizational account at hand to use with PowerBI, you can register your domain under Azure Active Directory and use that account since it is considered within your org.
There may be a way of altering the schema afterwards using PowerBI rest api. Kindly find the links below..Haven't tried it myself tho.
https://msdn.microsoft.com/en-us/library/mt203557.aspx
Stream analytics with powerbi
Hope this helps, let me know if you need further info.
One way to achieve this is to send your data to Azure Events Hub, read it and send it to PowerBI with Stream Analytics. Listing all the steps here would be too long. I suggest that you take a look at a series of blog posts I wrote describing how I built a demo similar to what you try to achieve. That should give you enough info to get you started.
http://guyb.ca/IoTAzureDemo