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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import callerapi from "../../callerapi.app.mjs";

export default {
key: "callerapi-get-phone-number-information",
name: "Get Phone Number Information",
description: "Retrieve detailed information about a specific phone number, including name, location, and carrier. [See the documentation](https://callerapi.com/documentation)",
version: "0.0.1",
type: "action",
props: {
callerapi,
phoneNumber: {
propDefinition: [
callerapi,
"phoneNumber",
],
},
},
async run({ $ }) {
const response = await this.callerapi.getPhoneInfo({
$,
phoneNumber: this.phoneNumber,
});
$.export("$summary", `Retrieved information for phone number ${this.phoneNumber}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { ConfigurationError } from "@pipedream/platform";
import fs from "fs";
import callerapi from "../../callerapi.app.mjs";

export default {
key: "callerapi-get-phone-number-picture",
name: "Get Phone Number Picture",
description: "Retrieve the profile picture associated with a phone number. [See the documentation](https://callerapi.com/documentation)",
version: "0.0.1",
type: "action",
props: {
callerapi,
phoneNumber: {
propDefinition: [
callerapi,
"phoneNumber",
],
description: "The phone number to retrieve the profile picture for, in E.164 format (e.g., +18006927753)",
},
},
async run({ $ }) {
try {
const response = await this.callerapi.getPhonePicture({
$,
phoneNumber: this.phoneNumber,
});
const fileName = `CallerAPI-Pictgure-${Date.parse(new Date())}.png`;
const buf = Buffer.from(response, "base64");
fs.writeFileSync(`/tmp/${fileName}`, buf);

$.export("$summary", `The profile picture for ${this.phoneNumber} has been successfully retrieved and saved to the /tmp directory.`);
return {
path: `/tmp/${fileName}`,
};
} catch (e) {
throw new ConfigurationError(e?.response?.data || e);
}
},
};
46 changes: 42 additions & 4 deletions components/callerapi/callerapi.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "callerapi",
propDefinitions: {},
propDefinitions: {
phoneNumber: {
type: "string",
label: "Phone Number",
description: "The phone number to retrieve information for (E.164 format, e.g., +18006927753)",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://callerapi.com/api/phone";
},
_headers() {
return {
"x-auth": this.$auth.api_key,
};
},
_makeRequest({
$ = this, method, path = "/", ...opts
}) {
return axios($, {
...opts,
method,
url: this._baseUrl() + path,
headers: this._headers(),
});
},
getPhoneInfo({
$, phoneNumber,
}) {
return this._makeRequest({
$,
path: `/info/${phoneNumber}`,
});
},
getPhonePicture({
$, phoneNumber,
}) {
return this._makeRequest({
$,
path: `/pic/${phoneNumber}`,
});
},
},
};
7 changes: 5 additions & 2 deletions components/callerapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/callerapi",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream CallerAPI Components",
"main": "callerapi.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
2 changes: 1 addition & 1 deletion components/richpanel/richpanel.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));
},
},
};
};
16 changes: 11 additions & 5 deletions pnpm-lock.yaml

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

Loading