Web Hooks  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Web Hooks

Postby SBarnes » Sat Mar 30, 2019 9:23 am

Is there any documentation on web hooks?

And is there a user interface for setting up subscribers?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Web Hooks  Topic is solved

Postby Mike.Sheen » Sun Mar 31, 2019 1:00 pm

SBarnes wrote:Is there any documentation on web hooks?

And is there a user interface for setting up subscribers?


Hi Stuart,

We have an article on our docs page relating to webhooks.

There as yet is no user interface for adding subscribers and subscriptions, but there are API routes to manage subscribers, subscriptions and messages - even though the docs don't explicitly show how to manage subscribers (it does show subscriptions & messages) - the SwaggerUI does show how to manage subscribers... We'll have to update the docs to include subscriber management (the docs show how to manage subscribers via an SQL Insert but that's not ideal as it requires a service restart - but using the API does not require a restart).

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Web Hooks

Postby SBarnes » Sun Oct 20, 2019 3:58 pm

Are there any plans to support incoming web hooks something akin to receivers in https://github.com/aspnet/AspNetWebHooks/tree/master/src ?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Web Hooks

Postby Mike.Sheen » Mon Oct 21, 2019 9:56 am

Hi Stuart,

As you already know, creating a plugin to extend our standard API and add a route is pretty simple. We hadn't intended on adding a suite of routes to handle things like MailChimp, Salesforce, and so on - because it is so simple to add a route, and whatever handler we provide, the logic / mappings won't suit everyone - so we think it best to leave this as bespoke plugins.

Have I interpreted your question correctly?
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Web Hooks

Postby SBarnes » Mon Oct 21, 2019 10:10 am

Hi Mike

What I am referring to is something like SalesForce or Zapier making an incoming webhook call that is not ServiceStack related, how would the web api (ServiceStack) interpret a post given the data/payload in not going to be a strictly typed object but Json or XML i.e. what type of function signature on a service class then would ServiceStack route correctly?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Web Hooks

Postby Mike.Sheen » Mon Oct 21, 2019 10:31 am

SBarnes wrote:the data/payload in not going to be a strictly typed object but Json or XML


Both Json and XML represent a data transfer object - so you just create a DTO type which fits the shape of the Json/XML you expect to be POSTed to the route.

ServiceStack at the server side doesn't route anything based on the type - when adding a route for a POST operation you specify the URI and the type you want the POST body to be deserialised into:

Code: Select all
AppHost.Routes.Add(typeof(CreateDebtorFromSalesForceRequest), "/Debtors/CreateFromSalesForceCustomer", "POST", "Creates a debtor from a SalesForce customer creation webhook", "");


Whatever Json or XML is provided in the body will be deserialised into an instance of the CreateDebtorFromSalesForceRequest DTO - which would simply be the properties of the sales force customer.

I still feel like I'm missing something in your question... perhaps you could give a specific example of something you cannot get to work?
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Web Hooks

Postby SBarnes » Mon Oct 21, 2019 11:56 am

How would you handle the need to send an acknowledgement back?

Here's and example of where the asp.net webhooks do it to continue your SalesForce analogy https://github.com/aspnet/AspNetWebHooks/blob/master/samples/SalesforceReceiver/WebHooks/SalesforceWebHookHandler.cs
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Web Hooks

Postby SBarnes » Tue Oct 22, 2019 7:35 am

Further to this how would the incoming hook end up with a logged in manager to work with, as the only way I am assuming you could do it is with an api key as part of the query string held by the sender as username and password are definitely not going to work?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Web Hooks

Postby Mike.Sheen » Mon Oct 28, 2019 10:30 pm

SBarnes wrote:How would you handle the need to send an acknowledgement back?


We don't. The response should contain any ack info needed - a request back to the instigator of the webhook isn't something I'm aware of as a standard practice.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Web Hooks

Postby Mike.Sheen » Mon Oct 28, 2019 10:37 pm

SBarnes wrote:Further to this how would the incoming hook end up with a logged in manager to work with, as the only way I am assuming you could do it is with an api key as part of the query string held by the sender as username and password are definitely not going to work?


Web hooks are an outbound only concept - so in the context of Jiwa, our webhooks are ways to communicate things out of a customers Jiwa environment to a 3rd party API.

All our routes can accept API Keys as a URL parameter, or as a HTTP bearer token which is simply a header in the request - so our routes can be receivers for webhooks from a 3rd party API, if they provide an API key in the request.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Next

Return to REST API

Who is online

Users browsing this forum: No registered users and 2 guests

cron