Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/browser_use/browser_use.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
34 changes: 31 additions & 3 deletions components/cloudbeds/cloudbeds.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "cloudbeds",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://api.cloudbeds.com/api/v1.3";
},
_makeRequest({
$ = this, path, headers, ...opts
}) {
return axios($, {
url: `${this._baseUrl()}/${path}`,
headers: {
...headers,
"x-api-key": `${this.$auth.api_key}`,
"accept": "application/json",
},
...opts,
});
},
createWebhook(opts = {}) {
return this._makeRequest({
path: "/postWebhook",
method: "POST",
...opts,
});
},
deleteWebhook(opts = {}) {
return this._makeRequest({
path: "/deleteWebhook",
method: "DELETE",
...opts,
});
},
},
};
7 changes: 5 additions & 2 deletions components/cloudbeds/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/cloudbeds",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Cloudbeds Components",
"main": "cloudbeds.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.1"
}
}
}
67 changes: 67 additions & 0 deletions components/cloudbeds/sources/common/base-webhook.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import cloudbeds from "../../cloudbeds.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
props: {
cloudbeds,
db: "$.service.db",
http: {
type: "$.interface.http",
customResponse: true,
},
},
hooks: {
async activate() {
const { data: { subscriptionID: id } } = await this.cloudbeds.createWebhook({
data: {
endpointUrl: this.http.endpoint,
object: this.getObject(),
action: this.getAction(),
},
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
this.setWebhookId(id);
},
async deactivate() {
const webhookId = this.getWebhookId();
if (webhookId) {
await this.cloudbeds.deleteWebhook({
params: {
subscriptionID: webhookId,
},
});
}
},
},
methods: {
setWebhookId(value) {
this.db.set("webhookId", value);
},
getWebhookId() {
return this.db.get("webhookId");
},
isRelevant() {
return true;
},
getObject() {
throw new ConfigurationError("getObject is not implemented");
},
getAction() {
throw new ConfigurationError("getAction is not implemented");
},
generateMeta() {
throw new ConfigurationError("generateMeta is not implemented");
},
},
async run({ body }) {
this.http.respond({
status: 200,
});
if (!this.isRelevant(body)) {
return;
}
this.$emit(body, this.generateMeta(body));
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import common from "../common/base-webhook.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "cloudbeds-new-guest-created",
name: "New Guest Created (Instant)",
description: "Emit new event when a new guest is created in Cloudbeds. [See the documentation](https://developers.cloudbeds.com/reference/post_postwebhook-2)",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
getObject() {
return "guest";
},
getAction() {
return "created";
},
generateMeta(body) {
return {
id: body.guestId,
summary: `New guest created with ID: ${body.guestId}`,
ts: Math.floor(body.timestamp * 1000),
};
},
},
sampleEmit,
};
9 changes: 9 additions & 0 deletions components/cloudbeds/sources/new-guest-created/test-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
"propertyId": 318267,
"propertyId_str": "318267",
"guestId": 159926682,
"guestId_str": "159926682",
"version": "1.0",
"event": "guest/created",
"timestamp": 1766005021.042568
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import common from "../common/base-webhook.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "cloudbeds-new-reservation-created",
name: "New Reservation Created (Instant)",
description: "Emit new event when a new reservation is created in Cloudbeds. [See the documentation](https://developers.cloudbeds.com/reference/post_postwebhook-2)",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
getObject() {
return "reservation";
},
getAction() {
return "created";
},
generateMeta(body) {
return {
id: body.reservationID,
summary: `New reservation created with ID: ${body.reservationID}`,
ts: Math.floor(body.timestamp * 1000),
};
},
},
sampleEmit,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
"reservationID": "7061304407766",
"propertyID": 318267,
"propertyID_str": "318267",
"startDate": "2025-12-17",
"endDate": "2025-12-18",
"version": "1.0",
"event": "reservation/created",
"timestamp": 1766005022.073195
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import common from "../common/base-webhook.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "cloudbeds-new-transaction-created",
name: "New Transaction Created (Instant)",
description: "Emit new event when a new transaction is created in Cloudbeds. [See the documentation](https://developers.cloudbeds.com/reference/post_postwebhook-2)",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
getObject() {
return "accounting";
},
getAction() {
return "transaction";
},
generateMeta(body) {
return {
id: body.transactionId,
summary: `New transaction created with ID: ${body.transactionId}`,
ts: Date.parse(body.transactionDateTime),
};
},
},
sampleEmit,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
"version": "1.0",
"propertyId": "12345",
"event": "accounting/transaction",
"internalTransactionCode": "8100",
"serviceDate": "2025-09-24",
"transactionDateTime": "2025-09-24T14:01:17",
"transactionId": "148785457922303",
"parentTransactionId": null,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import common from "../common/base-webhook.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "cloudbeds-reservation-status-changed",
name: "Reservation Status Changed (Instant)",

Check warning on line 7 in components/cloudbeds/sources/reservation-status-changed/reservation-status-changed.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a reservation status is changed in Cloudbeds. [See the documentation](https://developers.cloudbeds.com/reference/post_postwebhook-2)",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
...common.props,
statuses: {
type: "string[]",
label: "Statuses",
description: "Watch for reservations that have been updated to the selected statuses",
options: [
"in_progress",
"confirmed",
"not_confirmed",
"canceled",
"checked_in",
"checked_out",
"no_show",
],
optional: true,
},
},
methods: {
...common.methods,
getObject() {
return "reservation";
},
getAction() {
return "status_changed";
},
isRelevant(body) {
return !this.statuses?.length || this.statuses.includes(body.status);
},
generateMeta(body) {
return {
id: `${body.reservationID}-${body.timestamp}`,
summary: `Reservation status changed to ${body.status}`,
ts: Math.floor(body.timestamp * 1000),
};
},
},
sampleEmit,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
"reservationID": "7061304407766",
"propertyID": 318267,
"propertyID_str": "318267",
"status": "canceled",
"actor": {
"type": "user",
"id": "568158"
},
"version": "1.0",
"event": "reservation/status_changed",
"timestamp": 1766005381.816514
}
2 changes: 1 addition & 1 deletion components/gusto/gusto.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Loading
Loading