I can successfully upload an image to my bot, which has a property dialogue.attachments. Dialogue.attachments looks like this:
“lgType”: “Activity”,
“text”: [
{
"contentType": "image/png",
"contentUrl": "http://localhost:5000/v3/attachments/0e8f3c75-cb9f-4aa0-9a46-0756c3c7a6c9/views/original",
"content": null,
"name": "Test Ankle - Swollen.png",
"thumbnailUrl": null
}
]
}
How do I access the contentUrl into a variable (or "property") so I can use it elsewhere in an image analysis api? I need to be able to do this from within the Bot Framework Composer.
You can access the property - contentUrl by using the getProperty Object Manipulation function
e.g. getProperty(obj, "contentUrl")
or using dot notation
obj.contentUrl
Related
I'm not able to send a POST or PATCH action thru the connector because I can't figure out how to compose the body correctly.
I try it that way:
But I get this error:
I try it without brakets, with more brakets, with single, double and without quotations but it seems nothing works.
Please can anyone tell me how to compose the body in the right way?
Thx!
Look like the body is not a valid json. Properties givenName, surname, etc. should be wrapped by quotes.
{
"givenName": "Microsoft",
"surname": "Graph",
"emailAddresses": [
{
"address": "Microsoft.graph#api.com",
"name": "Microsoft Graph"
}
],
"businessPhones": [
"+334100100"
],
"mobilePhone": "+9857665765"
}
I am trying to create a pipeline where I want to store a particular value from a web activity in azure data factory, in a variable, so that I can pass it to other activities.
I want to get the export ID but I keep running into errors.
The response of the web activity looks like this:
{
"requestId": "----",
"result": [
{
"exportId": "---",
"format": "CSV",
"status": "Created",
"createdAt": "2020-12-15T16:03:01Z"
}
],
"success": true
}
I have tried the following methods but it fails: #string(activity('Web1').output.result.exportId
#string(activity('Web1').output.result[0].exportId
#string(activity('Web1').output.result.[0]
first(#string(activity('Web1').output.result)
enter image description here
enter image description here
I have tried this. Your second expression should work #string(activity('Web1').output.result[0].exportId)
My test
Output of Web activity
These expressions also work fine on my side, you can have a try:
#string(activity('Web1').output['result'][0]['exportId'])
#string(activity('Web1').output.result[0].exportId)
#string(first(activity('Web1').output['result']).exportId)
#string(json(activity('Web1').output.response)[0]['Id'])
Here is my db.json :
{
"users": [
{
"id": "1"
"name": "John"
}
]
}
I'd like to be able to update the user id by sending a PUT request on the existing user. But the following does not work:
Request URL :
PUT /users/1
with body:
{
"id": "2"
"name": "John"
}
Is there a way to update an object id?
If you are using PUT request means ,the request URL should be like this "PUT/users/1" .
Refer below mentioned image.
I'm using postman to send put request
This does not seem to be possible, as said in documentation:
Id values are not mutable. Any id value in the body of your PUT or
PATCH request will be ignored. Only a value set in a POST request will
be respected, but only if not already taken.
i am trying to use the REST-API of my domino lotus notes server (9.0.1FP8)
It works for simple text-fields but if I try to add an rich-text-item as json, the domino server receives only the text-fields and the richt-text field is empty.
I try it with Postman and a Postrequest to http://localhost/Test/JSON_Vie…s/name/List?form=mainForm,
where I send the json
{
"title":"test rich text",
"artist":"rich texter",
"ntracks":1,
"attachments": {
"type": "multipart",
"content": [
{
"contentType": "multipart/alternative; Boundary=\"0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1\"",
"contentDisposition": "inline"
},
{
"contentType": "text/plain; charset=US-ASCII",
"data": "test rich text",
"boundary": "--0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1"
},
{
"contentType": "text/html; charset=US-ASCII",
"contentDisposition": "inline",
"data": "<html><body><font size=\"2\" face=\"sans-serif\"><b>test rich text</b></font></body></html>",
"boundary": "--0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1"
}
]
}
}
The mask mainForm has the text-fields "title", "artist" , "ntracks" and the rich text-field "attachments".
How can I send an image as json and what is "boundary"?
Have you any idea , what's going wrong?
According to the documentation from IBM you need to use PUT (instead of POST) in order to update the fields.
After experimenting a little bit, I now know what was wrong. If I do the POST on the address http://localhost/Test/JSON_Views.nsf/api/data/documents?form=mainForm it works with the attachment. If I use http://localhost/Test/JSON_Views.nsf/api/data/collections/name/List?form=mainForm&computewithform=true the attachment field is ignored. But maybe you can explain me, what the extra field boundary is and if I can set the contentLocation by the name of my attachment?
I have created a trivia game using the SDK, it takes user input and then compares it to a value in my DB to see if its correct.
At the moment, I am just passing a raw input variable through my conversation, this means that it regularly fails when it mishears the user since the exact string which was picked up is rarely == to the value in the DB.
Specifically I would like it to only pick up numbers, and for example realise that it must extract '10' , from a speech input of 'my answer is 10'.
{
"actions": [
{
"description": "Default Welcome Intent",
"name": "MAIN",
"fulfillment": {
"conversationName": "welcome"
},
"intent": {
"name": "actions.intent.MAIN"
}
},
{
"description": "response",
"name": "Raw input",
"fulfillment": {
"conversationName": "rawInput"
},
"intent": {
"name": "raw.input",
"parameters": [{
"name": "number",
"type": "org.schema.type.Number"
}],
"trigger": {
"queryPatterns":[
"$org.schema.type.Number:number is the answer",
"$org.schema.type.Number:number",
"My answer is $org.schema.type.Number:number"
]
}
}
}
],
"conversations": {
"welcome": {
"name": "welcome",
"url": "https://us-central1-triviagame",
"fulfillmentApiVersion": 2
},
"rawInput": {
"name": "rawInput",
"url": "https://us-central1-triviagame",
"fulfillmentApiVersion": 2
}
}
}
app.intent('actions.intent.MAIN', (conv) => {
conv.data.answers = answersArr;
conv.data.questions = questionsArr;
conv.data.counter = answersArr.length;
var thisQuestion = conv.data.questions;
conv.ask((conv.data.answers)[0]));
});
app.intent('raw.input', (conv, input) => {
if(input == ((conv.data.answers)[0])){
conv.ask(nextQuestion());
}
app.intent('actions.intent.TEXT', (conv,input) => {
//verifying if input and db value are equal
// at the moment input is equal to 'my number is 10' (for example) instead of '10'
//therefore the string verification never works
conv.ask(nextQuestion());
});
In a previous project i used the dialogflow UI and I used this #system.entities number parameter along with creating some training phrases so it understands different speech patterns.
This input parameter I am passing through my conv , is only a raw string where I'd like it to be filtered using some sort of entity schema.
How do I create the same effect of training phrases/entities using the JSON file?
You can't do this using just the Action SDK. You need a Natural Language Processing system (such as Dialogflow) to handle this as well. The Action SDK, by itself, will do speech-to-text, and will use the actions.json configuration to help shape how to interpret the text. But it will only return the entire text from the user - it will not try to determine how it might match an Intent, nor what parameters may exist in it.
To do that, you need an NLP/NLU system. You don't need to use Dialogflow, but you will need something that does the parsing. Trying to do it with simple pattern matching or regular expressions will lead to nightmares - find a good system to do it.
If you want to stick to things you can edit yourself, Dialogflow does allow you to download its configuration files (they're just JSON), edit them, and update or replace the configuration through the UI or an API.