Express
Build a reservation sync API with Express + Repull.
1
Prerequisites
Node.js 18+ installed on your machine.
You also need a Repull API key. Get one from your dashboard.
2
Install
npm install @repull/sdk express
3
Set up environment variables
Add your credentials to a .env file in your project root:
REPULL_API_KEY=sk_test_YOUR_KEY REPULL_WORKSPACE_ID=YOUR_WORKSPACE_ID
Start with sk_test_ keys for sandbox data. Switch to sk_live_ when you are ready for production.
4
Make your first API call
Initialize the SDK with your API key, then call any endpoint. The example below lists properties and fetches reservations.
const express = require('express')
const { Repull } = require('@repull/sdk')
const app = express()
const dom = new Repull({
apiKey: process.env.REPULL_API_KEY,
workspaceId: process.env.REPULL_WORKSPACE_ID,
})
// List properties
app.get('/properties', async (req, res) => {
const result = await dom.properties.list()
res.json(result.data)
})
// Get Airbnb reservations
app.get('/reservations/airbnb', async (req, res) => {
const result = await dom.reservations.list({ source: 'AIRBNB' })
res.json(result.data)
})
// Update availability
app.put('/availability/:propertyId', express.json(), async (req, res) => {
const result = await dom.availability.update({
propertyId: req.params.propertyId,
updates: req.body.updates,
})
res.json(result.data)
})
// Webhook handler
app.post('/webhooks/repull', express.json(), (req, res) => {
const { hook, data } = req.body
console.log(`Event: ${hook.eventType}, Record: ${data.record.id}`)
res.sendStatus(200)
})
app.listen(3000, () => console.log('Running on :3000'))5
Next steps
You are all set. Explore the rest of the platform:
AI