Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix client.push issue and update README for Slack client verification #1182

Merged
merged 3 commits into from
Dec 20, 2024
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
9 changes: 6 additions & 3 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,20 @@ export async function initializeClients(
elizaLogger.log("client keys", Object.keys(clients));

// TODO: Add Slack client to the list
// Initialize clients as an object


if (clientTypes.includes("slack")) {
const slackClient = await SlackClientInterface.start(runtime);
if (slackClient) clients.push(slackClient);
if (slackClient) clients.slack = slackClient; // Use object property instead of push
}

if (character.plugins?.length > 0) {
for (const plugin of character.plugins) {
// if plugin has clients, add those..
if (plugin.clients) {
for (const client of plugin.clients) {
clients.push(await client.start(runtime));
const startedClient = await client.start(runtime);
clients[client.name] = startedClient; // Assuming client has a name property
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion characters/trump.character.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trump",
"clients": [],
"clients": ["slack"],
"modelProvider": "openai",
"settings": {
"secrets": {},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
},
"dependencies": {
"@0glabs/0g-ts-sdk": "0.2.1",
"@ai16z/adapter-postgres": "0.1.6-alpha.4",
"@coinbase/coinbase-sdk": "0.10.0",
"@deepgram/sdk": "^3.9.0",
"@vitest/eslint-plugin": "1.0.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/client-slack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ settings:
7. On the "Basic Information" page, scroll down to "App Credentials"
8. Copy all the credentials - you'll need them in Step 3

### Step 2.5: Verify Event Subscription
Before proceeding to install the app, make sure to verify the event subscription:

1. In your Slack App settings, go to "Event Subscriptions."
2. Enter the request URL (your ngrok HTTPS URL followed by /slack/events).
3. Slack will send a verification request to this URL.
4. Ensure your server is running and configured to respond to the url_verification event by echoing back the challenge token provided in the request.
5. Once verified, you will see a confirmation in your Slack app settings.

### Step 3: Configure Environment Variables
1. Create or edit `.env` file in your project root:
```bash
Expand Down
2 changes: 1 addition & 1 deletion packages/client-slack/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ export async function validateSlackConfig(runtime: IAgentRuntime): Promise<Slack
}
throw error;
}
}
}
Loading
Loading