Many of us use multiple apps to get things done. But jumping between them can be a real hassle when your information isn’t synced. That’s where Quire’s Open API comes in - it allows developers to connect Quire with other services so data stays consistent across platforms, saving time and keeping workflows smooth.
As an example, we recently launched our Google Calendar Two-Way Sync app. This feature automatically keeps your Quire tasks and Google Calendar events in perfect alignment, working quietly in the background to handle all the technical details.
In this post, we’ll walk through how developers can build a similar two-way sync using the Quire API, using the Google Calendar integration as a real-world example.
Google Calendar Two-Way Sync is made for Premium and higher subscription tiers. More information can be found on our Pricing page.
Think of two-way sync as a conversation between two apps. When you update a task in Quire, it tells the other app about the change. And when something is updated in that other app, it tells Quire. This keeps your information consistent everywhere.
Setting up your Quire App is the first step. You'll need to create one to get the necessary credentials for accessing your Quire project through its API.
For a step-by-step guide on how to create your own app with Quire API, please visit our blog post.
To implement a two-way sync, you'll need to develop a middle-layer app (your app) to act as a bridge between Quire and your targeting app (such as Google Calendar). Think of it as a translator: it'll get information from one side, process it, and then send the right commands to the other. The flow looks like this: Quire ↔ Your App ↔ Other App.
To enable two-way sync, you first need to set up your own server app to act as the middle layer. This app will be responsible for receiving webhook POST requests from both Quire and the other app. Your server should be able to:
You can build this server app using any technology you prefer, such as Node.js, Python, or Ruby. In the following sections, we’ll use Node.js to demonstrate a simple example of how to receive and handle webhook events. Make sure your server is accessible from the internet so that Quire and the other app can send webhook events to it.
Here is a simple Node.js example using Express:
const express = require('express');
const app = express();
app.use(express.json());
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
Next, you’ll need to create a route in your server to receive webhook events from Quire.
app.post('/webhook', (req, res) => {
console.log('Received webhook event:', req.body);
// TODO: Handle the event and update Quire or other app via API
res.status(200).send('Event received');
});
In this example, the webhook route is /webhook
, so the full URL will be ${your-host}/webhook
.
Copy this webhook URL and paste it into the Quire app settings, so Quire knows where to send event notifications to your app.
Additionally, you’ll need to register your Quire app as a follower of the project you want to sync. This ensures your app receives notifications for relevant updates.
For a step-by-step guide on how to receive notifications via Quire API, please visit our guide.
To synchronize updates from the other app with Quire, you’ll also need to create a route in your server to receive webhook events from that app. The registration process is similar to the example shown above for Quire. Simply configure the other app to send its event notifications to your middle app’s webhook endpoint, and make sure your server can handle and process these incoming events appropriately.
Once your app is receiving webhook events from both Quire and the other app, you’ll need to implement logic to process these events and synchronize data between the two platforms. This typically involves:
By carefully handling incoming events and updating data through the APIs, your app ensures that changes are accurately reflected on both sides, maintaining seamless two-way synchronization.
Here’s an example using Node.js and axios:
const axios = require('axios');
app.post('/webhook', (req, res) => {
const { type } = req.body.data;
// Reference of activity types:
// https://github.com/quire-api/quire-api/blob/master/docs/activity_types.md
switch (type) {
case 0: //Quire task created
onQuireTaskCreate();
break;
case 1: //Quire task deleted
onQuireTaskDelete();
break;
}
res.status(200).send('Event received');
});
// Route for handling events from another app to Quire
app.post('/anotherwebhook', async (req, res) => {
const { isCreate, id, name, projectId } = req.body;
if (isCreate) {
// Create a task in the Quire project
await axios.post(`https://quire.io/api/task/${projectId}`, { name });
// Optionally, store the mapping between your app's id and Quire's task id
} else {
// Retrieve the corresponding Quire task id using your mapping logic
const taskOid = getTaskIdByAppEventId(id, projectId);
// Delete the task from the Quire project
await axios.delete(`https://quire.io/api/task/${taskOid}`);
}
res.status(200).send('Event processed successfully');
});
This example demonstrates how to handle create and delete events from another app and synchronize them with Quire. Make sure to implement proper error handling and maintain the ID mapping for reliable sync.
When setting up two-way sync, keep these points in mind:
Using Open API and webhooks, you can keep Quire and your other tools in sync automatically - saving time, reducing errors, and keeping your workflow running smoothly. Now go for it, and have a lot of fun! 😍