项目作者: keygen-sh

项目描述 :
An example Node.js app that handles webhook events from Keygen
高级语言: JavaScript
项目地址: git://github.com/keygen-sh/example-webhook-handler.git
创建时间: 2018-01-02T17:33:50Z
项目社区:https://github.com/keygen-sh/example-webhook-handler

开源协议:MIT License

下载


Example Keygen Webhook Handler

The following web app is written in Node.js and shows how to set up a simple
webhook handler for Keygen, allowing you to listen for
and act upon particular events on your Keygen account.

This example application is not 100% production-ready, but it should
get you 90% of the way there. You may need to add additional logging,
error handling, validation, features, etc.

Running the app

First up, configure a few environment variables:

  1. # Your Keygen account's Ed25519 verify key
  2. export KEYGEN_VERIFY_KEY="YOUR_KEYGEN_ED25519_VERIFY_KEY"
  3. # Your Keygen account ID.
  4. export KEYGEN_ACCOUNT_ID="YOUR_KEYGEN_ACCOUNT_ID"

You can either run each line above within your terminal session before
starting the app, or you can add the above contents to your ~/.bashrc
file and then run source ~/.bashrc after saving the file.

Next, install dependencies with yarn:

  1. yarn

Then start the app:

  1. yarn start

Testing webhooks locally

For local development, create an ngrok tunnel:

  1. ngrok http 8080

Next up, add the secure ngrok URL to your Keygen account to listen
for webhook events.

  1. Keygen: add https://{YOUR_NGROK_URL}/keygen to https://app.keygen.sh/webhook-endpoints

You can now create events within your Keygen account, e.g. create a new
license, and the webhook event will be sent to your local server.

Questions?

Reach out at support@keygen.sh if you have any
questions or concerns!