@graphai/slack_agent 0.0.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.
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import slackAgent from "./slack_agent";
2
+ export { slackAgent };
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.slackAgent = void 0;
7
+ const slack_agent_1 = __importDefault(require("./slack_agent"));
8
+ exports.slackAgent = slack_agent_1.default;
@@ -0,0 +1,4 @@
1
+ import { AgentFunction, AgentFunctionInfo } from "graphai";
2
+ export declare const slackAgent: AgentFunction;
3
+ declare const slackAgentInfo: AgentFunctionInfo;
4
+ export default slackAgentInfo;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.slackAgent = void 0;
4
+ const web_api_1 = require("@slack/web-api");
5
+ const slackAgent = async ({ params, namedInputs }) => {
6
+ const token = process.env.SLACK_TOKEN ?? namedInputs.slack_token;
7
+ const channel = params.post_channel;
8
+ const message = namedInputs.message ?? params.message;
9
+ const text = Array.isArray(message) ? message.join("\n") : message;
10
+ const web = new web_api_1.WebClient(token);
11
+ await web.chat.postMessage({
12
+ text,
13
+ channel,
14
+ });
15
+ return {};
16
+ };
17
+ exports.slackAgent = slackAgent;
18
+ const slackAgentInfo = {
19
+ name: "slackAgent",
20
+ agent: exports.slackAgent,
21
+ mock: exports.slackAgent,
22
+ samples: [],
23
+ description: "Slack Agent",
24
+ category: ["messaging"],
25
+ author: "Receptron team",
26
+ repository: "https://github.com/receptron/graphai",
27
+ license: "MIT",
28
+ };
29
+ exports.default = slackAgentInfo;
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@graphai/slack_agent",
3
+ "version": "0.0.1",
4
+ "description": "Slack message agents for GraphAI.",
5
+ "main": "lib/index.js",
6
+ "files": [
7
+ "./lib"
8
+ ],
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "eslint": "eslint src --fix",
12
+ "format": "prettier --write '{src,tests}/**/*.ts'",
13
+ "test_run": "node --test --require ts-node/register ./tests/run_*.ts",
14
+ "test": "node --test --require ts-node/register ./tests/test_*.ts",
15
+ "ci": "yarn run format && yarn run eslint && yarn run test && yarn run build"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/isamu/graphai-agents.git"
20
+ },
21
+ "author": "Isamu Arimoto",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/isamu/graphai-agents/issues"
25
+ },
26
+ "homepage": "https://github.com/isamu/graphai-agents#readme",
27
+ "devDependencies": {},
28
+ "dependencies": {
29
+ "@slack/web-api": "^7.3.4",
30
+ "dotenv": "^16.4.5",
31
+ "graphai": "^0.5.7"
32
+ }
33
+ }