Skip to content

Commit

Permalink
update readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazmul7989 committed Mar 23, 2024
1 parent f9f2654 commit b462c58
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,6 @@ Configure `.env` file
FACEBOOK_PAGE_ID=
FACEBOOK_ACCESS_TOKEN=
```
### How to generate access token?
1. At first create a business type facebook app. Create app from [Facebook Deveoper Panel](https://developers.facebook.com/)
2. Go to Facebook [Graph Api Explorer](https://developers.facebook.com/tools/explorer/)
3. Here you will see three select option:
- Meta App
- User or Page
- Permissions
4. `Meta App`: Here you will see all facebook app that you have created. Select your business type app from the dropdown list.
5. `User or Page`: Here you need to select page access token. Then it will redirect you to your facebook page list. Select your preferred page and give necessary permission.
6. `Permissions`: Please select the following permission from this permission list
- `pages_show_list`
- `pages_read_engagement`
- `pages_manage_engagement`
- `pages_manage_posts`
- `pages_read_user_content`

7. Finally click on the Generate Access Token button and it will generate temporary access token for one hour.

8. If you want to make this token as long lived, you need to go [Access Token Debugger](https://developers.facebook.com/tools/debug/accesstoken/). Insert the access token and click on the `Debug` button. Then it will show token information. Scroll down and you will see `Extend Access Token`. Click on this button and it will generate long lived access token.Then copy the access token and use this as `FACEBOOK_ACCESS_TOKEN`

### Note:
If you want to generate never expiry access token, you need to follow this step:

- Please open an api testing tool like Postman and send a get request by using this url `https://graph.facebook.com/v19.0/{app-scoped-user-id}/accounts?access_token={long-lived-user-access-token}. If you want to generate user access token instead of page access token, just select user access token form from `User or Page` section that i have mentioned in step 5.
- Extend this user access token as like as page access token extend method that i have mentioned in step 8.
- Then debug this `long-lived-user-access-token` and you will get `app-scoped-user-id` from this debug information.
- Finally send get request through this url `https://graph.facebook.com/v19.0/{app-scoped-user-id}/accounts?access_token={long-lived-user-access-token}`. You will get never expiry page access token from this request and use this access token as `FACEBOOK_ACCESS_TOKEN`

## Usage

Expand Down Expand Up @@ -127,6 +100,34 @@ array:3 [
- Multiple image upload is not supported.
- Video upload is not supported

### How to generate access token?
1. At first create a business type facebook app. Create app from [Facebook Deveoper Panel](https://developers.facebook.com/)
2. Go to Facebook [Graph Api Explorer](https://developers.facebook.com/tools/explorer/)
3. Here you will see three select option:
- Meta App
- User or Page
- Permissions
4. `Meta App`: Here you will see all facebook app that you have created. Select your business type app from the dropdown list.
5. `User or Page`: Here you need to select page access token. Then it will redirect you to your facebook page list. Select your preferred page and give necessary permission.
6. `Permissions`: Please select the following permission from this permission list
- `pages_show_list`
- `pages_read_engagement`
- `pages_manage_engagement`
- `pages_manage_posts`
- `pages_read_user_content`

7. Finally click on the Generate Access Token button and it will generate temporary access token for one hour.

8. If you want to make this token as long lived, you need to go [Access Token Debugger](https://developers.facebook.com/tools/debug/accesstoken/). Insert the access token and click on the `Debug` button. Then it will show token information. Scroll down this page and you will see `Extend Access Token`. Click on this button and it will generate long lived access token.Then copy the access token and use this as `FACEBOOK_ACCESS_TOKEN`

### Note:
If you want to generate never expiry access token, you need to follow this step:

- Please open an api testing tool like Postman and send a get request by using this url `https://graph.facebook.com/v19.0/{app-scoped-user-id}/accounts?access_token={long-lived-user-access-token}`. If you want to generate user access token instead of page access token, just select user access token from `User or Page` section that i have mentioned in step 5.
- Extend expiry date of this user access token as like as page access token extend method that i have mentioned in step 8.
- Then debug this `long-lived-user-access-token` and you will get `app-scoped-user-id` from this debug information.
- Finally send get request to this url `https://graph.facebook.com/v19.0/{app-scoped-user-id}/accounts?access_token={long-lived-user-access-token}`. Now You will get never expiry page access token from this request and use this access token as `FACEBOOK_ACCESS_TOKEN`


## License

Expand Down

0 comments on commit b462c58

Please sign in to comment.