[英]How to receive response from Zoho Sign Webhook
I am able to hit my call back function from Zoho Sign webhook.我可以从 Zoho Sign webhook 回电 function。 But I am not able to figure out how can I receive the response that Zoho Sign sends to my callback URL.
但我无法弄清楚如何接收 Zoho Sign 发送给我的回调 URL 的响应。 Their documentation: https://www.zoho.com/sign/api/#webhook-management
他们的文档: https://www.zoho.com/sign/api/#webhook-management
Below is my sample code that I am using to confirm that callback function is hit.下面是我用来确认回调 function 被击中的示例代码。 It saves a sample data to DB to confirm it is being hit.
它将样本数据保存到 DB 以确认它被击中。 But the response I am not being able to catch hold of.
但我无法掌握的反应。 This is their help documentation that guides on the same, but that misses a working sample.
这是他们的帮助文档,提供相同的指导,但缺少一个工作示例。 https://help.zoho.com/portal/en/community/topic/webhooks-for-zoho-sign
https://help.zoho.com/portal/en/community/topic/webhooks-for-zoho-sign
[HttpPost]
public ActionResult Callback()
{
using (var context = new ZohoApiTestEntities())
{
var rowDetails = new tblWebhook();
rowDetails.PhoneNo = "7978704767";
//rowDetails.Notes1 = jsonObj.ToString();
context.tblWebhooks.Add(rowDetails);
context.SaveChanges();
}
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
Finally, after a lot of hits and trials, this code worked for me.最后,经过大量的点击和试验,这段代码对我有用。 It's bad that after a lot of follow-up and calls with the Zoho team, I did not receive any help from them for many days.
很遗憾,在与 Zoho 团队进行了多次跟进和电话联系后,我很多天都没有得到他们的任何帮助。
[HttpPost]
public ActionResult Callback()
{
string rawBody = GetDocumentContents(Request);
dynamic eventObj = JsonConvert.DeserializeObject(rawBody);
using (var context = new ZohoApiTestEntities())
{
var rowDetails = new tblWebhook();
rowDetails.PhoneNo = "*********";
//eventObj comes in JSOn format with two keys, "requests" and "notifications" each containing a JSON object https://www.zoho.com/sign/api/#webhook-management
//you can get your required details like this
string recipientName = eventObj.notifications.performed_by_name.ToString();
rowDetails.Notes1 = recipientName;
context.tblWebhooks.Add(rowDetails);
context.SaveChanges();
}
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
private string GetDocumentContents(HttpRequestBase Request)
{
string documentContents;
using (Stream receiveStream = Request.InputStream)
{
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
documentContents = readStream.ReadToEnd();
}
}
return documentContents;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.