Skip to content

New Components - daktela #14211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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/agentql/agentql.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));
},
},
};
};
2 changes: 1 addition & 1 deletion components/api_labz/api_labz.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));
},
},
};
};
2 changes: 1 addition & 1 deletion components/appsflyer/appsflyer.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));
},
},
};
};
2 changes: 1 addition & 1 deletion components/autotask_psa/autotask_psa.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));
},
},
};
};
2 changes: 1 addition & 1 deletion components/botx/botx.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));
},
},
};
};
2 changes: 1 addition & 1 deletion components/classmarker/classmarker.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));
},
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/currents_api/currents_api.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));
},
},
};
};
70 changes: 70 additions & 0 deletions components/daktela/actions/create-account/create-account.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import daktela from "../../daktela.app.mjs";

export default {
key: "daktela-create-account",
name: "Create Account",
description: "Creates a new account on Daktela. [See the documentation](https://customer.daktela.com/apihelp/v6/global/general-information)",
version: "0.0.{{ts}}",

Check warning on line 7 in components/daktela/actions/create-account/create-account.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
daktela,
user: {
propDefinition: [
daktela,
"user",
],
optional: true,
},
sla: {
propDefinition: [
daktela,
"sla",
],
optional: true,
},
survey: {
propDefinition: [
daktela,
"survey",
],
optional: true,
},
name: {
propDefinition: [
daktela,
"name",
],
optional: true,
},
title: {
propDefinition: [
daktela,
"title",
],
optional: true,
},
description: {
propDefinition: [
daktela,
"description",
],
optional: true,
},
},
async run({ $ }) {
const response = await this.daktela.createAccount({
$,
data: {
user: this.user,
sla: this.sla,
survey: this.survey,
name: this.name,
title: this.title,
description: this.description,
},
});

$.export("$summary", `Successfully created account: ${response.title}`);
return response;
},
};
44 changes: 44 additions & 0 deletions components/daktela/actions/make-call/make-call.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import daktela from "../../daktela.app.mjs";
import { axios } from "@pipedream/platform";

Check failure on line 2 in components/daktela/actions/make-call/make-call.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

'axios' is defined but never used

export default {
key: "daktela-make-call",
name: "Initiate Phone Call",
description: "Initiates a phone call via Daktela. [See the documentation](https://customer.daktela.com/apihelp/v6/working-with/call-activities)",
version: "0.0.{{ts}}",

Check warning on line 8 in components/daktela/actions/make-call/make-call.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
daktela,
phoneNumber: {
propDefinition: [
daktela,
"phoneNumber",
],
},
callerNumber: {
propDefinition: [
daktela,
"callerNumber",
],
optional: true,
},
callingTime: {
propDefinition: [
daktela,
"callingTime",
],
optional: true,
},
},
async run({ $ }) {
const params = {
phoneNumber: this.phoneNumber,
callerNumber: this.callerNumber,
callingTime: this.callingTime,
};

const response = await this.daktela.initiateCall(params);
$.export("$summary", `Successfully initiated call to ${this.phoneNumber}`);
return response;
},
};
44 changes: 44 additions & 0 deletions components/daktela/actions/send-sms/send-sms.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import daktela from "../../daktela.app.mjs";
import { axios } from "@pipedream/platform";

Check failure on line 2 in components/daktela/actions/send-sms/send-sms.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

'axios' is defined but never used

export default {
key: "daktela-send-sms",
name: "Send SMS",
description: "Sends an SMS from the Daktela platform. [See the documentation](https://customer.daktela.com/apihelp/v6/working-with/sms-chat-activities)",
version: "0.0.1",
type: "action",
props: {
daktela,
receiverNumber: {
propDefinition: [
daktela,
"receiverNumber",
],
},
textContent: {
propDefinition: [
daktela,
"textContent",
],
},
senderName: {
propDefinition: [
daktela,
"senderName",
],
optional: true,
},
},
async run({ $ }) {
const params = {
to: this.receiverNumber,
text: this.textContent,
from: this.senderName,
};

const response = await this.daktela.sendSms(params);

$.export("$summary", `Successfully sent SMS to ${this.receiverNumber}`);
return response;
},
};
1 change: 1 addition & 0 deletions components/daktela/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const LIMIT = 100;
162 changes: 157 additions & 5 deletions components/daktela/daktela.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,163 @@
import { axios } from "@pipedream/platform";
import { LIMIT } from "./common/constants.mjs";

export default {
type: "app",
app: "daktela",
propDefinitions: {},
propDefinitions: {
user: {
type: "string",
label: "User",
description: "The user associated with the account",
async options({ page }) {
const users = await this.getUsers({
params: {
take: LIMIT,
skip: LIMIT * page,
},
});
return users.map((user) => ({
label: user.name,
value: user.id,
}));
},
},
sla: {
type: "integer",
label: "SLA",
description: "The SLA ID for the account",
},
survey: {
type: "boolean",
label: "Survey",
description: "Indicate if a survey should be sent",
},
name: {
type: "string",
label: "Name",
description: "Unique identification for the account",
},
title: {
type: "string",
label: "Title",
description: "Display name for the account",
},
description: {
type: "string",
label: "Description",
description: "Optional description for the account",
},
receiverNumber: {
type: "string",
label: "Receiver's Number",
description: "The phone number to send the SMS to",
},
textContent: {
type: "string",
label: "Text Content",
description: "The content of the SMS",
},
senderName: {
type: "string",
label: "Sender's Name",
description: "Optional sender's name for the SMS",
},
phoneNumber: {
type: "string",
label: "Phone Number to Call",
description: "The phone number to initiate the call",
},
callerNumber: {
type: "string",
label: "Caller's Number",
description: "The number being used to make the call",
},
callingTime: {
type: "string",
label: "Calling Time",
description: "Time to initiate the call",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl(version = "v5.0") {
return `${this.$auth.instance_url}/api/${version}`;
},
_params(params = {}) {
return {
...params,
"Authorization": `Bearer ${this.$auth.access_token}`,
};
},
_makeRequest({
$ = this, path, version, params, ...opts
}) {
const config = {
url: this._baseUrl(version) + path,
params: this._params(params),
...opts,
};
console.log("config: ", config);
return axios($, config);
},
createAccount(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/accounts.json",
...opts,
});
},
sendSms(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/sms_activities",
...opts,
});
},
initiateCall(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/call_activities",
...opts,
});
},
getUsers(opts = {}) {
return this._makeRequest({
path: "/users.json",
...opts,
});
},
async emitNewAccountCreated() {
const accounts = await this._makeRequest({
path: "/accounts",
});
accounts.forEach((account) => {
this.$emit(account, {
summary: `New account created: ${account.title}`,
id: account.account,
});
});
},
async emitTicketUpdated() {
const tickets = await this._makeRequest({
path: "/tickets",
});
tickets.forEach((ticket) => {
this.$emit(ticket, {
summary: `Ticket updated: ${ticket.title}`,
id: ticket.ticket,
});
});
},
async emitNewContactAdded() {
const contacts = await this._makeRequest({
path: "/contacts",
});
contacts.forEach((contact) => {
this.$emit(contact, {
summary: `New contact added: ${contact.firstname} ${contact.lastname}`,
id: contact.contact,
});
});
},
},
};
};
Loading
Loading