Skip to content

Commit

Permalink
Add Filter in Subscribe ajax call for webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
vijay113 committed Sep 25, 2019
1 parent 346ebac commit 631fe70
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
Binary file modified .vs/ASPNET_WebHooks/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified .vs/ASPNET_WebHooks/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified .vs/ASPNET_WebHooks/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
2 changes: 1 addition & 1 deletion .vs/config/applicationhost.config
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
</site>
<site name="ASPNET_WebHooks" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\Vijay\source\repos\ASPNET_WebHooks\ASPNET_WebHooks" />
<virtualDirectory path="/" physicalPath="D:\OFFICE\GitHub\ASPNET_WebHooks\ASPNET_WebHooks" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:62906:localhost" />
Expand Down
7 changes: 7 additions & 0 deletions ASPNET_WebHooks/CustomWebHook/TestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
Expand All @@ -16,6 +17,12 @@ public override Task ExecuteAsync(string receiver, WebHookHandlerContext context
string action = context.Actions.First();
JObject data = context.GetDataOrDefault<JObject>();
return Task.FromResult(true);

// for VSTS webhooks.
//string msg = string.Format(CultureInfo.CurrentCulture, VstsReceiverResources.Handler_NonMappedEventType, action);
//context.RequestContext.Configuration.DependencyResolver.GetLogger().Warn(msg);
//return ExecuteAsync(context, data);

}
}
}
19 changes: 13 additions & 6 deletions ASPNET_WebHooks/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@
data: JSON.stringify({
WebHookUri: 'http:https://localhost:62906/api/webhooks/incoming/custom',
Secret: '12345678901234567890123456789012',
Description: 'My first WebHook!'
Description: 'My first WebHook!',
Filters: ["event2"] // Remove 'Filters' for all event. By default -> ["*"] for all events.
}),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (data, status) {
debugger;
alert(data.Message ? data.Message : status);
alert(status);
},
error: function (errMsg) {
debugger;
alert(errMsg.responseJSON.Message);
}
});
Expand All @@ -59,14 +60,20 @@
function notifymvc() {
$.post('/notify/submit',
{},
function (data, status) { alert('Data: '+ data + '\nStatus: ' + status); });
function (data, status) {
debugger;
alert('Status: ' + status);
});
return false;
}
function notifyapi() {
$.post('/api/notifyapi',
{},
function (data, status) { alert('Data: ' + data + '\nStatus: ' + status); });
function (data, status) {
debugger;
alert('Status: ' + status);
});
return false;
}
</script>

0 comments on commit 631fe70

Please sign in to comment.