I am working on a Cliq extension and need some help in re-formatting the C# script to Zoho Deluge script. I need to read response sent by a website and post the parameter with 200 OK status code.
if(!string.isNullOrEmpty(validationToken))
{
Console.WriteLine($"Received Token: '{validationToken}'");
return Ok(validationToken);
}
I am trying to subscribe to Microsoft Graph change notifications. After I call the API to create the subscription, Microsoft Graph sends an validation token which I need to pass back to validate the notification URL. But, when I post the validation token, I am getting an error.
The initial API call
data.insert("changeType":"created,updated");
data.insert("notificationUrl":"https://cliq.zoho.com/api/v2/bots/testbot/incoming?zapikey=1001.d2067fe4b9b15aee1a542e4c6b6d40ca.efb4c86660bd487e511eeae596d4f3a2");
data.insert("resource":"/me/mailfolders('inbox')/messages");
data.insert("expirationDateTime":expire);
data.insert("clientState":"SecretClientState");
data.insert("latestSupportedTlsVersion":"v1_2");
Api = invokeurl
[
url :"https://graph.microsoft.com/v1.0/subscriptions"
type :POST
parameters:data.toString()
connection:"microsoft"
content-type:"application/json"
];
Posting the validation token received
token = params.get("validationToken");
decoded = zoho.encryption.urlDecode(token);
data = Map();
data.put("Status code","200");
data.put("Response body",decoded);
Api = invokeurl
[
url :"https://graph.microsoft.com/v1.0/subscriptions"
type :POST
parameters:data.toString()
connection:"microsoft"
content-type:"application/json"
];
The error I'm getting
{
"error":
{
"code": "InvalidRequest",
"message": "expirationDateTime is a required property for subscription creation.",
"innerError":
{
"date": "2023-03-01T10:05:01",
"request-id": "d0566e86-c9a2-4208-846d-4c0965bfc96a",
"client-request-id": "d0566e86-c9a2-4208-846d-4c0965bfc96a"
}
}
}