Single open-source GraphQL API to connect CRMs to your SaaS

Blendbase hero

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.

Supported CRMs

  • Salesforce
  • HubSpot

Configuring Blendbase

  1. Copy .env.sample cp .env.sample .env
  2. Copy .env.sample connect-fullstack-webapp-sample/.env.sample connect-fullstack-webapp-sample/.env
  3. Generate a secret used for encrypting sensitive information and store it in SECRET_ENCRYPTION_KEY in .env: go run main.go gen-enc-key
  4. 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 32 and store it in
  • BLENDBASE_AUTH_SECRET in ~/.env.local
  • BLENDBASE_AUTH_SECRET in ~/connect-fullstack-webapp-sample/.env
  1. docker-compose build
  2. docker-compose up
  3. Go to http://localhost:3000/ to see the sample Connect app, follow the instructions below on configuring CRM integrations
  4. Run go run main.go gen-auth-token --consumer-id c6a82fd9-7e22-40c2-8bf2-db58a40839a9 to obtain an authentication token (the used consumer ID is preconfigured for test purposes)
  5. Go to http://localhost:8080/ and configure HTTP headers (replace $token with the value from the previous step)
{
  "Authorization": "Bearer $token"
}
  1. Test Omni API with the query
query {
  crm {
    contacts {
      edges {
        node {
          id
          name
        }
      }
    }
  }
}

Connecting to Salesforce

  1. Login to your instances of Salesforce or create a new one at https://login.salesforce.com/ as an admin
  2. Go to Settings > Setup > Apps > App Manager
  3. Click on "New Connected App"
    1. Fill out the name and contact email
    2. Enable "Enable OAuth Settings"
    3. Fill out "Callback URL" with https://example.com - we will change it later
    4. In the "Selected OAuth Scopes" select:
      1. Manage user data via APIs (api)
      2. Perform Requests at any time (…)
    5. Click "Save"
  4. Set "Consumer Key" and "Consumer Secret" to h at http://localhost:3000/ (SALESFORCE_CLIENT_ID and SALESFORCE_CLIENT_SECRET in .env for development and testing).

Connecting to HubSpot

  1. Log in to or create a new instance of HubSpot at https://app.hubspot.com/login as admin
  2. Go to Settings (cog icon in the top-left)
  3. Sidebar. Integrations > Private Apps.
  4. Click "Create a private app"
  5. Give it a name, e.g. "Blendbase app"
  6. Switch to "Scopes" in the header and select:
    1. crm.objects.companies - Read & Write
    2. crm.objects.contacts - Read & Write
    3. crm.objects.deals - Read & Write
  7. Click "Create app"
  8. 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_TOKEN in the .env file for development and tests).

API

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.

Development

DB Setup

  1. Set up Postgres database
createuser -d blendbase
createdb -O blendbase blendbase
  1. Run go run main.go db:migrate to migrate the database
  2. Run go run main.go db:seed to init DB with test data

Running the server

  1. go run main.go server
  2. Go to http://localhost:8080/ to use GraphQL Playground
  3. Execute the query

GraphQL Generation

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 connect React application

Sample React connect app is used to demonstrate how blendbase can be integrated into a React app.

Setup

  1. cd connect-fullstack-webapp-sample
  2. cp .env.sample .env
  3. Make sure to assigned a value for BLENDBASE_AUTH_SECRET (see API Authentication section above)
  4. yarn install - to install the dependencies
  5. Run curl http://localhost:3000/api/fetchConsumerID in 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.
  6. yarn run dev - to run the app

Testing

make sure you have .env.test file 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 ...

License

Blendbase monorepo uses multiple licenses.

The license for a particular work is defined with following prioritized rules:

  1. License directly present in the file
  2. LICENSE file in the same directory as the work
  3. First LICENSE found when exploring parent directories up to the project top level directory
  4. Defaults to Elastic License 2.0
Similar Resources

Tools to write high performance GraphQL applications using Go/Golang.

graphql-go-tools Sponsors WunderGraph Are you looking for a GraphQL e2e data fetching solution? Supports frameworks like NextJS, type safety with gene

Nov 30, 2022

Go monolith with embedded microservices including GRPC,REST,GraphQL and The Clean Architecture.

Go monolith with embedded microservices including GRPC,REST,GraphQL and The Clean Architecture.

