Skip to content

Commit

Permalink
Merge pull request #1182 from SumeetChougule/main
Browse files Browse the repository at this point in the history
fix: Fix client.push issue and update README for Slack client verification
  • Loading branch information
odilitime authored Dec 20, 2024
2 parents a21b124 + 2c432a3 commit 78dd9f1
Show file tree
Hide file tree
Showing 6 changed files with 2,858 additions and 18,135 deletions.
9 changes: 6 additions & 3 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,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

0 comments on commit 78dd9f1

Please sign in to comment.