kinecosystem / kin-node

DEPRECATED! Please use Kinetic: https://developer.kin.org/docs/kinetic
https://developer.kin.org/docs/kinetic
MIT License
16 stars 14 forks source link

Webhooks assume you use express #8

Open doc-l opened 3 years ago

doc-l commented 3 years ago

If you don't use express, it's nearly impossible to use webhooks, because the webhook functionality assumes express responses: https://github.com/kinecosystem/kin-node/blob/91cb7115a8e198c293793a8de267d719a7eaa283/src/webhook/index.ts#L282

A better function signature would be to have a function that has as input the body and headers of some request, and as output what should be sent as a result.

radicaled commented 3 years ago

This is an issue for us as well.

chaseeb commented 3 years ago

Was this resolved?

doc-l commented 3 years ago

No, if you don't use express it's extremely difficult to get the webhooks working. I got it working by reverse engineering the express code and writing/copy/pasting parts of it myself, omitting some crucial features to get it working.

Ideally the webhooks don't assume express or any framework, just return some promises that you can deal with yourself and provide an express example.