Custom Fields and Mutations for Salesforce

Dec 3rd, 2019view comments

Huge updates for OneGraph's Salesforce integration.

Custom fields for any object in Salesforce are available in a new JSON-typed customFields field on the object:

 query AccountQuery {
  salesforce {
   account(id: "YOUR_ACCOUNT_ID") {
     id
     industry
     customFields
   }
 }
}

If you only need some of the custom fields, you can use the fields argument on the customFields field:

 query AccountQuery {
  salesforce {
   account(id: "YOUR_ACCOUNT_ID") {
     id
     industry
     customFields(fields: ["NumberofLocations__c"])
   }
 }
}

You can also use custom fields in filters for advanced queries:

query CustomFieldFilter {
  salesforce {
    accounts(filter: {
      customField: {
        intField: {
          fieldName: "NumberofLocations__c"
          filter: {
            greaterThanOrEqualTo: 2
          }
        }
        stringField: {
          fieldName: "UpsellOpportunity__c"
          filter: {
            equalTo: "Maybe"
          }
        }
      }
    }) {
      nodes {
        id
        name
      }
    }
  }
}

We added support for creating, updating, and deleting objects in Salesforce through GraphQL mutations:

mutation CreateAccountMutation {
  salesforce {
    createAccount(input: {
      account: {
        name: "Testing123"
        customFields: [{
          fieldName: "NumberofLocations__c",
          value: 10
        }, {
          fieldName: "UpsellOpportunity__c",
          value: "Maybe"
        }]
      }
    }) {
      account {
        name
        customFields
      }
    }
  }
}

Try it out at OneGraph. Hop into our Spectrum if you have any questions.

❤️ 2

Customize Styles for the OneGraph GraphiQL Explorer

Oct 4th, 2019view comments

Our open-source GraphiQL Explorer library just got support for custom styling.

You can provide custom colors, customize the button styles, and provide custom components for the checkboxes and arrows. Read more about how to customize the styles on the README.

We've been happy to see companies that use GraphQL adopt the explorer (see Gatsby, Shopify, AWS Amplify, PostGraphile, Hasura, GraphiQL Online, and GraphiQL.app).

With this change, we expect to see a few more come on board. If you'd like help integrating the explorer, email sayhi@onegraph.com or hop into our Spectrum channel.

🎉 1❤️ 3

Support for Stripe Connect Auth via the Auths Arg

Oct 2nd, 2019view comments

OneGraph supports different ways of providing auth for different use cases.

The most popular is our OAuth flow, usually via our OneGraph auth library.

We also support providing ad-hoc credentials via the auths arg that is available on every top-level field. The auths arg allows you to provide credentials for a single query and is a great way to make queries through OneGraph when your application already has auth tokens for a service.

Today we added support for Stripe's Connect auth via the Stripe-Account header

Example query

query StripeCustomers(
  $connectedStripeAccountId: String!
  $platformSecretKey: String!
) {
  stripe(
    auths: {
      stripeConnectAuth: {
        connectedStripeAccountId: $connectedStripeAccountId
        platformSecretKey: $platformSecretKey
      }
    }
  ) {
    customers {
      nodes {
        name
        email
      }
    }
  }
}

Hop into our Spectrum channel if you have any questions or a use case that's not supported.

❤️ 1

Created a Delete App Button

Sep 25th, 2019view comments

You can now delete an app from the app's "Advanced Settings" pane on the OneGraph dashboard.

Thanks to Nathan Smith for requesting the feature in our Spectrum chat.

Submit your own feature request on our Spectrum channel.

👍 1

Payment Intents for Stripe

Sep 25th, 2019view comments

You can now get a Stripe payment intent by its id, list them at the top-level, or get all intents for a customer.

Payment intents are a new way to build dynamic payment flows. Read more about Payment Intents in Stripe's docs.

Example query:

query ListIntents {
  stripe {
    paymentIntents {
      nodes {
        id
        description
        customer {
          ... on StripeCustomer {
            email
          }
        }
      }
    }
  }
}

Hop into our Spectrum channel if you have any questions or a use case that's not supported.

🎉 1🚀 1

List plans in Stripe

Sep 23rd, 2019view comments

A couple of updates to the Stripe integration based on customer requests.

You can list your Stripe plans and get the subscriptions for those plans in a single query

