Skip to content

Commit d9f205f

Browse files
committed
bloomerang init
1 parent 4ef0ceb commit d9f205f

File tree

8 files changed

+711
-6
lines changed

8 files changed

+711
-6
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import bloomerang from "../../bloomerang.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "bloomerang-add-interaction",
6+
name: "Add Interaction",
7+
description: "Adds an interaction to an existing constituent in Bloomerang. [See the documentation](https://bloomerang.co/product/integrations-data-management/api/rest-api/)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
bloomerang,
12+
constituentId: {
13+
propDefinition: [
14+
bloomerang,
15+
"constituentId",
16+
],
17+
},
18+
interactionType: {
19+
propDefinition: [
20+
bloomerang,
21+
"interactionType",
22+
],
23+
},
24+
interactionDate: {
25+
propDefinition: [
26+
bloomerang,
27+
"interactionDate",
28+
],
29+
},
30+
notes: {
31+
propDefinition: [
32+
bloomerang,
33+
"notes",
34+
],
35+
optional: true,
36+
},
37+
campaignId: {
38+
propDefinition: [
39+
bloomerang,
40+
"campaignId",
41+
],
42+
optional: true,
43+
},
44+
},
45+
async run({ $ }) {
46+
const response = await this.bloomerang.createInteraction({
47+
constituentId: this.constituentId,
48+
interactionType: this.interactionType,
49+
interactionDate: this.interactionDate,
50+
notes: this.notes,
51+
campaignId: this.campaignId,
52+
});
53+
54+
$.export("$summary", `Successfully added interaction with ID ${response.id}`);
55+
return response;
56+
},
57+
};
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import bloomerang from "../../bloomerang.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "bloomerang-create-constituent",
6+
name: "Create Constituent",
7+
description: "Creates a new constituent in Bloomerang. [See the documentation](https://bloomerang.co/product/integrations-data-management/api/rest-api/)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
bloomerang,
12+
constituentType: {
13+
propDefinition: [
14+
bloomerang,
15+
"constituentType",
16+
],
17+
},
18+
name: {
19+
type: "string",
20+
label: "Name",
21+
description: "The name of the constituent",
22+
},
23+
contactDetails: {
24+
type: "string",
25+
label: "Contact Details",
26+
description: "Contact details of the constituent in JSON format",
27+
},
28+
address: {
29+
type: "string",
30+
label: "Address",
31+
description: "Address of the constituent",
32+
optional: true,
33+
},
34+
tags: {
35+
type: "string[]",
36+
label: "Tags",
37+
description: "Tags for the constituent",
38+
optional: true,
39+
},
40+
customFields: {
41+
type: "string[]",
42+
label: "Custom Fields",
43+
description: "Custom fields for the constituent in JSON format",
44+
optional: true,
45+
},
46+
},
47+
async run({ $ }) {
48+
const data = {
49+
constituentType: this.constituentType,
50+
name: this.name,
51+
contactDetails: JSON.parse(this.contactDetails),
52+
address: this.address
53+
? JSON.parse(this.address)
54+
: undefined,
55+
tags: this.tags,
56+
customFields: this.customFields
57+
? this.customFields.map(JSON.parse)
58+
: undefined,
59+
};
60+
61+
const response = await axios($, {
62+
method: "POST",
63+
url: `${this.bloomerang._baseUrl()}/constituents`,
64+
headers: {
65+
Authorization: `Bearer ${this.bloomerang.$auth.api_key}`,
66+
},
67+
data,
68+
});
69+
70+
$.export("$summary", `Successfully created constituent with ID ${response.id}`);
71+
return response;
72+
},
73+
};
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import bloomerang from "../../bloomerang.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "bloomerang-create-donation",
6+
name: "Create Donation",
7+
description: "Creates a new donation record in Bloomerang. [See the documentation](https://bloomerang.co/product/integrations-data-management/api/rest-api/)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
bloomerang,
12+
constituentId: {
13+
propDefinition: [
14+
bloomerang,
15+
"constituentId",
16+
],
17+
},
18+
amount: {
19+
propDefinition: [
20+
bloomerang,
21+
"amount",
22+
],
23+
},
24+
fundId: {
25+
propDefinition: [
26+
bloomerang,
27+
"fundId",
28+
],
29+
},
30+
date: {
31+
propDefinition: [
32+
bloomerang,
33+
"date",
34+
],
35+
},
36+
paymentMethod: {
37+
propDefinition: [
38+
bloomerang,
39+
"paymentMethod",
40+
],
41+
optional: true,
42+
},
43+
note: {
44+
propDefinition: [
45+
bloomerang,
46+
"note",
47+
],
48+
optional: true,
49+
},
50+
appeal: {
51+
propDefinition: [
52+
bloomerang,
53+
"appeal",
54+
],
55+
optional: true,
56+
},
57+
},
58+
async run({ $ }) {
59+
const response = await this.bloomerang.createDonation({
60+
constituentId: this.constituentId,
61+
amount: this.amount,
62+
fundId: this.fundId,
63+
date: this.date,
64+
paymentMethod: this.paymentMethod,
65+
note: this.note,
66+
appeal: this.appeal,
67+
});
68+
69+
$.export("$summary", `Successfully created donation with ID: ${response.id}`);
70+
return response;
71+
},
72+
};

0 commit comments

Comments
 (0)