Skip to content

Commit 438bffe

Browse files
[Components] local_reviews - new components (#17179)
* [Components] local_reviews * Update components/local_reviews/actions/get-survey-url/get-survey-url.mjs * eslint * pnpm-lock.yaml --------- Co-authored-by: michelle0927 <[email protected]> Co-authored-by: Michelle Bergeron <[email protected]>
1 parent f5f938a commit 438bffe

File tree

6 files changed

+160
-18
lines changed

6 files changed

+160
-18
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import app from "../../local_reviews.app.mjs";
2+
3+
export default {
4+
key: "local_reviews-get-survey-url",
5+
name: "Get Survey URL",
6+
description: "Retrieve the survey link associated with the connected license. [See the documentation](https://app.localreviews.com/review-tools/api-documentation).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
},
12+
async run({ $ }) {
13+
const response = await this.app.getSurveyUrl({
14+
$,
15+
});
16+
$.export("$summary", "Successfully retrieved survey URL.");
17+
return response;
18+
},
19+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import app from "../../local_reviews.app.mjs";
2+
3+
export default {
4+
key: "local_reviews-send-review-request-via-email",
5+
name: "Send Review Request Via Email",
6+
description: "Send a review invitation to a customer via email. [See the documentation](https://app.localreviews.com/review-tools/api-documentation).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
email: {
12+
type: "string",
13+
label: "Email",
14+
description: "The email address of the recipient.",
15+
},
16+
subject: {
17+
type: "string",
18+
label: "Subject",
19+
description: "The subject of the email.",
20+
},
21+
message: {
22+
type: "string",
23+
label: "Message",
24+
description: "The content of the email message.",
25+
},
26+
},
27+
async run({ $ }) {
28+
const {
29+
app,
30+
email,
31+
subject,
32+
message,
33+
} = this;
34+
const response = await app.sendReviewRequestViaEmail({
35+
$,
36+
data: {
37+
email,
38+
subject,
39+
message,
40+
},
41+
});
42+
$.export("$summary", "Successfully sent review request email.");
43+
return response;
44+
},
45+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import app from "../../local_reviews.app.mjs";
2+
3+
export default {
4+
key: "local_reviews-send-review-request-via-sms",
5+
name: "Send Review Request Via SMS",
6+
description: "Send a review invitation to a customer via SMS. [See the documentation](https://app.localreviews.com/review-tools/api-documentation).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
phone: {
12+
type: "string",
13+
label: "Phone Number",
14+
description: "The phone number of the recipient.",
15+
},
16+
message: {
17+
type: "string",
18+
label: "Message",
19+
description: "The content of the SMS message.",
20+
},
21+
},
22+
async run({ $ }) {
23+
const {
24+
app,
25+
phone,
26+
message,
27+
} = this;
28+
const response = await app.sendReviewRequestViaSms({
29+
$,
30+
data: {
31+
phone,
32+
message,
33+
},
34+
});
35+
$.export("$summary", "Successfully sent review request SMS.");
36+
return response;
37+
},
38+
};
Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,50 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "local_reviews",
46
propDefinitions: {},
57
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
8+
_getBaseUrl(path) {
9+
return `https://api.localreviews.com/api/v2${path}`;
10+
},
11+
_getHeaders() {
12+
return {
13+
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
14+
};
15+
},
16+
_makeRequest({
17+
$ = this, path, ...args
18+
} = {}) {
19+
return axios($, {
20+
url: this._getBaseUrl(path),
21+
headers: this._getHeaders(),
22+
...args,
23+
});
24+
},
25+
post(args = {}) {
26+
return this._makeRequest({
27+
method: "POST",
28+
...args,
29+
});
30+
},
31+
sendReviewRequestViaEmail(args = {}) {
32+
return this.post({
33+
path: "/oauth/oauth-request/send-email",
34+
...args,
35+
});
36+
},
37+
sendReviewRequestViaSms(args = {}) {
38+
return this.post({
39+
path: "/oauth/oauth-request/send-text",
40+
...args,
41+
});
42+
},
43+
getSurveyUrl(args = {}) {
44+
return this._makeRequest({
45+
path: "/oauth/oauth-request/get-survey-url",
46+
...args,
47+
});
948
},
1049
},
1150
};

components/local_reviews/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/local_reviews",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Local Reviews Components",
55
"main": "local_reviews.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
1417
}
15-
}
18+
}

pnpm-lock.yaml

Lines changed: 11 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)