-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-slack.js
More file actions
36 lines (31 loc) · 1006 Bytes
/
test-slack.js
File metadata and controls
36 lines (31 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Quick Slack integration test
const dotenv = require('dotenv');
dotenv.config({ path: '.env.local' });
async function testSlack() {
console.log('🧪 Testing Slack integration...');
console.log('Webhook URL:', process.env.SLACK_WEBHOOK_URL ? 'Set' : 'Not set');
const webhookUrl = process.env.SLACK_WEBHOOK_URL;
if (!webhookUrl) {
console.error('❌ SLACK_WEBHOOK_URL not set');
return;
}
try {
const response = await fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: '🧪 HackMate Slack Integration Test - Task Started!',
username: 'HackMate Bot',
icon_emoji: ':robot_face:'
})
});
if (response.ok) {
console.log('✅ Slack notification sent successfully!');
} else {
console.error('❌ Slack API error:', response.status);
}
} catch (error) {
console.error('❌ Slack test failed:', error.message);
}
}
testSlack();