Open Source

Open Social API: Connect Apps with Your Community

What is an API integration? Why is it important for your online community? In this article, — continue reading
Posted by Ronald te Brake
February 11, 2019

What is an API integration? Why is it important for your online community? In this article, we will explain how (our own) APIs work and how they are useful for improving processes in online communities.

I’m sure you’ve heard of the term API integration, but not everyone may understand what it is exactly and how it is useful. Perhaps, you’ve googled it before and drowned is a sea of acronyms. WDSL? SOAP? Where did I land here? We can help.

An API allows software applications to connect with each other, which means they can communicate and share data. APIs accomplish this by determining rules that developers need to follow in order to interact with certain software. The rules ensure that the data stored by one party can be manipulated and accessed by another on a different software application.

Easy enough! Here’s a quick example though:

A developer can use the Open Social API to automatically synchronize (transfer data) all registered members of their Open Social community with their CRM system. Once implemented, the community manager can request the Open Social API to access the member data from the community, and it responds by sending the data to the right place. The request/respond cycle is basically how it works (fun fact: this method is also used when you access basic web pages in your browser).

This article is for community managers and developers alike. If you’re a community manager, then you will learn the possibilities APIs have for your community. Developers will learn how to integrate their applications with Open Social.

Open Social API integration

Open Social, by definition, is an open online community solution. We are Drupal-based, meaning our code is open for anyone to use, and we accept help from thousands of Drupal developers to make our product awesome. We are also an open team; we share our stories, are part of conventions.

It only makes sense to develop an Open Social API that opens our software to connect with other software applications. Here’s what you should know about it:

Specifications: Our Open Social API implemented the JSON:API specification. This specification dictates how a client should request resources/data to be fetched or modified, and how a server should respond to those requests. This standard is designed to minimize the number of requests and the amount of data transmitted between clients and servers.

Status: Although the Open Social JSON API is still in an alpha state (at the time of writing this article), it is publicly available on Github: social_json_api. Therefore, developers who are using our distribution can try it out themselves!

Availability: The API is available as an experimental offering and we can implement it on request for our SaaS enterprise customers. We will also offer the extension for SaaS Premium customers after a few months of extensive testing and when the module is in a stable state.

Below, there is a real-life example of how the Open Social API can make your online community life a whole lot easier.

Use the API for Paid Memberships

Imagine that you are running a paid online community. Every new member coming in will need an invoice for the paid membership. Here’s where the Open Social API comes in: you could implement a system that creates a sales invoice every time a new user signs up for your Open Social community.

In this example, we will be using the popular accounting software Moneybird in The Netherlands to save the new contacts and create a new invoice.

The user flow is as follows:

  1. A user registers for the Open Social community with a username and email address.
  2. The user is either found on Moneybird as an existing contact or added to Moneybird as a new contact.
  3. A new sales invoice for that contact is created in Moneybird as a draft invoice.
  4. The invoice can be finalized in Moneybird manually and sent to the contact via email.
  5. If new accounts require approval from the site manager then the site manager can activate the account after a successful payment.

Open Social API integration flow chart

How are we building this?

Developer alert! Here’s how we build the API integration between the Open Social community and Moneybird.

We will use Zapier to connect the Open Social API to the Moneybird API. Zapier is an online service that allows you to easily connect your apps and automate workflows. Although we could have built a custom script to show you how the API works we feel that the 1000s of apps that work with Zapier will show you the potential of an API a lot better (and easier).

Zapier already has integration with Moneybird (perfect) and this makes it possible to “find or create new contacts” and “send sales invoices”. Essentially, the ‘respond’ part of our data request is already in place.

We only need to create a custom app in Zapier which:

  1. Authenticates our API, for which we will be using the oAuth2 specification.
  2. Polls for new users every few minutes.
  3. Search for a contact in Moneybird when a new user is found (and if not found, it will create a new contact).
  4. And finally, create a sales invoice in Moneybird for the contact found or created.

You can find the example application on our Github page: goalgorilla/zapier-open-social-example. The installation instructions are provided!

Feel free to use this as a basis for creating your own API integrations.

Creating the “Zap”

Let’s connect all the dots together by creating a “Zap”. This will ensure that the data request we make is actually heard by both software applications. We will be implementing the user flow that was described in the previous chapters.

Please follow the steps in this video!

If everything is configured correctly, Zapier will automatically poll for new changes in our API and then create new contacts in Moneybird. Let’s see it in action!

TLDR; It is now possible to send invoices to newly registered Open Social users, which makes it easy to manage paid memberships in Open Social. This is achieved by connecting the Open Social JSON API to the Zapier service which in turn connects to Moneybird. Awesome!

We can do a lot more…

Important: this article only showed one example of what the JSON API could do for Open Social communities.

Although it’s not designed for paid memberships, it still provided a solution for it. That’s the power of an API. Since it connects various software applications, it becomes synergistic. If you can add another application to your community, then a whole new solution or even use case for your community pops up!

We’re planning to make the next steps and build further integrations with Open Social and improve the stability of the JSON API. Although it is not certain that we will choose Zapier as a solution, it is very likely that we will build and maintain a Zapier app. This will directly allow for Open Social to integrate with 1000s of apps; some examples are:

  • A new message in Slack every time a new post is created in Open Social.
  • A new tweet is posted every time a new topic is created in Open Social.
  • Add a new user to Mailchimp to add the users to email campaigns.
  • Create a Google calendar event for events in Open Social or add every new profile to a Google Sheet.

If you are a developer, please let us know what you think about this and feel free to play around with the API! And community managers, if you are interested in enabling the API for your Open Social installation then don’t hesitate to contact us!

Discover more features like the API integration

In this article we discuss

Related articles