Skip to Content

Creating a Marketing Lead in SAP Cloud for Customer from a Facebook promotion – Part III

To use the cloud-c4c-extension-sample Application for creating marketing lead we need to use various Facebook tokens. The aim of this blog is to show how to generate those tokens.

Note: This document is only limited to showcase how to create a basic Facebook app to be used with for this specific scenario and how to generate the required tokens.  Development of productize Facebook App is beyond the scope. Additionally Facebook API can change over time and no guarantee the steps mentioned here will work as is. As per Facebook documentation Apps that are in development mode will not receive real time
updates. Please consult for further information and any issues you might face.

Prerequisites: You already have created a Facebook as explained in the last blog.

To generate tokens we will use Facebook Graph API Explorer under the Tools & Support tab.

APP Token

App token can be generated as shown below


PAGE Token

For Page token first we need to set the relevant permissions. Click on Get token and in the Extended permissions section check email and manage_pages (optional for this app)


This will return us a short lived page token, which we need to exchange for a long lived exchanged token (expiry 60 days)

GET /oauth/access_token?grant_type=fb_exchange_token&client_id={app-id}&client_secret={app-secret}& fb_exchange_token={short-lived-token}

  pagetoken - 2.png
We need to provide this page token in the file

Real time Subscription

Next we need to add real time subscription for our Facebook app.

Note: Before this step can be performed make sure the HCP application is deployed

For this we need send a post request to /{app-id}/subscriptions as shown below. The verify_token mentioned here should match the verify token mentioned in the file. If the URL is registered you should see a success message in the response as shown below 


We can also verify the request in the HTTP Access Logs of your application in HANA Cloud platform cockpit. Facebook sends a GET request to the callback_url as a check for subscribing to the URL.


Final step we need to setup the Page Subscribed Apps. For this a Page Access Token is required with publish_pages permission required


That’s it. Hope you enjoyed this series and happy learning.

1 Comment
You must be Logged on to comment or reply to a post.
  • Hi dear Abinash.

    This touchpoints thats great, to understand what is the funcionality of this tools.

    I like to know about more this configuration in current releases, if you can help me, it would be great.

    Best Regards !!