/Facebook-ASP.NET-Webhook

Retrieving facebook leads using ASP.NET Web API and Graph API Webhooks

Primary LanguageC#MIT LicenseMIT

Gitter

Retrieving facebook leads using ASP.NET Web API and Graph API Webhooks

ASP.NET way of retrieving Facebook Lead Ad data

Prerequisites

  • Facebook developer account
  • Visual Studio 2015 or higher

Web API Implementation

  • Compile and host the Web API in your server
    Note: SSL Certificate is mandatory. Facebook accept only https URL.

  • When an lead ad is generated facebook will post the data to the Web API's Post action.
    api

  • Following data is avaliable in the API
    post_data

Facebook App & Webhook Configuration

  • Navigate to https://developers.facebook.com

  • Choose Add a New App from the My Apps pull-down menu
    Add facebook app

  • Provide the display name, contact email address and click Create App ID
    New app

  • Navigate to Add Product and setup Webhook
    add product
    webhook

  • Select Page from the pull-down menu and click Subscribe to this topic
    subscription

  • Provide the callback URL (Note: SSL is mandatory), Verification Token and click Verify and Save
    subscription_config

  • On successfull verification you will be prompted with a list of avaliable subscriptions. From the list subscribe to Leadgen
    ledgen_subscribtion
    subscription_confirmation

  • To test the working without creating a lead ad do the following

    • Cick Test button in the leadgen subscription
      test_leadgen
    • Facebook will open-up a popup with sample data, click Send to My Server button.
      sample_data
    • If there is any valid method like sending email, writing to database etc is implemented in the API post will get executed.

License

This project is licensed under the MIT License