Payload sending to getStream.io server
{
"feed": {
"actor": 1986,
"created_at": 1455690430,
"foreign_id": "1986",
"object": {
"full_name": "Harsewak Singh",
"login": "harsewak",
"pic_url": "https:\/\/qbapi.dekhdekh.com\/blobs\/b6e113a29bb34905a14a520917f6da0a00",
"user": 1986
},
"post": {
"created_at": 1455690430,
"message": "Hey! How's everyone?",
"type": "text"
},
"to": ["flat:global"],
"verb": "post"
},
"feed_type": "flat",
"user_id": 1986
}
But when data is returned value of object isn't same as sent
It's as follows
"object":
"{u'login': u'harsewak', u'pic_url': u'https://qbapi.dekhdekh.com/blobs/b6e113a29bb34905a14a520917f6da0a00', u'full_name': u'Harsewak Singh', u'user': 1986}"
Q. Why u' is added in response after replaceing double quotes ("login")?
Sending nested data in the object field is currently not supported by Stream's APIs.
if you are using Laravel and Eloquent, you should integrate your models like documented here: https://github.com/GetStream/stream-laravel#eloquent-integration This way you will get serialization and deserialization working for free.
Related
Parsed Message
{
"date": "2022-02-04",
"customerID": 123,
"customerInfo": {
"id": 123,
"lastname": "Smith",
"firstname": "David",
"email": "testing#email.com",
},
"currency": "EUR"
}
I would like to remove the customerInfo section so the JSON looks like.
{
"date": "2022-02-04",
"customerID": 123,
"currency": "EUR"
}
How would one do this in the LogicApp. I tried remove property but could not get that working. Any suggestions would be appreciated.
I have reproduced in my environment and removed customer info using remove property as below :
Firstly, I have initialized a variable as below:
Then I used compose operation as below:
In compose input: removeProperty(variables('emo'),'customerInfo')
Then i have set the variable with output of compose as below:
Output:
Try to follow above process you will get to remove customerInfo as mine got.
You just initialize new variable from that one and populate it
"Initialize_variable": {
"type": "InitializeVariable",
"inputs": {
"variables": [ {
"name": "sensitisedMessage",
"type": "Object",
"value": { "date": #message['date'], "customerID": #message['customerID'], "currency": "#message['currency']" }
} ]
},
"runAfter": {}
}
I have not checked the format of the json in an actual logic app, but you get the idea
I have a strapi project and A single users have relation a single profile. For example if we using postman to get a single user it have response
[
{
"id": 45,
"username": "test",
"email": "test#gmail.com",
"provider": "local",
"confirmed": true,
"blocked": false,
"createdAt": "2022-07-18T08:50:43.642Z",
"updatedAt": "2022-07-18T08:50:43.642Z",
"profile": null
}
]
As you can see a user have a profile but have a null value. So when I tried to post a profile in strapi api http://localhost:1337/api/profiles?populate=* with body of json like this
{
"data" : {
"name": "fgh",
"address": "jksdjkdjs",
"phone": "345345",
"email" : "test#gmail.com" /// I tried to add this but the response is 500 internal server error
}}
It worked and status 200 ok but it didn't get the relation of the email from user
{
"data": {
"id": 12,
"attributes": {
"name": "fghdff",
"address": "jksdjkdjs",
"phone": 34534235,
"createdAt": "2022-08-05T13:48:29.548Z",
"updatedAt": "2022-08-05T13:48:29.548Z",
"publishedAt": "2022-08-05T13:48:29.547Z",
"email": {
"data": null
}
}
},
"meta": {}}
Any Idea how to post a relation in strapi? I tried to read docs or strapi forum but no one counter this problem
For someone facing how to POST relation in strapi we can use the ID of the User. For example to post and connect in my question is
{
"data" : {
"name": "dayee",
"address": "jksdjkdjs",
"phone": "34534235",
"email" : 77 // Post relation using ID
}}
I'm using https://chatbase.com/api/messages Chatbase API to send multiple messages to the Chatbase. The documentation stats that the response would provide error and success for individual messages that are sent in the request.
How I should detect which message is failed out of the 3 messages that I have provided in the request if the response provides error for one message?
JSON Request body for sending multiple messages
{
"messages": [
{
"api_key": "<API KEY>",
"type": "agent",
"user_id": "User_1",
"time_stamp": 1542895834,
"platform": "XXX",
"message": "Test 1",
"not_handled": false,
"version": "1.0",
"session_id": "session-User_1"
},
{
"api_key": "<API KEY>",
"type": "agent",
"user_id": "User_1",
"time_stamp": 1542895834,
"platform": "XXX",
"message": "Test 2",
"not_handled": false,
"version": "1.0",
"session_id": "session-User_1"
},
{
"api_key": "<API KEY>",
"type": "agent",
"user_id": "User_1",
"time_stamp": 1542895834,
"platform": "XXX",
"message": "Test 3",
"not_handled": false,
"version": "1.0",
"session_id": "session-User_1"
}
]
}
JSON Response body
{
"all_succeeded": false,
"responses": [
{
"error": "Error fetching parameter 'type': Invalid conversation type [dfg]",
"status": "error"
},
{
"message_id": 139429278,
"status": "success"
},
{
"error": "Error fetching parameter 'time_stamp': Received a time (1921-02-09 09:49:26) which was too small. Please send a time within the past day for metrics to appear in the dashboards, or omit the time_stamp field for the time to automatically be set to now.",
"status": "error"
}
],
"status": 200
}
The order of the error messages will correspond to the order of the messages you submitted. In this case, it was the first and third messages. I also noticed that you are not using unix milliseconds in your timestamps. The messages will need to be at least one millisecond apart in order to sort them correctly in the Chatbase reports.
I am building an Android Application where i am passing the request from the app to Dialogflow. Dialog flow then passes it to a Node.js script and query a database for result and finally send the response to the Android device. Now the query results are stored inside "payload" of "messages". However I am unable o access the payload part. I mean I can access "messages" with getMessages but I cannot probe further into messages. The response from Dialogflow is as below and i want to access the elements tag in the below JSON. How can I do it? Thanks
RESPONSE RECEIVED IN ANDROID from Dialogflow.
{
"lang": "en",
"result": {
"source": "agent",
"fulfillment": {
"speech": "",
"messages": [
{
"type": 0,
"speech": ""
},
{
"type": 4,
"payload": {
"template_type": "list",
"elements": [
{
"NAME": "francis electrician",
"CONTACT": "98199 66928",
"ADDRESS": "sundar nagar, santacruz east, mumbai, maharashtra, india",
"AREA": "santacruz"
},
{
"NAME": "raj electrician\n",
"CONTACT": " 98205 45064",
"ADDRESS": "jdb seva sangh, gazdhar bandh sb patil road, govind nagar, santacruz west,, mumbai, maharashtra 400054, india",
"AREA": "santacruz"
}
]
}
}
]
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
}
}
You may use Android Dialogflow SDK. This may help you in building Android app integrated with Dialogflow. It will do the parsing on its own and give you objects to play with. Check out the documentation on their Github page for details.
I'm currently using Dialogflow in combination with fulfillment/webhooks.
In the documentation of the fulfillments there is an example POST request for webhooks:
POST body:
{
"contexts": [
string
],
"lang": string,
"query": string,
"sessionId": string,
"timezone": string
}
The request that I'm receiving on my end is different from what is defined in the documentation. Has somebody an idea why?
This is what I receive:
{
"id": "GUID",
"timestamp": "2018-01-12T12:25:32.202Z",
"lang": "de",
"result": {
"source": "agent",
"resolvedQuery": "Test",
"speech": "",
"action": "",
"actionIncomplete": false,
"parameters": {
"Nummer": ""
},
"contexts": [],
"metadata": {
"intentId": "XYZ",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"intentName": "Intent"
},
"fulfillment": {
"speech": "",
"messages": [{
"type": 0,
"speech": ""
}]
},
"score": 0.6700000166893005
},
"status": {
"code": 200,
"errorType": "success",
"webhookTimedOut": false
},
"sessionId": "GUID"
}
I've found that different invocation sources send slightly different data to the web hook.
For example the Google Action simulator will send different information in the context reply than say the test pane in an intent.
Im guessing that the answer may lie in where/how your calling the web hook.