feat(integrations): Add Chat & Notify integrations
Closes #2203 (closed)
Add Discord, Telegram, Mattermost, Matrix, and Google Chat integrations that use dedicated structs.
As discussed here !2670 (merged), integrations should have dedicated structs that was ment for the `release-client-2.0`.
But, for the integrations that do not exist, we will target the main Instead, as discussed here: !2681 (closed)
Discord
curl -s -X PUT "${API_URL}/groups/${GROUP_ID}/integrations/discord" \
-H "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"webhook":"https://discord.com/api/webhooks/12345/abcde"}' | jq .
{
"notify_only_broken_pipelines": true,
"branches_to_be_notified": "default"
}
Telegram
curl -s -X PUT "${API_URL}/groups/${GROUP_ID}/integrations/telegram" \
-H "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"token":"123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11","room":"-1001234567890"}' | jq .
{
"hostname": null,
"room": "-1001234567890",
"thread": null,
"notify_only_broken_pipelines": true,
"branches_to_be_notified": "default"
}
Mattermost
curl -s -X PUT "${API_URL}/groups/${GROUP_ID}/integrations/mattermost" \
-H "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"webhook":"https://mattermost.example.com/hooks/abcdefg","username":"gitlab_bot","channel":"town-square"}' | jq .
{
"username": "gitlab_bot",
"channel": "town-square",
"notify_only_broken_pipelines": true,
"branches_to_be_notified": "default",
"labels_to_be_notified": null,
"labels_to_be_notified_behavior": "match_any",
"push_channel": null,
"issue_channel": null,
"confidential_issue_channel": null,
"merge_request_channel": null,
"note_channel": null,
"confidential_note_channel": null,
"tag_push_channel": null,
"pipeline_channel": null,
"wiki_page_channel": null,
"deployment_channel": null,
"incident_channel": null
}
Matrix
curl -s -X PUT "${API_URL}/groups/${GROUP_ID}/integrations/matrix" \
-H "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"token":"syt_AbCdEfGn...","room":"!abcdefg:matrix.org","hostname":"https://matrix.org"}' | jq .
{
"hostname": "https://matrix.org",
"room": "!abcdefg:matrix.org",
"notify_only_broken_pipelines": true,
"branches_to_be_notified": "default"
}
Google Chat
curl -s -X PUT "${API_URL}/groups/${GROUP_ID}/integrations/hangouts-chat" \
-H "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"webhook":"https://chat.googleapis.com/v1/spaces/ABC/messages?key=XYZ&token=123"}' | jq .
{
"notify_only_broken_pipelines": false,
"branches_to_be_notified": "all"
}
Part of #2198