Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
84 changes: 84 additions & 0 deletions components/mumble/actions/add-new-customer/add-new-customer.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import app from "../../mumble.app.mjs";

export default {
key: "mumble-add-new-customer",
name: "Add New Customer",
description: "Adds a new customer. [See the documentation](https://app.mumble.co.il/mumbleapi/docs)",
version: "0.0.1",
type: "action",
props: {
app,
customerPhone: {
propDefinition: [
app,
"customerPhone",
],
},
name: {
propDefinition: [
app,
"name",
],
},
email: {
propDefinition: [
app,
"email",
],
},
source: {
propDefinition: [
app,
"source",
],
},
utmSource: {
propDefinition: [
app,
"utmSource",
],
},
utmMedium: {
propDefinition: [
app,
"utmMedium",
],
},
utmCampaign: {
propDefinition: [
app,
"utmCampaign",
],
},
gclid: {
propDefinition: [
app,
"gclid",
],
},
currentUrl: {
propDefinition: [
app,
"currentUrl",
],
},
},
async run({ $ }) {
const response = await this.app.addNewCustomer({
$,
data: {
customer_phone: this.customerPhone,
name: this.name,
email: this.email,
source: this.source,
utm_source: this.utmSource,
utm_medium: this.utmMedium,
utm_campaign: this.utmCampaign,
gclid: this.gclid,
current_url: this.currentUrl,
},
});
$.export("$summary", "Successfully sent the request to add a new customer: " + response.message);
return response;
},
};
28 changes: 28 additions & 0 deletions components/mumble/actions/add-new-label/add-new-label.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import app from "../../mumble.app.mjs";

export default {
key: "mumble-add-new-label",
name: "Add New Label",
description: "Adds a new label. [See the documentation](https://app.mumble.co.il/mumbleapi/docs)",
version: "0.0.1",
type: "action",
props: {
app,
labelName: {
propDefinition: [
app,
"labelName",
],
},
},
async run({ $ }) {
const response = await this.app.addNewLabel({
$,
data: {
label_name: this.labelName,
},
});
$.export("$summary", "Successfully sent the request to add a new label: " + response.message);
return response;
},
};
28 changes: 28 additions & 0 deletions components/mumble/actions/delete-label/delete-label.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import app from "../../mumble.app.mjs";

export default {
key: "mumble-delete-label",
name: "Delete Label",
description: "Deletes a label. [See the documentation](https://app.mumble.co.il/mumbleapi/docs)",
version: "0.0.1",
type: "action",
props: {
app,
labelNameList: {
propDefinition: [
app,
"labelNameList",
],
},
},
async run({ $ }) {
const response = await this.app.deleteLabel({
$,
data: {
label_name: this.labelNameList,
},
});
$.export("$summary", "Successfully sent the request do delete a label: " + response.message);
return response;
},
};
84 changes: 84 additions & 0 deletions components/mumble/actions/edit-customer/edit-customer.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import app from "../../mumble.app.mjs";

export default {
key: "mumble-edit-customer",
name: "Edit Customer",
description: "Edits the customer with the specified phone number. [See the documentation](https://app.mumble.co.il/mumbleapi/docs)",
version: "0.0.1",
type: "action",
props: {
app,
customerPhone: {
propDefinition: [
app,
"customerPhone",
],
},
name: {
propDefinition: [
app,
"name",
],
},
email: {
propDefinition: [
app,
"email",
],
},
source: {
propDefinition: [
app,
"source",
],
},
utmSource: {
propDefinition: [
app,
"utmSource",
],
},
utmMedium: {
propDefinition: [
app,
"utmMedium",
],
},
utmCampaign: {
propDefinition: [
app,
"utmCampaign",
],
},
gclid: {
propDefinition: [
app,
"gclid",
],
},
currentUrl: {
propDefinition: [
app,
"currentUrl",
],
},
},
async run({ $ }) {
const response = await this.app.editCustomer({
$,
data: {
customer_phone: this.customerPhone,
name: this.name,
email: this.email,
source: this.source,
utm_source: this.utmSource,
utm_medium: this.utmMedium,
utm_campaign: this.utmCampaign,
gclid: this.gclid,
current_url: this.currentUrl,
},
});
$.export("$summary", "Successfully sent the request to edit a customer: " + response.message);
return response;
},
};
133 changes: 128 additions & 5 deletions components/mumble/mumble.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,134 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "mumble",
propDefinitions: {},
propDefinitions: {
labelName: {
type: "string",
label: "Label Name",
description: "Name of the label",
},
customerPhone: {
type: "string",
label: "Customer Phone",
description: "Phone number of the customer",
},
name: {
type: "string",
label: "Name",
description: "Name of the customer",
optional: true,
},
email: {
type: "string",
label: "Email",
description: "Email address",
optional: true,
},
source: {
type: "string",
label: "Source",
description: "Source identifier",
optional: true,
},
utmSource: {
type: "string",
label: "UTM Source",
description: "UTM source value",
optional: true,
},
utmMedium: {
type: "string",
label: "UTM Medium",
description: "UTM medium value",
optional: true,
},
utmCampaign: {
type: "string",
label: "UTM Campaign",
description: "UTM campaign value",
optional: true,
},
gclid: {
type: "string",
label: "GCLID",
description: "Google Ads click ID",
optional: true,
},
currentUrl: {
type: "string",
label: "Current URL",
description: "Current URL",
optional: true,
},
labelNameList: {
type: "string",
label: "Label Name",
description: "Name of the label",
async options() {
const response = await this.getLabels();
const labelsArray = response.labels;
return labelsArray.map((label) => ({
value: label,
label: label,
}));
},
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://app.mumble.co.il/mumbleapi";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
"mumble-api-key": `${this.$auth.api_key}`,
...headers,
},
});
},
async addNewLabel(args = {}) {
return this._makeRequest({
path: "/add-new-label",
method: "post",
...args,
});
},
async deleteLabel(args = {}) {
return this._makeRequest({
path: "/delete-label",
method: "delete",
...args,
});
},
async addNewCustomer(args = {}) {
return this._makeRequest({
path: "/add-new-customer",
method: "post",
...args,
});
},
async editCustomer(args = {}) {
return this._makeRequest({
path: "/edit-customer",
method: "post",
...args,
});
},
async getLabels(args = {}) {
return this._makeRequest({
path: "/get-labels",
...args,
});
},
},
};
};
7 changes: 5 additions & 2 deletions components/mumble/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/mumble",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Mumble Components",
"main": "mumble.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"
}
}
}
Loading
Loading