I am wanting to test Podio webhooks locally. I am using Conveyor.cloud for tunneling and tested it successfully with their Twilio example. The problem I am having with converting the code to work with Podio is that the Twilio example used a Controller and the Podio webhook example at http://podio.github.io/podio-dotnet/webhooks/ uses IHttpHandler.
I tried implementing IHttpHandler to the controller in the code below and it's not working.
using System;
using System.Web;
using System.Web.Mvc;
using PodioAPI;
namespace WebhooksProject.Controllers
{
public class WebController : IHttpHandler
{
public static string clientId = "abcd";
public static string clientSecret = "abcd";
public static string username = "a@b.com";
public static string password = "abcd";
public static Podio podio = new Podio(clientId, clientSecret);
public void ProcessRequest(HttpContext context)
{
podio.AuthenticateWithPassword(username, password);
var request = context.Request;
switch (request["type"])
{
case "hook.verify":
podio.HookService.ValidateHookVerification(int.Parse(request["hook_id"]), request["code"]);
break;
// An item was created
case "item.create":
// For item events you will get "item_id", "item_revision_id" and "external_id". in post params
int itemIdOfCreatedItem = int.Parse(request["item_id"]);
// Fetch the item and do what ever you want
break;
// An item was updated
case "item.update":
// For item events you will get "item_id", "item_revision_id" and "external_id". in post params
int itemIdOfUpdatedItem = int.Parse(request["item_id"]);
// Fetch the item and do what ever you want
break;
// An item was deleted
case "item.delete":
// For item events you will get "item_id", "item_revision_id" and "external_id". in post params
int deletedItemId = int.Parse(request["item_id"]);
break;
}
}
public bool IsReusable
{
get{return false;}
}
}
}
What am I missing?