Appearance
Reconnect Facebook
POST/public/account/facebook/connect/{accountId}Reauthorize a previously connected Facebook account, typically when the access token has expired. Provide the new token and the selected page ID.
Endpoint Details
- Authentication: Basic Auth (
Authorization: Basic Base64(AccessKey:SecretKey)) - Access Tier: Gold+
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
accountId | string | Yes | The unique ID of the account to reconnect. |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
pageId | string | Yes | The unique identifier of the Facebook Page. |
token | string | Yes | New access token from the exchange step. |
Example Request
bash
curl -X POST "https://api.repliz.com/public/account/facebook/connect/680affa5ce12f2f72916f67e" \
-H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
-H "Content-Type: application/json" \
-d '{"pageId":"113958387982006","token":"EAAGxxxxxxxx"}'javascript
import axios from 'axios';
const accountId = '680affa5ce12f2f72916f67e';
const response = await axios.post(
`https://api.repliz.com/public/account/facebook/connect/${accountId}`,
{
pageId: '113958387982006',
token: 'EAAGxxxxxxxx',
},
{
auth: {
username: 'YOUR_ACCESS_KEY',
password: 'YOUR_SECRET_KEY',
},
},
);
console.log(response.data);javascript
const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');
const accountId = '680affa5ce12f2f72916f67e';
const response = await fetch(
`https://api.repliz.com/public/account/facebook/connect/${accountId}`,
{
method: 'POST',
headers: {
Authorization: `Basic ${credentials}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
pageId: '113958387982006',
token: 'EAAGxxxxxxxx',
}),
},
);
const data = await response.json();
console.log(data);Response
json
// No content returned on successjson
{
"code": 400,
"message": "incorrect generatedId to reconnect"
}json
{
"code": 404,
"message": "account not found"
}json
{
"code": 401,
"message": "unauthorized"
}