Feel free to show your ❤️ by giving a ⭐ and / or my coffe expenses
Create your WrikeWebHookController by subclassing and implementing WrikeWebHookControllerBase abstract class provided in Taviloglu.Wrike.WebHook library. Don't forget to set a route to your new controller.
[Route("api/[controller]")]
public class WrikeWebHookController : WrikeWebHookControllerBase
{
protected override void OnAttachmentAdded(WrikeWebHookEvent wrikeWebHookEvent)
{
throw new NotImplementedException();
}
/*
implement other events...
*/
}
When your WrikeWebHookController is ready for responding to post requests, create a webhook using the Wrike Client
//create client
var client = new WrikeClient("permanent_token");
//create new webhook
//https://developers.wrike.com/documentation/webhooks
var newWebHook = new WrikeWebHook("https://<your-host>/api/wrikewebhook");
newWebHook = await client.WebHooks.CreateAsync(newWebHook);
Then Wrike will send post requests to the url you provided. For more details check out wrike's documentation
Note: WrikeWebHook library uses Newtonsoft.json serializer, which is not default serializer on ASP.NET Core 3.0+ or Framework 5.0+ versions. On recent ASP.NET projects you may need to install Microsoft.AspNetCore.Mvc.NewtonsoftJson package and activate it as follows;
services.AddControllers().AddNewtonsoftJson();
See Issue#33