REST - Receiving data in an Epicor function from an external webhook

Hi everybody,

I am working on a project which tries to integrate our Epicor 10.2.700.18 with one of our partners’ WMS using the REST APIs. I am stuck at the point where I receive data from their webhooks. Their system has a webhook for when SO’s are shipped which returns a JSON with the whole SO (lines, serials, qty’s, etc). I can register to that and tell their system to call one of our Epicor’s custom function every time an SO is shipped in their WMS.
My question is, how do I retrieve that response data or JSON in my Epicor function ? Do I need to set up something like a webhook listener/receiver on our side or something? Or do I need to use a specific library for that ? How would a C# code look like ?

Sorry if the terminology used is not correct, but this is the first time I’m using REST and I just can’t understand how can you get the response since the call is made on their side.

Thinking in terms of C# and RestSharp, if the call is made on our side, I could easily do this:

var client = new RestClient(“url here”);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader(“Content-Type”, “application/json”);
request.AddHeader(“Authorization”, “token here”);
var body = @"{body here}";
request.AddParameter(“application/json”, body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

But since everything is happening on their side, I can’t just do

IRestResponse response = client.Execute(request);

because there is no client, nor a request.

Thank you,

Epicor functions don’t support arbitrary objects. If their “hooks” send a “flat” data structure with basic primitives you could probably do this.
What does that data that comes from the hook look like? Also does their side allow the request to be authenticated? A lot of times hooks aren’t authenticated using standard Basic Auth if that’s the case you won’t be able to use the epicor functions for it.

1 Like

Hi Jose,
The webhooks work, the problem is I don’t know how to get the responses from them. It’s that ‘flat’ data structure that I’m after, doesn’t matter which format. If I could get that into my function in a string that would be great.

Here is a subscription example for it:

And here is the response example:

Again, If I could have the response as a string/dataset/array/whatever variable in my function it will solve my problem.

Thank you,

That’s the problem the webhook “data” is not a simple flat dataset it has keys and subjeys and arrays you cannot get that into an Epicor function. Without some middleware’s help.

1 Like

I agree with Jose here. Architecturally, you’re better off having a dedicated routine to receive the WebHook and then interact with Epicor.

  • It provides a history of events received allowing you to recover from errors by replaying events.
  • You have fuller control of error handling
  • It provides some segmentation for security
  • You’re not exposing Epicor logic to the world.
  • It allows you to add notification as needed
  • It allows you to reshape the data as needed if data structures change in either system
1 Like

Thanks for the reply. It was there in the back of my mind but I thought there might be a chance. What would my options be ? Get our partners to write a custom response for us that will match with Epicor ? I wouldn’t want that, would like to keep everything on our side.

Hi Mark,

How would I go about creating that dedicated routine ? Sorry but I’m lost here.


This article talks about receivers and handlers. You would have a receiver to, well, receive the WebHook event and then the hander would use the payload to interact with Epicor.

ASP.NET WebHooks Overview | Microsoft Docs

And there are Cloud options too using Logic Apps or serverless functions.

Thanks for that Mark, I’ll have a look at it. At least now I know what my options are.

You can work with structured JSON directly in EFs and many other customizable parts of Epicor. Add a reference to Newtonsoft.Json and parse your parameter as a dynamic object. You won’t be able to pass the resulting object around, but you’ll be able to work with its keys and subkeys in custom code. I’ve used this technique to pass JSON configuration to no-inputs configurators via UD tables.

Your example JSON is a single object, so parsing would look like this:

If your JSON were an array, it would look like this:

But I agree with @Mark_Wonsil about the need for history and replayability. Either configure the web service to drop files in a hot folder instead of hitting a URI, or write your own middleware to receive the JSON and save it. From there, whether the middleware or your EF parses the JSON probably depends on whether Epicor needs the whole structure or just a couple things from it. Also keep in mind that with dynamic, you lose a lot of compile time safety. If you try to access a non-existent property or treat it as the wrong type, it will blow up at runtime. It may be easier/better to handle these kinds of errors in middleware.


Thanks for the reply. My issue was that I didn’t know where to start. I ended up with a function in the middle which takes the response from the webhook, does the validation and then calls my Epicor function with RestSharp.