Blendbase provides single unified GraphQL API to access CRMs for SaaS solutions builders. Instead of building and maintaining various integrations with third-party apps (e.g. Salesforce, HubSpot CRM, PipeDrive, etc.), you can use Blendbase CRM API to access each of these through a single unified interface, no matter what CRM your users use. Blendbase also manages the complexity of authentication and authorization with CRMs.
Check out more at blendbase.io or join our Discord.
- Salesforce
- HubSpot
- Copy .env.sample
cp .env.sample .env - Copy .env.sample
connect-fullstack-webapp-sample/.env.sample connect-fullstack-webapp-sample/.env - Generate a secret used for encrypting sensitive information and store it in
SECRET_ENCRYPTION_KEYin.env:go run main.go gen-enc-key - Blendbase is using JWT tokens to authenticate both Omni and Connect APIs (both client side and server-side). Generate a secret that is going to be used for encrypting JWT tokens by running
openssl rand -hex 32and store it in
BLENDBASE_AUTH_SECRETin~/.env.localBLENDBASE_AUTH_SECRETin~/connect-fullstack-webapp-sample/.env
docker-compose builddocker-compose up- Go to http://localhost:3000/ to see the sample Connect app, follow the instructions below on configuring CRM integrations
- Run
go run main.go gen-auth-token --consumer-id c6a82fd9-7e22-40c2-8bf2-db58a40839a9to obtain an authentication token (the used consumer ID is preconfigured for test purposes) - Go to http://localhost:8080/ and configure HTTP headers (replace $token with the value from the previous step)
{
"Authorization": "Bearer $token"
}
- Test Omni API with the query
query {
crm {
contacts {
edges {
node {
id
name
}
}
}
}
}
- Login to your instances of Salesforce or create a new one at https://login.salesforce.com/ as an admin
- Go to Settings > Setup > Apps > App Manager
- Click on "New Connected App"
- Fill out the name and contact email
- Enable "Enable OAuth Settings"
- Fill out "Callback URL" with
https://example.com- we will change it later - In the "Selected OAuth Scopes" select:
- Manage user data via APIs (api)
- Perform Requests at any time (…)
- Click "Save"
- Set "Consumer Key" and "Consumer Secret" to h at http://localhost:3000/ (
SALESFORCE_CLIENT_IDandSALESFORCE_CLIENT_SECRETin .env for development and testing).
- Log in to or create a new instance of HubSpot at https://app.hubspot.com/login as admin
- Go to Settings (cog icon in the top-left)
- Sidebar. Integrations > Private Apps.
- Click "Create a private app"
- Give it a name, e.g. "Blendbase app"
- Switch to "Scopes" in the header and select:
crm.objects.companies- Read & Writecrm.objects.contacts- Read & Writecrm.objects.deals- Read & Write
- Click "Create app"
- In app view page navigate to "Access token" section and copy the
Access token, store it in "Integration Secret" at http://localhost:3000/ (HUBSPOT_ACCESS_TOKENin the .env file for development and tests).
APIs:
- Connect API for managing your consumers and integrations with CRMs
- Omni API for interacting with CRM objects like contacts, notes, deals, etc.
API authentication is done via the Authorization header which should have a JWT token encoded with the value of the BLENDBASE_AUTH_SECRET environment variable. The JWT token should have the cunsomer_id claim that represents the current Consumer on behalf of whom CRM is being called. See jwt.js for an example.
- Set up Postgres database
createuser -d blendbase
createdb -O blendbase blendbase
- Run
go run main.go db:migrateto migrate the database - Run
go run main.go db:seedto init DB with test data
go run main.go server- Go to http://localhost:8080/ to use GraphQL Playground
- Execute the query
Blendbase is using gqlgen to generate the code based on the schema located at /graph/schema.graphqls.
After updating the schema make sure to run go run github.com/99designs/gqlgen generate
Sample React connect app is used to demonstrate how blendbase can be integrated into a React app.
cd connect-fullstack-webapp-samplecp .env.sample .env- Make sure to assigned a value for
BLENDBASE_AUTH_SECRET(see API Authentication section above) yarn install- to install the dependencies- Run
curl http://localhost:3000/api/fetchConsumerIDin directory of the React app. That will call Blendbase API and will create and new consumer. Follow the instruction in the output of the API call. yarn run dev- to run the app
make sure you have
.env.testfile in your root directory. You can copy .env.sample if you are doing this for the first time:
cp .env.sample .env.test
To run all the tests:
go test -v ./...
Run a specific file:
go test -v blendbase/connectors/salesforce
Disable cache:
go test -count 1 -v ...
Blendbase monorepo uses multiple licenses.
The license for a particular work is defined with following prioritized rules:
- License directly present in the file
- LICENSE file in the same directory as the work
- First LICENSE found when exploring parent directories up to the project top level directory
- Defaults to Elastic License 2.0