GoArcc - Go monolith with embedded microservices including GRPC,REST, graphQL and The Clean Architecture. Description When you start writing a Go proj

Nov 11, 2022

GraphQL implementation for click house in Go.

GraphQL implementation for click house in Go.

clickhouse-graphql-go GraphQL implementation for clickhouse in Go. This package stores real time streaming websocket data in clickhouse and uses Graph

Nov 20, 2022

GraphQL parser comparison in different languages

graphql-parser-bench Parsing a schema or document can be a critical part of the application, especially if you have to care about latency. This is the

Jul 10, 2022

A simple Go, GraphQL, and PostgreSQL starter template

Simple Go/GraphQL/PostgreSQL template Purpose Have a good starting point for any project that needs a graphql, go, and postgres backend. It's a very l

Jan 8, 2022

A GraphQL complete example using Golang And PostgreSQL

GraphQL with Golang A GraphQL complete example using Golang & PostgreSQL Installation Install the dependencies go get github.com/graphql-go/graphql go

Aug 25, 2022

This app is an attempt towards using go lang with graphql data fetch in react front end.

go_movies _A React js + GraphQL supported with backend in GoLang. This app is an attempt towards using go lang with graphql data fetch in react front

Dec 7, 2021

proof-of-concept minimal GraphQL service for LTV

LTV GraphQL Proof-of-Concept This is a barebones proof-of-concept of a possible GraphQL implementation that interacts with Core. It includes a few ver

Jan 4, 2022

Learn GraphQL with THE [email protected] SHINY COLORS.

faaaar Learn GraphQL with THE [email protected] SHINY COLORS. Getting Started The following is a simple example which get information about 20-year-old idols

Nov 26, 2022
Comments
  • Improve 3rd party services logging similar to Hubspot API logging

    Improve 3rd party services logging similar to Hubspot API logging

    Example:

    log.WithFields(log.Fields{
      “status_code”: res.StatusCode,
      “url”:         url,
      “method”:      req.Method,
      “err”:         errRes.Message,
    }).Info(“HubSpot request”)
    
A collection of Go packages for creating robust GraphQL APIs

api-fu api-fu (noun) (informal) Mastery of APIs. ?? Packages The top level apifu package is an opinionated library that aims to make it as easy as pos

Sep 27, 2022
graphql parser + utilities

graphql utilities for dealing with GraphQL queries in Go. This package focuses on actually creating GraphQL servers and expects you to describe your s

Sep 27, 2022
GraphQL server with a focus on ease of use
GraphQL server with a focus on ease of use

graphql-go The goal of this project is to provide full support of the GraphQL draft specification with a set of idiomatic, easy to use Go packages. Wh

Nov 23, 2022
An implementation of GraphQL for Go / Golang

graphql An implementation of GraphQL in Go. Follows the official reference implementation graphql-js. Supports: queries, mutations & subscriptions. Do

Dec 3, 2022
Convert Golang Struct To GraphQL Object On The Fly

Straf Convert Golang Struct To GraphQL Object On The Fly Easily Create GraphQL Schemas Example Converting struct to GraphQL Object type UserExtra stru

Oct 26, 2022
GraphQL server with a focus on ease of use
GraphQL server with a focus on ease of use

graphql-go The goal of this project is to provide full support of the GraphQL draft specification with a set of idiomatic, easy to use Go packages. Wh

Nov 29, 2022
GQLEngine is the best productive solution for implementing a GraphQL server 🚀

GQLEngine is the best productive solution for implementing a graphql server for highest formance examples starwars: https://github.com/gqlengine/starw

Apr 24, 2022
⚡️ A Go framework for rapidly building powerful graphql services

Thunder is a Go framework for rapidly building powerful graphql servers. Thunder has support for schemas automatically generated from Go types, live q

Nov 29, 2022
go generate based graphql server library
go generate based graphql server library

gqlgen What is gqlgen? gqlgen is a Go library for building GraphQL servers without any fuss. gqlgen is based on a Schema first approach — You get to D

Nov 28, 2022
gqlanalysis makes easy to develop static analysis tools for GraphQL in Go.
gqlanalysis makes easy to develop static analysis tools for GraphQL in Go.

gqlanalysis gqlanalysis defines the interface between a modular static analysis for GraphQL in Go. gqlanalysis is inspired by go/analysis. gqlanalysis

Nov 1, 2022