How to make watson assistant search for multiple watson discovery collections? - webhooks

I am Using IBM cloud functions to link assistant and discovery. However, there is only 1 webhook url slot available, which means I can only use 1 function, which in turn can only have 1 collection Id.
I need a way through with assistant can look into multiple discovery collections.
Thank you.

There is within the Watson Discovery API an api call that will search multiple collections similar to the single collection api call. This particular call will take multiple collection id's and search these. The api call is similar to the single collection api call, and thus is a simple change to the cloud function. I have used it myself. Your only consideration now is if the different collections return different JSON payloads, and thus how you manage these. In my case I created a default standard JSON payload that then gets returned to Watson Assistant, and merge the different results into this standard payload.

Related

Track multiple context for the same Bot

We have a bot that will be used by different customers and depending on their database, sector of activity we're gonna have different answers from the bot and inputs from users. Intents etc will be the same for now we don't plan to make a custom bot for each customer.
What would be the best way to separate data per customer within Chatbase?
I'm not sure if we should use
A new API key for each customer (Do we have a limitation then?)
Differentiate them by the platform filter (seems to not be appropriated)
Differentiate them by the version filter (same it would feel a bit weird to me)
Using Custom Event, not sure how though
Example, in Dialogflow we pass the customer name/id as a context parameter.
Thank you for your question. You listed the two workarounds I would suggest, I will detail the pros/cons:
New API Key for each customer: Could become unwieldy to have to change bots everytime you want to look at a different users' metrics. You should also create a general api (bot) where you send all messages in order to get the aggregate metrics. This would mean making two api calls per message.
Differentiate by version filter: This would be the preferred method, however it could lengthen load times for your reports as your number of users grows. The advantage would be that all of your metrics are in one place, and they will be aggregated while only having to send one api call per message.

How to avoid circular Updates in 2-Way-Sync / Determine that list event is caused by skill itself?

The Alexa List API FAQ says as follows:
How can a developer determine that an event has been triggered due to their skill?
Consider this scenario:
The customer creates a to-do in the app.
The skill service uses the Skill Messaging API to send a message to the skill to create a list item in Alexa.
The skill receives the Skill Messaging API message and POSTs to householdlist and list items.
In response to the POST, the skill service records the alexa_item_id locally. An ItemsCreate event also occurs as a list item was just created. Alexa triggers an event even if a list item is created by calling List API. Skill developers can use the item_id value returned by CreateListItem to uniquely identify an item.
Now my question:
Is there any more precise information / sample on that? (I am still new to node.js and alexa development)
In my current skill implementation (AWS Lambda endpoint) list elements are added via ask list API which results in return in receiving the ItemsCreated event a few seconds later in the same lambda.
Currently I cannot filter out events like that which results in en endless circular update loop. The same is true for delete events while it stops after the first try here.
How can I determine that I can skip this event?
Where/how shall I store/cache this (e.g. the item_id mentioned above) information?
How do I get to this information seconds later (while other users may have called into the lambda meanwhile)?
Note:
Both happens out of session.
Seems there is no built-in way to achieve that.
From the FAQ I conclude that I need my own persistency (e.g. dynamoDB) and store item_id / user_id there in order to check the events.
https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs#persisting-skill-attributes-through-dynamodb
If any concerns or any easier way applicable - please let me know.
Ok You must use the Api with webhook
so, for any webhook event comes from system A , you must do a request api to the system B to get the data about this Item e.g
then you must compare the data which come by webhook and the data that return from api , if no difference then stop
else continue in effecting in the System B

Dialogflow: reference to output context in intent (ie what's this NodeJS Client Library for?)

In my NodeJS Dialogflow fulfillment, I want to reference an output context parameter from an intent from 2 requests ago within the session.
The queryResult of the latest request doesn't have that data. And the samples only seem to process WebhookRequest and WebhookResponse (
reference: https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/WebhookResponse )
If I can access https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/projects.agent.sessions.contexts/get I may be able to do it. But I don't quite understand if that implies mixing https://github.com/dialogflow/fulfillment-webhook-nodejs/blob/master/functions/index.js with this Client Library:
https://github.com/googleapis/nodejs-language .
In other words, it's not clear to me what the purpose of https://github.com/googleapis/nodejs-language is. Is nodejs-language intended to substitute actions-on-google fulfillments (in the format of https://github.com/dialogflow/fulfillment-webhook-nodejs/blob/master/functions/index.js ) ?
There is a lot going on here, and it isn't quite clear why you think things fit together the way you do.
The nodejs-language library is used to access Google's Natural Language API that runs as part of the Google Cloud Machine Learning API family. This is a completely separate product from the Google Assistant, Actions on Google, and Dialogflow systems. It is meant as an API for people who are looking for a pre-trained AI that can do things like sentiment and syntax analysis. It is not meant as a substitute for any part of the AoG or Dialogflow platform.
As long as the context set two requests ago was set with a lifetime more than 2, and wasn't cleared in between, then it still should be valid and sent to your fulfillment webhook. Since it sounds like you're using Dialogflow V2, you should be able to get all the currently valid contexts as part of the request that is sent to your fulfillment webhook by looking at the queryResult.contexts object in the request body.
If you're using the fulfillment-webhook-nodejs library that you referenced in your post, this should be available to you in the inputContexts variable.

Spring Integration querying multiple api's and aggregating the response

I'm a newbie to Spring Integration and am looking for a few pointers regarding how I could use it as follows:
Let's say I get a request from a client which for example is looking for a price comparison for some widget. On receipt of this request I would like to call out to multiple different company api's to get different prices and aggregate the each response (different response formats) before returning to the client.
I was just wondering which patterns I could use to do this
Looks like your requirements are fully covered with the Scatter-Gather pattern.
Spring Integration provides a particular implementation for you:
It is a compound endpoint, where the goal is to send a message to the recipients and aggregate the results. Quoting the EIP Book, it is a component for scenarios like best quote, when we need to request information from several suppliers and decide which one provides us with the best term for the requested item.

Retrieve a mailchimp list via GET

I am trying to retrieve a MailChimp list.
I have an API Key and a List ID, and while I understand that I can use the MailChimp API wrapper to achieve this I prefer to avoid implementing it since I only need to do this one task.
When I enter in my browser:
https://us3.api.mailchimp.com/2.0/lists/members?apikey=*****&id=******
I get a JSON result of my list - but it is limited to the first 25 subscribers. I don't see anything in the MailChimp API documentation about submitting a GET request to retrieve a list. Is it possible to do so? If so, how can I retrieve a full list?
Read this: http://apidocs.mailchimp.com/api/2.0/lists/members.php
Options are available via pagination.
You are supposed to POST the values in your request.
Looks like the best method is to use the MailChimp list method which "Exports/dumps members of a list and all of their associated details. This is a very similar to exporting via the web interface."
Read more at http://apidocs.mailchimp.com/export/1.0/list.func.php
Another option is to use API v1.3 listMembers function, more info here: http://apidocs.mailchimp.com/api/1.3/listmembers.func.php. v1.3 is deprecated, but it still functions properly.

Resources