query ListStripePlans {
  stripe {
    plans {
      nodes {
        id
        amount
        subscriptions(status: active) {
          nodes {
            id
            customer {
              ... on StripeCustomer {
                name
                email
              }
            }
          }
        }
      }
    }
  }
}

You can also filter invoices based on their status. Here's a query that gets all open invoices, along with the customer's email:

query StripeOpenInvoices {
  stripe {
    invoices(status: open) {
      nodes {
        total
        customer {
          ... on StripeCustomer {
            email
          }
        }
      }
    }
  }
}

Hop into our Spectrum channel if you have any questions or a use case that's not supported.

😄 1

GitHub repository contributors available in OneGraph

Sep 19th, 2019view comments

For those of you who've reached out wondering how to get a list of all the contributors (and the number of their contributions) for a repository in GitHub, we've stitched in another part of the GitHub v3 REST api endpoint!

You can try it out right here

An example use case

Say you wanted to build a view similar to GitHub's contributors view: Screenshot 2019-09-19 12 51 50

Show me the query!

You can get quite most (not all!) of the info with the following query:

query RepositoryContributorsQuery(
  $owner: String!
  $name: String!
  $after: String
) {
  gitHub {
    repository(name: $name, owner: $owner) {
      contributors_oneGraph(
        includeAnonymousContributors: false
        after: $after
      ) {
        nodes {
          avatarUrl
          contributionCount
          login
          user {
            bio
          }
        }
        pageInfo {
          hasNextPage
          hasPreviousPage
          startCursor
          endCursor
        }
      }
    }
  }
}

And you can simply use that query with variables like:

{"owner": "clojure", "name": "clojurescript", "after": null}

or for the second page of contributors (using the after argument and endCursor from the first query result) :

{"owner": "clojure", "name": "clojurescript", "after": "MDpnaXRodWI6MQ"}

Caveats

The API doesn't expose data about when a user contributed, or the total line added/removed by a contributor - just their discrete contribution total.

Pagination returns 30 contributors at a time, and you'll need to fetch more using the after argument until hasNextPage comes back as false.

As usual with our forward-looking integrations, we've marked the stitched field by adding a suffix of _oneGraph in case GitHub adds a contributors field in the future, there won't be a conflict and apps you build today will continue to work on OneGraph!

Try it out

Give it a try to see the top contributors to:

❤️ 1🚀 1

Updates to the Stripe API

Sep 17th, 2019view comments

We've made a big update to the Stripe API to support all of the latest additions from Stripe.

There is a lot of new stuff, so head over to OneGraph to check it out.

We wanted to highlight that you can now query addresses for Stripe customers, since some of you were asking for it:

query StripeCustomers {
  stripe {
    customers {
      edges {
        node {
          id
          email
          address {
            city
            state
            country
            line1
            line2
          }
        }
      }
    }
  }
}

Hop into our Spectrum channel if you have any questions or a use case that's not supported.

❤️ 1

Support for User Events on Intercom

Sep 14th, 2019view comments

We updated our Intercom integration to support listing the most recent events for a user. We also support event summaries.

The following query will get the summary and list of events for your most recently active users:

query IntercomEvents {
  intercom {
    users(first: 10, sortByField: LAST_REQUEST_AT) {
      nodes {
        eventSummary {
          name
          first
          last
          count
        }
        events(first: 10) {
          nodes {
            eventName
            createdAt
            metadata
          }
        }
      }
    }
  }
}

Read more about Intercom Events on Intercom.

Sign up at OneGraph to try it out and hop into our Spectrum channel if you have any questions onegraph.com/chat.

😄 1

Meetup support

Sep 10th, 2019view comments

We've just added support for Meetup via our passthrough API fields.

You can use OneGraph's auth to log in to Meetup and access any part of the Meetup API.

For example, the following query will get all upcoming events related to GraphQL

query MeetupEvents {
  meetup {
    makeRestCall {
      get(
        path: "/find/upcoming_events"
        query: [
          ["radius", "global"],
          ["text", "graphql"],
          ["order", "time"]
        ]
      ) {
        jsonBody
      }
    }
  }
}

If you're using a static site generator like Gatsby.js, you can use OneGraph's server-side auth tokens to embed data from Meetup into your site. Create new tokens from the "Server-side Auth" tab on the OneGraph dashboard.

You could also use our new persisted queries support to create a widget showing upcoming meetups.

The widget below uses a persisted query to pull all upcoming GraphQL-related meetups (view the source on GitHub).

Upcoming GraphQL Meetups

❤️ 1🚀 2