Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Latest commit

 

History

History
110 lines (88 loc) · 7.6 KB

File metadata and controls

110 lines (88 loc) · 7.6 KB

Create Integration

Creates an integration, if the callee has the permissions.

Permissions required to create incoming integrations:

  • manage-incoming-integrations
  • manage-own-incoming-integrations

Permissions required to create incoming integrations:

  • manage-outgoing-integrations
  • manage-own-outgoing-integrations
HTTP MethodURLRequires Auth
POST/api/v1/integrations.createyes

Incoming Webhook

Body Parameters

KeyExample ValueDescription
type*webhook-incomingThe type of integration to create.
username*rocket.catThe username who to post this the messages as.
channel*#generalThe channel, group, or @username. Can also be all_public_channels, all_private_groups, or all_direct_messages. Comma separated for more than one.
scriptEnabled*sendMessageWhether the script should be enabled.
scriptIntegrationScript triggered when this integration is triggered.
name*rocket.catThe username who to post this the messages as.
enabled*trueWhether this integration should be enabled or not.
aliasGuggyThe alias which should be applied to messages when this integration is processed.
avatarhttp://res.guggy.com/logo_128.pngThe 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.

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type: application/json" \
     http://localhost:3000/api/v1/integrations.create \
     -d '{ 
          "type": "webhook-incoming", 
          "username": "rocket.cat", 
          "channel": "#general", 
          "scriptEnabled": false,
          "name": "testHook",
          "enabled": true }'

Example Response

{
    "integration": {
        "type": "webhook-incoming",
        "username": "rocket.cat",
        "channel": false,
        "scriptEnabled": "sendMessage",
        "name": "sendMessage",
        "enabled": "sendMessage",
        }

Outgoing Webhook

Body Parameters

KeyExample ValueDescription
type*webhook-outgoingThe type of integration to create, webhook-outgoing and webhook-incoming are supported.
name*GuggyThe name of the integration, only is show on the Administration area.
enabled*trueWhether this integration should be enabled or not.
event*sendMessageThis field is required only for outgoing integration. The type of event, can be any of these: sendMessage, fileUploaded, roomArchived, roomCreated, roomJoined, roomLeft, userCreated.
username*rocket.catThe username who to post this the messages as.
urls*['http://text2gif.guggy.com/guggify']The urls to call whenever this integration is triggered.
scriptEnabled*falseWhether the script should be enabled.
channel*#generalThe channel, group, or @username. Can also be all_public_channels, all_private_groups, or all_direct_messages. Comma separated for more than one.
triggerWords!guggySpecific words, separated by commas, which should trigger this integration.
aliasGuggyThe alias which should be applied to messages when this integration is processed.
avatarhttp://res.guggy.com/logo_128.pngThe 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.
token8DFS89DMKLWENIf your integration requires a special token from the server (api key), use this.
scriptIntegrationsScript triggered when this integration is triggered.

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type: application/json" \
     http://localhost:3000/api/v1/integrations.create \
     -d '{ 
          "type": "webhook-outgoing", 
          "name": "Testing via REST API", 
          "event": "sendMessage", 
          "enabled": false, 
          "channel": "#general", 
          "username": "rocket.cat", 
          "urls": ["http://text2gif.guggy.com/guggify"], 
          "scriptEnabled": false }'

Example Response

{
    "integration": {
        "type": "webhook-outgoing",
        "name": "Testing via REST API",
        "enabled": false,
        "username": "rocket.cat",
        "event": "sendMessage",
        "urls": [
            "http://text2gif.guggy.com/guggify"
        ],
        "scriptEnabled": false,
        "userId": "rocket.cat",
        "channel": [],
        "_createdAt": "2017-01-06T13:23:46.018Z",
        "_createdBy": {
            "username": "graywolf336",
            "_id": "aobEdbYhXfu5hkeqG"
        },
        "_updatedAt": "2017-01-06T13:23:46.018Z",
        "_id": "3aazpZ2WzoBP8msi9"
    },
    "success": true
}

Change Log

Version Description
1.1.0 Separate permissions in incoming and outgoing.
0.49.0 Added