Use dotenv in playwright node.js server

In order for dotenv to work, you need to add import “dotenv/config“; in playwright.config.js

Then in your test script import * as dotenv from 'dotenv'; in example.spec.ts

to call the environment variables:
const API_USER_ID: string = process.env.API_USER_ID || 'user_api';
const API_USER_PASSWORD: string = process.env.API_USER_PASSWORD || 'xyz-123';

Create .env with your environment variables:
USER_ID = user_api
API_USER_PASSWORD = xyz-123

Manage Meta product catalogue through API calls

  1. Create a Meta business portfolio
  2. Under Data sources, add a catalogue (click on the Add+ button)

3. Create a Facebook application

https://developers.facebook.com/docs/development/create-an-app

You will need to give it the Manage products with Catalog API use case.

4. Add this application to your Business portfolio

5. Create a system users and give the system users access to both the application and the catalogue. This user will be required to get the access token for your app.

6. generate a token https://developers.facebook.com/docs/news-indexing/guides/access-tokens/

7. Install the SDK

8. use the token and the app id to make query to you application