get
https://services.leadconnectorhq.com/social-media-posting/oauth/facebook/start
Open the API in a window with appropriate params and headers instead of using the Curl. User is navigated to Facebook login OAuth screen. On successful login, listen on window object for message where event listener returns data in its callback function.
Sample code to listen to event data:
window.addEventListener('message',
function(e) {
if (e.data && e.data.page === 'social_media_posting') {
const { actionType, page, platform, placement, accountId, reconnectAccounts } = e.data
}
},
false)
Event Data Response:
{
actionType: string, Ex: "close"
page: string, Ex: "social-media-posting"
platform: string, Ex: "facebook"
placement: string, Ex: "placement"
accountId: string, Ex: "658a9b6833b91e0ecb8f3958"
reconnectAccounts: string[]] Ex: ["658a9b6833b91e0ecb834acd", "efd2daa9b6833b91e0ecb8f3511"]
}
The accountId retrieved from above data can be used to fetch Facebook account details using below API -
API: '/social-media-posting/oauth/facebook/accounts/:accountId'
Method: GET
Request
Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer 123
Provide your bearer token in the Authorization header when making requests to protected resources.
Query Parameters
page
stringFacebook Page
Examples:
integration
reconnect
stringReconnect boolean as string
Examples:
true
locationId
stringAccount Location Id
Examples:
w37swmmLbA02zgqKPpxITe2
userId
stringUser ID
Examples:
u37swmmLbA02zgqKPpxITe2
Headers
Authorization
stringAccess Token
Example:
Bearer 9c48df2694a849b6089f9d0d3513efe
Version
stringAPI Version
Allowed value:
2021-07-28
Responses
200
Successful response
Body
422
Unprocessable Entity
Body
statusCode
number
Example:
422
message
array[string]
Example:
["Unprocessable Entity"]
error
string
Example:
Unprocessable Entity
401
Unauthorized
Body
statusCode
number
Example:
401
message
string
Example:
Invalid token: access token is invalid
error
string
Example:
Unauthorized
400
Bad Request
Body
statusCode
number
Example:
400
message
string
Example:
Bad Request