get
https://services.leadconnectorhq.com/social-media-posting/oauth/instagram/start
Open the API in a window with appropriate params and headers instead of using the Curl. User is navigated to Instagram 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: "instagram"
placement: string, Ex: "placement"
accountId: string, Ex: "658a9b6833b91e0ecb8f3958"
reconnectAccounts: string[]] Ex: ["658a9b6833b91e0ecb834acd", "efd2daa9b6833b91e0ecb8f3511"]
}
The accountId retrieved from above data can be used to fetch Instagram account details using below API -
API: '/social-media-posting/oauth/instagram/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
stringPage
Examples:
integration
reconnect
stringReconnect
Examples:
true
locationId
stringLocation 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
success
booleanSuccess or Failure
Example:
true
statusCode
numberStatus Code
Example:
201
message
stringMessage
Example:
Added Facebook Account
results
objectRequested Results
_id
stringExample:
65f2d989a4f2f1e5322c3856
oAuthId
stringExample:
u37swmmLbA02zgqKPpxITe2
oldId
stringExample:
u37swmmLbA02zgqKPpxITe2
locationId
stringExample:
u37swmmLbA02zgqKPpxITe2
originId
stringExample:
u37swmmLbA02zgqKPpxITe2
platform
objectExample:
facebook
type
objecttype value must be page
Example:
page
name
stringExample:
Account Name
avatar
stringExample:
u37swmmLbA02zgqKPpxITe2
meta
objectExample:
{"pageId":"u37swmmLbA02zgqKPpxITe2","page":{"id":"u37swmmLbA02zgqKPpxITe2","name":"Account Name","avatar":"u37swmmLbA02zgqKPpxITe2"},"storeCode":"122","isVerified":"true","verified":true,"protected":true,"locationId":"u37swmmLbA02zgqKPpxITe2","accountId":"u37swmmLbA02zgqKPpxITe2","openId":"u37swmmLbA02zgqKPpxITe2","urn":"u37swmmLbA02zgqKPpxITe2","username":"testUser","storefrontAddress":{"regionCode":"30021","languageCode":"E001","postalCode":"1221","administrativeArea":"Down Town","locality":"Louis Street","addressLines":["207","county"]}}
active
booleanExample:
true
deleted
booleanExample:
true
createdAt
string<date-time>created date
Example:
2024-03-14T11:03:37.015Z
updatedAt
string<date-time>updated date
Example:
2024-03-14T11:03:37.015Z
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