Connect Social Account
Generate an OAuth URL to connect a social media account for a brand. Redirect the user to this URL to authenticate and link the account. For Twitter, you must first call twitter-oauth-credentials
to upsert organization-level OAuth credentials. The resulting connected_profile_id
can be used in create-new-post
or update-new-post
. Supported platforms: Facebook, Instagram, YouTube, LinkedIn, Google My Business, Twitter.
- Method: POST
- Endpoint:
/api/api-services/v1/brand-service/social-connect
- Returns: OAuth URL for redirecting the user to connect the social account
Connect Social Account
POST https://app.brand2social.com/api/api-services/v1/brand-service/social-connect
Field | Type | Required | Description |
---|---|---|---|
Authorization | string (header) | Yes | Bearer token for authentication |
brand_id | int64 | Yes | ID of the brand |
redirect_url | string | Yes | URL to redirect the user after authentication |
platform | string | Yes | Social media platform: FACEBOOK , INSTAGRAM , YOUTUBE , LINKEDIN , GOOGLEMYBUSINESS , TWITTER |
curl --location 'https://app.brand2social.com/api/api-services/v1/brand-service/social-connect' \
--header 'Authorization: Bearer B2S_dummyToken' \
--data-raw '{
"brand_id": "cust_123",
"redirect_url": "https:/sample.com/redirect-url",
"platform": "FACEBOOK",
}'
Response
{
"status": "SUCCESS",
"http_code": 200,
"message": "SUCCESS",
"data": [
{
"url": "https://www.facebook.com/v17.0/dialog/oauth?client_id=xxxxxx&redirect_uri=xxxxx&scope=xxxx&state=xxxxx",
}
]
}
curl --location 'https://app.brand2social.com/api/api-services/v1/brand-service/social-connect' \
--header 'Authorization: Bearer B2S_dummyToken' \
--header 'Content-Type: application/json' \
--data-raw '{
"brand_id": 123,
"redirect_url": "https://example.com/redirect-url",
"platform": "TWITTER"
}'
Response
{
"status": "SUCCESS",
"http_code": 200,
"message": "SUCCESS",
"data": {
"url": "https://api.twitter.com/oauth/authorize?oauth_token=xxxxxx"
}
}
Error Response
{
"status": "FAILURE",
"http_code": 400,
"message": "Twitter OAuth credentials not found for organization",
"data": ""
}