Dialogflow V2 API says my Webhook response was empty - google-api

I am trying to use the Dialogflow V2 API to add two numbers, to do this I have setup a web server with HTTPS access to complete the request. in the Diagnostic Info screen in the Dialogflow console I can see the Fulfilment Response from my remote server:
{
"fulfillmentText": "the sum of 5 and 9 is 14",
"fulfillmentMessages": [
{
"text": {
"text": [
"the sum of 5 and 9 is 14"
]
}
}
],
"source": "-------.com",
"payload": {
"google": {
"expectUserResponse": 1,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "the sum of 5 and 9 is 14"
}
}
]
}
},
"facebook": {
"text": "the sum of 5 and 9 is 14"
},
"slack": {
"text": "the sum of 5 and 9 is 14"
}
},
"outputContexts": [
{
"name": "-----892446d1-----",
"lifespanCount": 1,
"parameters": {
"number": 5,
"number1": 9
}
}
]
}
Which has been adapted from the example given in the docs: https://dialogflow.com/docs/intro/fulfillment but in the Raw API response I see:
"webhookStatus": {
"code": 3,
"message": "Webhook call failed. Error: Webhook response was empty."
}
Clearly the response is not empty as it can be seen in the Diagnostic Info. Has anyone any ideas as to what is causing this?
Thanks

We can find definition of the codes in google.rpc package error codes,
"code": 3
means "INVALID_ARGUMENT"
// The client specified an invalid argument. Note that this differs
// from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
// that are problematic regardless of the state of the system //
(e.g., a malformed file name).
For example according to request format "parameters" field in "outputContexts" should have format "param": "param value", in your request it looks like "param": param value.
Please check all arguments in your request.

Related

Send Conversation History API returning HTTP 400 BotFramework

I'm trying to sendConversation History API provided by Microsoft in BotFramework Documentation. It takes Transcript object (array of activities) as the input. But I've getting HTTP 400 Bad Request when using trying that.
I'm making a POST request on this and authenticating it using JWT Token generated by client credentials for the bot.
https://directline.botframework.com/v3/conversations/HBoZPkTiBYOAadigqEqFaJ-us/activities/history
This is the error I get.
{
"error": {
"code": "BadSyntax",
"message": "Invalid or missing activities"
}
}
This is the activity array payload that I'm using
[
{
"type": "message",
"id": "HBoZPkTiBYOAadigqEqFaJ-us|0000003",
"timestamp": "2022-09-05T08:10:00.3574378Z",
"localTimestamp": "2022-09-05T13:39:57.633+05:30",
"localTimezone": "Asia/Calcutta",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "dl_uID1",
"name": "userName"
},
"conversation": {
"id": "HBoZPkTiBYOAadigqEqFaJ-us"
},
"recipient": {
"id": "bot-name-dev#abcd",
"name": "bot-name-dev"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "hi",
"channelData": {
"clientActivityID": "1662365337633rmq6e8mbm09",
"clientTimestamp": "2022-09-05T08:09:57.633Z"
}
}
]
I'm not able to figure out what's the correct format of activity object that it is expecting.
Create the bot and get it connected to the Direct Line. Get the secret keys of the site that need to connect.
Before calling SendConversationHistory if the message is delivered to the recipient, it will create the bad request error message as it is unable to get the conversation history as the message was already received. SendConversationHistory must be called before sending the message then the Conversation History will be tracked. The below screens will be helpful to create the DirectLine connection to the bot created. Then needed to add the trusted sites to DirectLine. Then proceed with the code sample mentioned below which takes the conversation history.
Click on Create a resource
Search for bot and click on create
Select Channels
Get the App Service Extension Keys and click on Default_site
Click on the toggle and enable the enhanced authentication options and add the website which we need to communicate.
In the code block of the current working application, to get the conversation history, use the following code block.
foreach (var a in activities)
{
incrementId++;
// Use your own ID format
a.Id = string.Concat("history|", incrementId.ToString().PadLeft(7, '0'));
a.ChannelData = null;
a.Conversation = new ConversationAccount(id: convId);
if (a.From.Name == message.Recipient.Name)
{
// Bot to recipient connection
a.Recipient = message.From;
a.From = message.Recipient;
}
else
{
// User to bot connection (here bot will be the recipient)
a.Recipient = message.Recipient;
a.From = message.From;
}
}
After connecting with Microsoft, I found this is the correct payload for this API.
{
"activities": [
{
"type": "message",
"id": "whatever-conversation-id-in|0000000",
"timestamp": "2022-11-20T20:14:26.242902Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "dl_test_id",
"name": ""
},
"conversation": {
"id": "whatever-conversation-id-in"
},
"recipient": {
"id": "ABC_bot",
"name": "ABC_bot"
},
"text": "Hello Bot"
}
]
}

