Merge pull request #906 from jgiambo/feat/terminate-group

Add endpoint to terminate (end) a group for everyone
This commit is contained in:
Bernhard B. 2026-11-10 22:13:33 +01:00 committed by GitHub
commit 906b013407
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 156 additions and 0 deletions

View File

@ -125,6 +125,16 @@ e.g:
`curl -X DELETE -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups/+431212131491291/ckRzaEd4VmRzNnJaASAEsasa'`
- Terminate (end) a group for everyone
Permanently end the group with the given group id for all members. Afterwards nobody, not even an admin, can send messages or start calls in the group, but members keep the message history. This can't be undone. The account must be an admin of the group.
`curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups/<number>/<group id>/terminate'`
e.g:
`curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups/+431212131491291/group.ckRzaEd4VmRzNnJaASAEsasa/terminate'`
- Link a device
`curl -X GET -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/qrcodelink?device_name=<device name>'`

View File

@ -1790,6 +1790,42 @@ func (a *Api) QuitGroup(c *gin.Context) {
c.Status(http.StatusNoContent)
}
// @Summary Terminate a Signal Group for all members.
// @Tags Groups
// @Description Permanently end the specified Signal Group for everyone ("End group" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group.
// @Accept json
// @Produce json
// @Success 204 {string} OK
// @Failure 400 {object} Error
// @Param number path string true "Account identifier (E.164 phone number or ACI UUID)"
// @Param groupid path string true "Group ID"
// @Router /v1/groups/{number}/{groupid}/terminate [post]
func (a *Api) TerminateGroup(c *gin.Context) {
_, number, err := accountIdentifierFromParam(c)
if err != nil {
c.JSON(400, Error{Msg: err.Error()})
return
}
if number == "" {
c.JSON(400, Error{Msg: "Couldn't process request - number missing"})
return
}
groupId := c.Param("groupid")
internalGroupId, err := client.ConvertGroupIdToInternalGroupId(groupId)
if err != nil {
c.JSON(400, Error{Msg: err.Error()})
return
}
err = a.signalClient.TerminateGroup(number, internalGroupId)
if err != nil {
c.JSON(400, Error{Msg: err.Error()})
return
}
c.Status(http.StatusNoContent)
}
// @Summary Update the state of a Signal Group.
// @Tags Groups
// @Description Update the state of a Signal Group.

View File

@ -2133,6 +2133,25 @@ func (s *SignalClient) QuitGroup(number string, groupId string) error {
return err
}
func (s *SignalClient) TerminateGroup(number string, groupId string) error {
var err error
var jsonRpc2Client *JsonRpc2Client
if s.signalCliMode == JsonRpc {
type Request struct {
GroupId string `json:"groupId"`
}
request := Request{GroupId: groupId}
jsonRpc2Client, err = s.getJsonRpc2Client()
if err != nil {
return err
}
_, err = jsonRpc2Client.getRaw("terminateGroup", &number, request)
} else {
_, err = s.cliClient.Execute(true, []string{"--config", s.signalCliConfig, "-a", number, "terminateGroup", "-g", groupId}, "")
}
return err
}
func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *string, groupDescription *string, groupName *string, expirationTime *int,
groupLinkState *GroupLinkState, editGroupPermission GroupPermission, addMembersPermission GroupPermission, sendMessagesPermission GroupPermission) error {
var err error

View File

@ -4082,6 +4082,51 @@ const docTemplate = `{
]
}
},
"/v1/groups/{number}/{groupid}/terminate": {
"post": {
"consumes": [
"application/json"
],
"description": "Permanently end the specified Signal Group for everyone (\"End group\" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group.",
"parameters": [
{
"description": "Account identifier (E.164 phone number or ACI UUID)",
"in": "path",
"name": "number",
"required": true,
"type": "string"
},
{
"description": "Group ID",
"in": "path",
"name": "groupid",
"required": true,
"type": "string"
}
],
"produces": [
"application/json"
],
"responses": {
"204": {
"description": "No Content",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
},
"summary": "Terminate a Signal Group for all members.",
"tags": [
"Groups"
]
}
},
"/v1/health": {
"get": {
"description": "Internally used by the docker container to perform the health check.",

View File

@ -4077,6 +4077,51 @@
]
}
},
"/v1/groups/{number}/{groupid}/terminate": {
"post": {
"consumes": [
"application/json"
],
"description": "Permanently end the specified Signal Group for everyone (\"End group\" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group.",
"parameters": [
{
"description": "Account identifier (E.164 phone number or ACI UUID)",
"in": "path",
"name": "number",
"required": true,
"type": "string"
},
{
"description": "Group ID",
"in": "path",
"name": "groupid",
"required": true,
"type": "string"
}
],
"produces": [
"application/json"
],
"responses": {
"204": {
"description": "No Content",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
},
"summary": "Terminate a Signal Group for all members.",
"tags": [
"Groups"
]
}
},
"/v1/health": {
"get": {
"description": "Internally used by the docker container to perform the health check.",

View File

@ -234,6 +234,7 @@ func main() {
groups.POST(":number/:groupid/block", api.BlockGroup)
groups.POST(":number/:groupid/join", api.JoinGroup)
groups.POST(":number/:groupid/quit", api.QuitGroup)
groups.POST(":number/:groupid/terminate", api.TerminateGroup)
groups.PUT(":number/:groupid", api.UpdateGroup)
groups.POST(":number/:groupid/members", api.AddMembersToGroup)
groups.DELETE(":number/:groupid/members", api.RemoveMembersFromGroup)