Update an Integration

To update an integration, the callee needs to have the permissions manage-incoming-integrations AND manage-own-incoming-integrations permissions to be able to update incoming integrations and manage-outgoing-integrations AND manage-own-outgoing-integrations to be able to update outgoing integrations.

HTTP MethodURLRequires Auth

PUT

/api/v1/integrations.update

Body Parameters

KeyExample ValueDescription

type*

webhook-outgoing

The type of integration to update, webhook-outgoing and webhook-incoming are supported.

name*

Guggy

The name of the integration only is shown in the Administration area.

enabled*

true

Whether this integration should be enabled or not.

username*

rocket.cat

The username who to post this the messages as.

channel*

#general

The channel, group, or @username. Can also be all_public_channels, all_private_groups, or all_direct_messages. Comma separated for more than one.

scriptEnabled*

false

Whether the script should be enabled.

integrationId*

ncjK_idsnms

The integration ID that you want to update.

urls

['http://text2gif.guggy.com/guggify']

The urls to call whenever this integration is triggered.

event

sendMessage

This field is required only for outgoing integration.

The type of event can be any of these: sendMessage, fileUploaded, roomArchived, roomCreated, roomJoined, roomLeft, userCreated.

triggerWords

!guggy

Specific words, separated by commas, which should trigger this integration.

alias

Guggy

The alias which should be applied to messages when this integration is processed.

avatar

http://res.guggy.com/logo_128.png

The logo to apply to the messages that this integration sends.

emoji

:ghost:

The emoji which should be displayed as the avatar for messages from this integration.

token

8DFS89DMKLWEN

If your integration requires a special token from the server (api key), use this.

script

Integrations

Script triggered when this integration is triggered.

targetChannel

targeted channel

The channel where messages will be sent to.

target_url

open.rocket.chat

The target url to set.

Example Payload

{
    "type": "webhook-incoming",
    "name": "Test",
    "enabled": false,
    "username": "rocket.cat",
    "scriptEnabled": false,
    "channel": "#test",
    "integrationId": "x3tPXa9XXRqW6Xp2M"
}

Example Call

curl -L -X PUT 'http://localhost:3000/api/v1/integrations.update' \
-H 'X-User-Id: d26x6zSkaPSe5gCyy' \
-H 'X-Auth-Token: Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92' \
-H 'Content-Type: application/json' \
--data-raw '{
    "type": "webhook-incoming",
    "name": "Test",
    "enabled": false,
    "username": "rocket.cat",
    "scriptEnabled": false,
    "channel": "#test",
    "integrationId": "x3tPXa9XXRqW6Xp2M"
}'

Example Response

Success

{
    "integration": {
        "_id": "x3tPXa9XXRqW6Xp2M",
        "enabled": false,
        "channel": [
            "#test"
        ],
        "username": "rodriq",
        "name": "Test",
        "alias": "Jim",
        "avatarUrl": "",
        "emoji": ":ghost:",
        "scriptEnabled": false,
        "script": "console.log(\"MANNNNN ---------------------------------------------------------\")",
        "type": "webhook-incoming",
        "token": "XYsrkngRr5PBkWhCqJWk5ZfKzQoxSv4QhxkK5trSgJENwbRL",
        "userId": "d26x6zSkaPSe5gCyy",
        "_createdAt": "2021-10-22T14:48:46.025Z",
        "_createdBy": {
            "_id": "d26x6zSkaPSe5gCyy",
            "username": "rodriq"
        },
        "_updatedAt": "2021-10-22T16:08:39.843Z",
        "_updatedBy": {
            "_id": "d26x6zSkaPSe5gCyy",
            "username": "rodriq"
        }
    },
    "success": true
}

Error

Any of the following errors can occur on the endpoint.

  • Authorization: Requires an authentication token for the request to be made.

  • Missing Key: Triggers when the endpoint is called without any required endpoint.

  • No integration Found: You get this error when the integration you're trying to update is not found.

{
    "success": false,
    "error": "unauthorized"
}

Change Log

VersionDescription

3.4.0

Added

Last updated

Rocket.Chat versions receive support for six months after release.