Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
Falcon
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Walter Huang
Falcon
Commits
2503373b
Commit
2503373b
authored
Jun 24, 2025
by
Haohao Jiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: init slack messager
parent
5e9d50ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
slack.ts
src/clients/slack.ts
+32
-0
No files found.
src/clients/slack.ts
0 → 100644
View file @
2503373b
export
async
function
sendSlackMessage
(
webhookUrl
:
string
,
params
:
{
issue
:
string
,
displayName
:
string
,
language
:
string
,
siteEditor
:
string
})
{
const
text
=
[
`Issue:
${
params
.
issue
}
`
,
`Display Name:
${
params
.
displayName
}
`
,
`Language:
${
params
.
language
}
`
,
`Site editor:
${
params
.
siteEditor
}
`
].
join
(
'
\
n'
);
const
res
=
await
fetch
(
webhookUrl
,
{
method
:
"POST"
,
headers
:
{
"Content-Type"
:
"application/json"
},
body
:
JSON
.
stringify
({
text
})
});
if
(
!
res
.
ok
)
{
throw
new
Error
(
`Slack 推送失败:
${
res
.
status
}
${
res
.
statusText
}
`
);
}
}
// 示例用法
// sendSlackMessage('https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX', {
// issue: 'Theme color missing',
// displayName: 'Lavender',
// language: 'en',
// siteEditor: 'https://www.strikingly.com/s/sites/12572142/edit'
// });
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment