Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions components/local_reviews/actions/get-survey-url/get-survey-url.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import app from "../../local_reviews.app.mjs";

export default {
key: "local_reviews-get-survey-url",
name: "Get Survey URL",
description: "Retrieve the survey link associated with the connected license. [See the documentation](https://app.localreviews.com/review-tools/api-documentation).",
version: "0.0.1",
type: "action",
props: {
app,
},
async run({ $ }) {
const response = await this.app.getSurveyUrl();
$.export("$summary", "Successfully retrieved survey URL.");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import app from "../../local_reviews.app.mjs";

export default {
key: "local_reviews-send-review-request-via-email",
name: "Send Review Request Via Email",
description: "Send a review invitation to a customer via email. [See the documentation](https://app.localreviews.com/review-tools/api-documentation).",
version: "0.0.1",
type: "action",
props: {
app,
email: {
type: "string",
label: "Email",
description: "The email address of the recipient.",
},
subject: {
type: "string",
label: "Subject",
description: "The subject of the email.",
},
message: {
type: "string",
label: "Message",
description: "The content of the email message.",
},
},
async run({ $ }) {
const {
app,
email,
subject,
message,
} = this;
const response = await app.sendReviewRequestViaEmail({
$,
data: {
email,
subject,
message,
},
});
$.export("$summary", "Successfully sent review request email.");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import app from "../../local_reviews.app.mjs";

export default {
key: "local_reviews-send-review-request-via-sms",
name: "Send Review Request Via SMS",
description: "Send a review invitation to a customer via SMS. [See the documentation](https://app.localreviews.com/review-tools/api-documentation).",
version: "0.0.1",
type: "action",
props: {
app,
phone: {
type: "string",
label: "Phone Number",
description: "The phone number of the recipient.",
},
message: {
type: "string",
label: "Message",
description: "The content of the SMS message.",
},
},
async run({ $ }) {
const {
app,
phone,
message,
} = this;
const response = await app.sendReviewRequestViaSms({
$,
data: {
phone,
message,
},
});
$.export("$summary", "Successfully sent review request SMS.");
return response;
},
};
45 changes: 42 additions & 3 deletions components/local_reviews/local_reviews.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,50 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "local_reviews",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_getBaseUrl(path) {
return `https://api.localreviews.com/api/v2${path}`;
},
_getHeaders() {
return {
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
};
},
_makeRequest({
$ = this, path, ...args
} = {}) {
return axios($, {
url: this._getBaseUrl(path),
headers: this._getHeaders(),
...args,
});
},
post(args = {}) {
return this._makeRequest({
method: "POST",
...args,
});
},
sendReviewRequestViaEmail(args = {}) {
return this.post({
path: "/oauth/oauth-request/send-email",
...args,
});
},
sendReviewRequestViaSms(args = {}) {
return this.post({
path: "/oauth/oauth-request/send-text",
...args,
});
},
getSurveyUrl(args = {}) {
return this._makeRequest({
path: "/oauth/oauth-request/get-survey-url",
...args,
});
},
},
};
7 changes: 5 additions & 2 deletions components/local_reviews/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/local_reviews",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Local Reviews Components",
"main": "local_reviews.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
}
26 changes: 11 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading