Skip to content

shubham14p3/dashclick-express-api-for-fb-ad-campaign

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intoduction

A Expressjs API which is using Facebook Business SDK. This is API only. Frontend/client is independent

Features

  • Manage CURD operation on ad campaign
  • A Minimul API with best code practice
  • I am using .prettierrc file rule to manage coding styles
  • This is a limited feature api just to get started

Installation

Before you install

  1. Make sure nodejs and npm is installed on your system.
  2. For Windows OS follow the nodejs installer
  3. For debian based system use following commands
# Install curl
sudo apt-get install -y curl

# Get nodejs
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

# Install nodejs

sudo apt-get install -y nodejs

# Confirm  node version
node -v

# Confirm npm is installed
npm -v

## Clone Repo

### Get Source Code in your current directory

```bash
git clone ssh://git@github.com/user/repo.git .

Install Packages

 npm install

setup

  • Rename apiKeys.json.example to apikeys.json
  • Dont worry about security we are not pushing it to repository. We have added it to .gitignore
  • get your Ad Account ID and put apikeys.json
  • Get user access token. Right now we are generating a access token from Graph API Tool Explorer. Make sure you are getting access token only after granting permission for ad_campaign. Token will expire after 60 minutes you need to reissue again and use them again.
  • In real world application we will get this access token from user consent when user will log into our ad campaign dashboard.
{
    "ad_account_id": "act_<AD_ACCOUNT_ID>",
    "access_token": "<ACCESS_TOKEN>"
}

Serve

To serve this api use

npm run start

if you have nodemon installed globally you can use

npm run dev

Now you can access api at

http://localhost:3000/campaign/

Available Endpoints

method Endpont Required Parameter
GET http://localhost:3000/campaign/ none
POST http://localhost:3000/campaign/ name,objective, special_ad_category
PUT http://localhost:3000/campaign/:id none
DELETE http://localhost:3000/campaign/:id none

About

Dashclick coding challange app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%