@pipedream/talkspirit 0.0.3 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ import talkspirit from "../../talkspirit.app.mjs";
2
+
3
+ export default {
4
+ key: "talkspirit-create-post-comment",
5
+ name: "Create Post Comment",
6
+ description: "Creates a new post or adds a comment to an existing thread in Talkspirit using Incoming Webhooks. [See the documentation](https://talkspirit.github.io/docs/incoming-webhooks/)",
7
+ version: "0.0.2",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: false,
12
+ },
13
+ type: "action",
14
+ ai: "optimized",
15
+ props: {
16
+ talkspirit,
17
+ title: {
18
+ type: "string",
19
+ label: "Title",
20
+ description: "The title of the post. Required for new posts, optional for comments in existing threads.",
21
+ optional: true,
22
+ },
23
+ content: {
24
+ type: "string",
25
+ label: "Content",
26
+ description: "The content/text of the post or comment.",
27
+ optional: true,
28
+ },
29
+ url: {
30
+ type: "string",
31
+ label: "URL",
32
+ description: "Optional URL to attach to the post.",
33
+ optional: true,
34
+ },
35
+ displayName: {
36
+ type: "string",
37
+ label: "Display Name",
38
+ description: "The display name for the bot/webhook sender.",
39
+ optional: true,
40
+ },
41
+ iconUrl: {
42
+ type: "string",
43
+ label: "Icon URL",
44
+ description: "URL for the bot/webhook sender's avatar icon.",
45
+ optional: true,
46
+ },
47
+ contactUrl: {
48
+ type: "string",
49
+ label: "Contact URL",
50
+ description: "URL for the bot/webhook sender's profile.",
51
+ optional: true,
52
+ },
53
+ },
54
+ async run({ $ }) {
55
+ const response = await this.talkspirit.sendIncomingWebhook({
56
+ $,
57
+ data: {
58
+ title: this.title,
59
+ content: this.content,
60
+ url: this.url,
61
+ contact: {
62
+ display_name: this.displayName,
63
+ icon: this.iconUrl,
64
+ url: this.contactUrl,
65
+ },
66
+ },
67
+ });
68
+
69
+ $.export("$summary", `Successfully created post${this.title
70
+ ? ` with title: "${this.title}"`
71
+ : ""}`);
72
+
73
+ return response;
74
+ },
75
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/talkspirit",
3
- "version": "0.0.3",
3
+ "version": "0.1.1",
4
4
  "description": "Pipedream talkSpirit Components",
5
5
  "main": "talkspirit.app.mjs",
6
6
  "keywords": [
@@ -11,5 +11,8 @@
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "publishConfig": {
13
13
  "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@pipedream/platform": "^3.1.1"
14
17
  }
15
18
  }
@@ -1,11 +1,23 @@
1
+ import { axios } from "@pipedream/platform";
2
+
1
3
  export default {
2
4
  type: "app",
3
5
  app: "talkspirit",
4
- propDefinitions: {},
5
6
  methods: {
6
- // this.$auth contains connected account data
7
- authKeys() {
8
- console.log(Object.keys(this.$auth));
7
+ _token() {
8
+ return this.$auth.api_key;
9
+ },
10
+ async sendIncomingWebhook({
11
+ $ = this, ...opts
12
+ }) {
13
+ return axios($, {
14
+ method: "POST",
15
+ url: `https://webhook.talkspirit.com/v1/incoming/${this._token()}`,
16
+ headers: {
17
+ "Content-Type": "application/json",
18
+ },
19
+ ...opts,
20
+ });
9
21
  },
10
22
  },
11
23
  };