Strtapi GraphQL: Field "ressourcePost" is not defined by type "MarketingRessourcePageFiltersInput"

Currently im trying to make a request to my local strapi with graphQL,in the playground works just fine.
But i try to do the same request with same query from my FE app and i get this message with code error 400
{
"errors": [
{
"message": "Field \"ressourcePost\" is not defined by type \"MarketingRessourcePageFiltersInput\".",
"locations": [{ "line": 5, "column": 21 }],
"extensions": { "code": "GRAPHQL_VALIDATION_FAILED" }
}
]
}

Google Ads API - Optimize Campaign By Specific Conversion Action(s)

I am using Google Ads PHP library to create Campaign.
I created almost any type of campaigns but didn't manage to optimize them by specific Conversion Actions.
For example:
I have created 3 different Conversion Actions:
customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_0]
customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_1]
customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_2]
Then I created a Campaign:
customers/[CUSTOMER_ID]/campaigns/[CAMPAIGN_ID]
I set bidding strategy to MAXIMIZE_CONVERSIONS and then tried to set Conversion Actions to optimize to.
This is my code snippet:
$campaign->setMaximizeConversions(
new CommonMaximizeConversions([
'target_cpa' => $this->convert()->micros(1)
])
);
$campaign->setSelectiveOptimization(
new SelectiveOptimization([
'conversion_actions' => [
'customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_0]',
'customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_1]'
]
])
);
It gives me this error:
{
"message": {
"message": "Request contains an invalid argument.",
"code": 3,
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.ads.googleads.v10.errors.GoogleAdsFailure",
"errors": [
{
"errorCode": {
"requestError": "UNKNOWN"
},
"message": "The error code is not in this version.",
"trigger": {
"stringValue": ""
},
"location": {
"fieldPathElements": [
{
"fieldName": "operations",
"index": 0
},
{
"fieldName": "create"
},
{
"fieldName": "selective_optimization"
},
{
"fieldName": "conversion_actions"
}
]
}
}
],
"requestId": "xbgMUFFeP4447GFW_nJrIA"
}
]
},
}
Can you tell me what I am doing wrong? Or suggest any help?.
Thanks.

How to partial match response in the artillery tool?

I am using artillery tool for websocket testing. The problem I am facing is with response. After emitting data to the channel that I am testing, we always get different data. As artillery's Response block tries to match completely with the actual response from the channel (i.e It doesn't match partially) , I am always getting a error 'data is not valid: 1'. How to match partially the response?
Below response code is working.
{
"response": {
"channel": "channel1",
"match": [
{
"json": "$.Id",
"value": "test_101"
},
{
"json": "$.param1",
"value": "1"
},
{
"json": "$.param2",
"value": "XXX"
},
{
"json": "$.param3",
"value": "100"
}
]
}
}

Elasticsearch5, storing servers logs, find all servers having two given log message

I have the following mapping (I'm using elasticsearch5)
curl -XPUT 'http://localhost:9200/server_logs8?pretty' -d '
{
"mappings": {
"kafka-connect": {
"properties": {
"message": {
"type": "string"
},
"server_name": {
"type": "string"
},
"timestamp": {
"type": "date"
}
}
}
}
}
'
I'm looking for a specific faulty behaviour on my servers, and I need to know which servers are affected. To find them I need to do the following
Find all the server_id that have both "message_a" and "message_b"
for example if I have the documents (one by line)
{"server_id": 1 , "message": "message_a"}
{"server_id": 1 , "message": "message_c"}
{"server_id": 1 , "message": "message_b"}
{"server_id": 2 , "message": "message_d"}
{"server_id": 2 , "message": "message_a"}
{"server_id": 3 , "message": "message_a"}
{"server_id": 3 , "message": "message_b"}
I want it to return me [1, 3]
Is it possible to do this with ElasticSearch in one query ?
Currently I'm doing a first request "message_a" and then a second request "message_b", and I do the intersection of the two set of "server_id" i got, but I would like to do that in one request (especially if I can create a visuazation in Kibana from there)

Resources