Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
40 changes: 35 additions & 5 deletions components/highergov/highergov.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "highergov",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://www.highergov.com/zapier";
},
_headers() {
return {
"Content-Type": "application/json",
"Accept": "application/json",
"X-API-KEY": this.$auth.api_key,
};
},
_makeRequest({
$ = this, path, ...opts
}) {
return axios($, {
url: this._baseUrl() + path,
headers: this._headers(),
...opts,
});
},
subscribeWebhook(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/pipeline/subscribe/",
...opts,
});
},
unsubscribeWebhook(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/pipeline/unsubscribe/",
...opts,
});
},
},
};
};
7 changes: 5 additions & 2 deletions components/highergov/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/highergov",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream HigherGov Components",
"main": "highergov.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.1"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import highergov from "../../highergov.app.mjs";
import sampleEmit from "./test-event.mjs";

export default {
key: "highergov-new-pursuit-added-instant",
name: "New Pursuit Added (Instant)",
description: "Emit new event when a pursuit is added to the pipeline.",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
highergov,
http: {
type: "$.interface.http",
customResponse: true,
},
db: "$.service.db",
},
methods: {
emitEvent(event) {
this.$emit(event, {
id: event.opp_key,
summary: `New pursuit added: ${event.title}`,
ts: Date.parse(event.current_datetime),
});
},
},
hooks: {
async activate() {
const hookId = await this.highergov.subscribeWebhook({
data: {
target_url: this.http.endpoint,
},
});
console.log("hookId: ", hookId);
},
async deactivate() {
await this.highergov.unsubscribeWebhook();
},
},
async run({ body }) {
this.$emit(body, {
id: body.opp_key,
summary: `New pursuit added: ${body.title}`,
ts: Date.parse(body.current_datetime),
});
},
sampleEmit,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export default {
"title": "string",
"description_text": "string",
"source_id": "string",
"source_id_version": "string",
"captured_date": "string",
"posted_date": "string",
"due_date": "string",
"agency": {
"agency_key": "string",
"agency_name": "string",
"agency_abbreviation": "string",
"agency_type": "string",
"path": "string"
},
"naics_code": {
"naics_code": "string"
},
"psc_code": {
"psc_code": "string"
},
"primary_contact_email": {
"contact_title": "string",
"contact_name": "string",
"contact_first_name": "string",
"contact_last_name": "string",
"contact_email": "string",
"contact_phone": "string"
},
"secondary_contact_email": {
"contact_title": "string",
"contact_name": "string",
"contact_first_name": "string",
"contact_last_name": "string",
"contact_email": "string",
"contact_phone": "string"
},
"set_aside": "string",
"opp_key": "string",
"version_key": "string",
"source_type": "string",
"unweighted_value": "string",
"current_datetime": "string",
"user_email": "string",
"path": "string"
}
119 changes: 61 additions & 58 deletions pnpm-lock.yaml

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

Loading