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
48 changes: 48 additions & 0 deletions components/membado/actions/add-remove-tags/add-remove-tags.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import membado from "../../membado.app.mjs";

export default {
name: "Add or Remove Tags from User",
version: "0.0.1",
key: "membado-add-remove-tags",
description:
"Assign tags to or remove them from a user. [See the documentation](https://membado.zendesk.com/hc/de/articles/18155937106204-API-Documentation)",
type: "action",
props: {
membado,
mail: {
type: "string",
label: "Email address",
description:
"The email address of the user to whom the tags should be assigned or removed",
},
tagsAdd: {
type: "string[]",
label: "Tags to add",
description: "A list of tag IDs to assign to the user.",
optional: true,
},
tagsRemove: {
type: "string[]",
label: "Tags to remove",
description: "A list of tag IDs to remove from the user.",
optional: true,
},
},
async run({ $ }) {
const response = await this.membado.addMember({
$,
data: {
mail: this.mail,
tags_add: this.tagsAdd?.join?.() ?? this.tagsAdd,
tags_remove: this.tagsRemove?.join?.() ?? this.tagsRemove,
},
});

$.export(
"$summary",
`Successfully changed tags for ${this.mail}`,
);

return response;
},
};
29 changes: 25 additions & 4 deletions components/membado/membado.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "membado",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseRequest({
$, data, headers, ...args
}) {
return axios($, {
baseURL: `https://www.membado.io/api/${this.$auth.user_identifier}`,
data: {
...data,
apikey: this.$auth.api_key,
},
headers: {
...headers,
"content-type": "application/x-www-form-urlencoded",
},
...args,
});
},
addMember(args) {
return this._baseRequest({
method: "POST",
url: "/add-member",
...args,
});
},
},
};
};
7 changes: 5 additions & 2 deletions components/membado/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/membado",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Membado Components",
"main": "membado.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"
}
}
}
9 changes: 6 additions & 3 deletions pnpm-lock.yaml

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

Loading