When performing a GET Request on my Webhook (after triggering it) it returns the following response:
{
"id": "09292225-474a-408f-ab9d-ea2bc66e7fc4",
"request_id": "5f71ac28-98ff-4a01-b542-74ef3b21b700",
"attempt": "5f71ac28-98ff-4a01-b542-74ef3b21b700",
"status": "success"
}
but as I understand, it should be returning the JSON informations of the triggering event (like name, email, username ...)
What am I doing wrong?
This is the correct response - it's Zapier informing you that your webhook was received. Since task execution happens asynchronously on Zapier, further info cannot be returned about the result of the webhook.
Related
Facing issue to send proactive message to the end user (msteams), via bot service,
I try using the bot framework python SDK, where I am getting the following error even for getting conversation id.
botbuilder.schema._models_py3.ErrorResponseException: Operation returned an invalid status code 'Unauthorized'
Hence I try to simulate calls via postman and rest API's, in here I am able to get conversation id successfully, but if I try to use that conversation id to further send a message via activities I am not able to do it. following is rest endpoint and payload. In here I am getting an error of incorrect payload.
https://smba.trafficmanager.net/apis/v3/conversations/8:orgid:949a3f72-b82c-4b89-b2de-9defbe6ae7cd/activities
{
"type": "message",
"recipient": {
"id": "29:1ZcsKdk0rsLmsywvI2SNQ2J7OIz"
},
"from": "bot",
"channelData": {
"notification": {
"alert": "true"
}
},
"text": "Hello world"
}
There was an issue with payload, I added BOT_ID along with name and able to successfully post message to end user. Following is working payload.
Payload:
{ "type":"message",
"recipient":{
"id":"29:1dUxQXVlH6QGByu1T9MR4p5g0c5URMaBtKqGU74C3zdowO78nPbuu2dg- qj9o02OkJ4MYXt2I-nxDgf9ga9EY5w"
},
"from":{
"id":"28:d7afe8c9-f0cd-434f-8906-be2b744229ac",
"name":"bot"
},
"channelData":{
"notification":{
"alert":"true"
}
},
"text":"Hello "
}
I have:
An JavaScript Azure Function in an HTTP webhook configuration; the Function provides a URL; the Function performs an action
A webhook configured in the software I hope to receive notifications from
An Azure Logic App with an HTTP/webhook step that provides a URL for the webhook notification to go to
My goal is that the Azure Function's URL receives notifications from the software's webhook and performs an action. The Azure Logic App is for testing only.
What works
When the the Azure Logic App's URL is used in the software's webhook configuration, the desired action is performed. All works as expected.
The Azure Logic App's logging shows the JSON output from the incoming webhook. I expect (but believe this may be where I am going wrong) that this is the JSON the webhook is sending to the Azure Logic App's URL. When this JSON is used in the Azure Function UI's "Test" tab > "Request body" field, the desired action is performed. All works as expected.
When the Azure Function's URL and the JSON is in a Postman request, the desired action is performed. All works as expected.
What doesn't work
When the Azure Function's URL is used in the software's webhook configuration, no action is performed. This is of course my goal. From everything I have read, I understand that this URL as a webhook endpoint should work.
Azure Function's URL
This is from Get function URL > default (Function key).
https://<app_name>.azurewebsites.net/api/content?code=<api_key>
Other Azure Function config settings
Allowed HTTP methods: GET, POST
Authorization level: Function
The JSON I believe to be coming over the webhook
{
"headers": {
"Expect": "100-continue",
"Host": "redacted",
"X-Telligent-Webhook-Sender": "redacted",
"Content-Length": "16908",
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
}
I also tried with the following test code for the same results. It aligns more closely with the sample payload data provided by the software company:
What I tried
{
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
Sample payload data
{
"events": [
{
"TypeId": "407ad3bc-8269-493e-ac56-9127656527df",
"DateOccurred": "2015-12-04T16:31:55.5383926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
},
{
"TypeId": "3b75c5b9-4705-4a97-93f5-a4941dc69bc9",
"DateOccurred": "2015-12-04T16:48:03.7343926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
}
]
}
I do not know how to determine why the Azure Function is not triggered by the webhook. The software's API documentation does not seem to provide a way to look at the JSON being sent over the webhook, although in my inexperience I may be wrong.
Is there a mechanism within Azure, or Postman, or another tool that lets me see what JSON is being sent over the webhook? Or perhaps is there another approach to determining the cause of the issue?
Thank you for any help.
This is how I got the JSON file from Azure alerts.
Install Ruby on the server
Install Sinatra with following command gem install sinatra
Create file webhook.rb and paste code bellow
require 'sinatra'
set :port, 80
set :bind, '0.0.0.0'
post '/event' do
status 204 #successful request with no body content
request.body.rewind
request_payload = JSON.parse(request.body.read)
#append the payload to a file
File.open("events.txt", "a") do |f|
f.puts(request_payload)
end
end
Run the web service with command ruby webhook.rb
JSON fill be written to file events.txt
I want to print the fulfilment response that I am getting from the webhook back to the user.
Using an open API for Cryptocompare as the webhook, i am receiving the JSON response i need, however I do not know how to print the response for the user (also translate from JSON to text)
Fulfilment Response:
{
"BTC": 0.03181,
"USD": 199.25,
"EUR": 171.74
}
Fulfillment Status:
Webhook execution successful
I'm assuming i need to some how echo/print it under the custom payload tab.
You might need to convert the JSON response to string in order to print it out. JSON.stringify() could the the job, put your return data inside the bracket.
Hi I am trying to use workato to create a task for Podio. I have successfully connected to Podio using their HTTP OAUTH2 connection, but when I try to actually create the task using JSON, I receive this from Podio:
This is from HTTP:
400 Bad Request:
{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http://api.podio.com/task/","query_string":"","method":"POST"},"error_description":"Invalid
JSON","error":"invalid_value"}
The Code is as follows:
Request URL : https://api.podio.com/task/item/"the item id" <--This is where I would place the itemID of the item in Podio
Request header:
Authorization: OAuth2 [[User.SiteAccessToken]]
Content-type: application/json
Request Body:
{
"text": "Regarding Absence Request for Vacation",
"responsible":"{"type":profile, "id": "this is my profileID" }",
"description": "Your request for Vacation has been denied, please contact your manager."
}
but when I run this, I get this error message:
400 Bad Request:
{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http://api.podio.com/task/item/436023600","query_string":"","method":"POST"},"error_description":"Invalid
JSON","error":"invalid_value"}
Now within the the request body or header does it need to have which app I am referring to not just the item ID. Not sure what it's looking for, if you could please assist with some guidance, that would be greatly appreciated.
I discovered that the issue was indeed the syntax within the JSON sent in the request body.
The quotes around the curly braces for responsible needed to be removed and I needed quotes with profile, and it should have gone like this:
{
"text": "Regarding Absence Request for Vacation",
"responsible": {"type":"profile", "id": 123 },
"description": "Your request for Vacation has been denied, please contact your manager."
}
I'm getting empty response posts from google drive push notification api. I'm not sure if I'm not looking correctly at the posted data to my listening app or if I'm incorrectly setting up my channels.
I've able to setup channels verified with the responses like:
[14-07-26 14:27:19:697 EDT] {
"kind": "api#channel",
"id": "ce976221-7f6c-44bd-82f3-6a7a539fbc18",
"resourceId": "YTWyD_gD_mUUBM8Ttrqc6P6ZCxI",
"resourceUri": "https://www.googleapis.com/drive/v2/files/1T0GX4lBx6yH2DHMAS624qk5bQylZm1kRs_rE8tIHS_c?updateViewedDate=false&alt=json",
"token": "caller=https://script.google.com/a/macros/ccsknights.org/s/AKfycbxc0JwGl-TptxgsHhWPaAZbIgQXRk7fhB282ReOa09f_6HmGPkw/exec",
"expiration": "1406402836000"
}
And my listening app does receive notifications as I mess with the test document. I do a dump of the entire posted data but it shows up as:
{queryString=null, parameter={}, contextPath=, parameters={}, contentLength=0}
I've posted other data to the app to test it and it shows up as expected:
{queryString=bob/asdasd/asdasdsd/adsad, postData=FileUpload, parameter={test=yes, test2=no, bob/asdasd/asdasdsd/adsad=}, contextPath=, parameters={test=[Ljava.lang.Object;#2fc540bd, test2=[Ljava.lang.Object;#3f1d50cb, bob/asdasd/asdasdsd/adsad=[Ljava.lang.Object;#1da35fcc}, contentLength=17}
The listening app is simply:
var sslog = SpreadsheetApp.openById('1dOic6cWtTuj7lxi-QoRK2hrlXArd2C5ZlqOEmCvJ6R0').getSheets()[0];
function doPost(e) {
sslog.appendRow([e]);
return 200;
//return ContentService.createTextOutput().setContent(JSON.stringify(e)).setMimeType(ContentService.Mi meType.JSON);
}
Is there something I'm missing to be able to extract the push notification data from the post?
The correct answer is the post body is retrieved in the postData object. It was added but not documented. You can find more about it at: https://developers.google.com/apps-script/releases/2013
function doPost(e) {
Logger.log(e.postData.getDataAsString());
}
If you are watching a File resource, POST body is always empty. All of the information that's available to you is contained in "X-Goog-*" headers.