项目作者: bcen

项目描述 :
Forwards Facebook webhooks to your local server
高级语言: Go
项目地址: git://github.com/bcen/fbwhs.git
创建时间: 2019-02-23T21:56:58Z
项目社区:https://github.com/bcen/fbwhs

开源协议:MIT License

下载


Facebook Webhook as a Service

Usage

  • Starts the forward daemon locally

    1. $ ./forward http://localhost:4000/facebook/webhook_callback
    2. Forwarding SSE from "https://fbwhs.herokuapp.com/webhook/1HbA4TRlBeiS1nrfu5siRdgma7c" to "http://localhost:4000/facebook/webhook_callback"
    3. Usage:
    4. curl -X POST -d 'test=123' "https://fbwhs.herokuapp.com/webhook/1HbA4TRlBeiS1nrfu5siRdgma7c"
  • Registers the webhook callback from above with Facebook

    1. curl -F "object=user" \
    2. -F "callback_url=https://fbwhs.herokuapp.com/webhook/1HbA4TRlBeiS1nrfu5siRdgma7c" \
    3. -F "fields=about" \
    4. -F "verify_token=1HbA4TRlBeiS1nrfu5siRdgma7c" \
    5. -F "access_token={FB_APP_ACCESS_TOKEN}" \
    6. "https://graph.facebook.com/{FB_APP_ID}/subscriptions"

    Note: the last part of the webhook address is the verify_token. E.g. https://fbwhs.herokuapp.com/webhook/abc123 where abc123 is the verify_token.

  • Now, whenever Facebook sends a webhook to https://fbwhs.herokuapp.com/webhook/1HbA4TRlBeiS1nrfu5siRdgma7c, the daemon running locally will forward the request to your local server.

  • Also, you can test it with curl -X POST -d 'test=123' "https://fbwhs.herokuapp.com/webhook/1HbA4TRlBeiS1nrfu5siRdgma7c", the local server callback http://localhost:4000/facebook/webhook_callback should recieve a request with a body test=123.

How it works

tldr; The concept is same as smee, but we handle Facebook’s verification request for you.

Deploying to Heroku

Deploy