This project aims to provide a headless application that interacts with Salesforce using GraphQL API to query data.
This headless application is designed to fetch data from Salesforce using GraphQL API. It facilitates querying Salesforce data without the need for a traditional frontend application. You can use this application to retrieve data from Salesforce and integrate it into various backend processes, microservices, or other applications.
- Queries data from Salesforce using GraphQL API.
- Provides flexibility in fetching specific data sets based on GraphQL queries.
- Supports integration with various backend systems and processes.
To get started with the project, follow these steps:
-
Clone the repository to your local machine:
git clone https://github.com/tomsouza4/headless-app-query-data-salesforce-graphqlapi.git
-
Install the required dependencies:
- Navigate to the project directory
cd headless-app-query-data-salesforce-graphqlapi
-
Configure environment variables:(Coming soon, skip to next step)
- Open the
.env
file. - Update the Salesforce credentials and GraphQL endpoint as per your Salesforce environment.
- Open the
-
Run the application:
npm install
npm start
5.In Salesforce it is required to configure:
- Add http://localhost:3000 to your Salesforce CORS
- Create a Connected App
- Optional to format your response in a human readable way:
brew install jq
curl https://YOUR_SERVER_URL/services/oauth2/token -d 'grant_type=client_credentials' -d 'client_id=PASTE_YOUR_CONSUMER_KEY_HERE' -d 'client_secret=PASTE_YOUR_CONSUMER_SECRET_HERE' | jq .access_token | pbcopy
"access_token":"00D8b0000022ug0!AQ8AQGbKIjjkVTHUIcDCYehMqhmqOqc.iKQsKUaDp3zomRfp8kgZjCgJ8TxDlSGOfzwVkjfNGHpCXd_3vtIEkJFPGZSOkOSv"
const token = "00D8b0000022ug0!AQ8AQNfmDcCNjlqah6UTK90X7WWdRyFfeOXHuEq2hH3fLLTMvRLZ2B9oP5wbjfxzCs.SxtKu0pcCqSWqKVCg4OvisTbkibhU";
-
Access the application:
Once the application is running, go to:
http://localhost:3000
or any other URL and port combination you've selected
To use the application, you can:
- Send GraphQL queries to the specified endpoint.
- Analyze and process the data fetched from Salesforce based on your requirements.
- Integrate the application with other systems or processes as needed.
ReactAppQueryingSFData.mov
Contributions to the project are welcome. If you have any suggestions, improvements, or bug fixes, feel free to open an issue or create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.