Skip to main content
GiselleBot GiselleBot

Twitch Connector

These endpoints control the Twitch Connector module.

Note

For the Twitch Connector module, the base URL for the API gateway endpoints is https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/twitch.

Get Twitch User ID

HTTP Request Example

GET /getUserId/discord HTTP/1.1
User-Agent: <YOUR_USER_AGENT>
Host: gateway.cycloptux.com
Accept: application/json
Authorization: <ACCESS_TOKEN>

HTTP Response Example

HTTP/1.1 200 OK
Content-Type: application/json

{
    "userId": "92473777",
    "userName": "discord",
    "displayName": "Discord"
}

This endpoint retrieves the ID of a Twitch user, given their username.

HTTP Request

GET https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/twitch/getUserId/:userName

HTTP Response

The response object contains the following parameters:

ParameterTypeDescription
userIdStringThe ID of the Twitch user.
userNameStringThe username of the Twitch user.
displayNameStringThe display name of the Twitch user (i.e. the channel name).

Get Twitch Game ID

HTTP Request Example

GET /getGameId/just%20chatting HTTP/1.1
User-Agent: <YOUR_USER_AGENT>
Host: gateway.cycloptux.com
Accept: application/json
Authorization: <ACCESS_TOKEN>

HTTP Response Example

HTTP/1.1 200 OK
Content-Type: application/json

{
    "gameId": "509658",
    "gameName": "Just Chatting"
}

This endpoint retrieves the ID of a Twitch game, given its name.

HTTP Request

GET https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/twitch/getGameId/:gameName

HTTP Response

The response consists of an atomic object, containing a gameId parameter (String) indicating the ID of the Twitch game.

The response object contains the following parameters:

ParameterTypeDescription
gameIdStringThe ID of the Twitch game.
gameNameStringThe name of the Twitch game.

Get Twitch Feeds

HTTP Request Example

GET /feeds HTTP/1.1
User-Agent: <YOUR_USER_AGENT>
Host: gateway.cycloptux.com
Accept: application/json
Authorization: <ACCESS_TOKEN>

HTTP Response Example

HTTP/1.1 200 OK
Content-Type: application/json

{
    "feeds": [
        {
            "id": "5fdcabfd7ed3c0c821b66c70",
            "feed_identifier": "427478243",
            "webhook_options": {
                "filter_game": null,
                "filter_event": null,
                "custom_header": null,
                "webhook-name": null,
                "no-username-overwrite": false,
                "no-avatar-overwrite": false
            },
            "display_info": {
                "user_name": "spavald_92",
                "display_name": "spavald_92",
                "user_url": "https://www.twitch.tv/spavald_92",
                "game_names": null
            },
            "webhook_info": {
                "name": "Personal Feeds (Twitch)",
                "avatar": null,
                "channel_id": "789481328328048660"
            }
        },
        ...
    ]
}

This endpoint retrieves the list of feeds for a server.

HTTP Request

GET https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/twitch/feeds

HTTP Response

The response contains the feeds array. Each element of the array has the following parameters:

ParameterTypeDescription
idStringThe feed unique ID.
feed_identifierStringThe feed-specific identifier.
webhook_optionsObjectThe feed-specific webhook options.
display_infoObjectThe display information about the Twitch user the feed refers to.
webhook_infoObjectThe information about the webhook the feed is streaming to.

The webhook_options object contains the following parameters:

ParameterTypeDescription
filter_game?Array<String>An array of Twitch game IDs to filter (i.e. whitelist) when posting items to the feed. Refer to display_info.game_names for the human-readable names. null means that the filter is disabled.
filter_event?Array<String>An array of event types to filter (i.e. whitelist) when posting items to the feed. null means that the filter is disabled. When populated, this array can only contain one of these values: live, offline.
custom_header?StringA custom template to use as message content when posting items to the feed. Custom headers can have a maximum of 1024 characters. null means that the default header will be used.
webhook-name?StringA custom name to use as webhook name (i.e. author) when posting items to the feed. Custom names can have a maximum of 32 characters. null means that the default webhook name will be used.
no-username-overwriteBooleanWhen set to true, the webhook name defined within the "Integrations" section of Discord will not be overwritten by the default or custom webhook name.
no-avatar-overwriteBooleanWhen set to true, the webhook avatar defined within the "Integrations" section of Discord will not be overwritten by the default webhook avatar.

The display_info object contains the following parameters:

ParameterTypeDescription
user_nameStringThe username of the Twitch user.
display_nameStringThe display name of the Twitch user (i.e. the channel name).
user_urlStringThe profile URL of the Twitch user.
game_names?Array<String>If filter_game is set, this array will contain the human-readable game names corresponding to the filter_game IDs.

The webhook_info object contains the following parameters:

ParameterTypeDescription
nameStringThe name of the webhook.
avatarStringThe avatar hash of the webhook.
channel_idStringThe ID of the channel the webhook belongs to.

Create Twitch Feed

HTTP Request Example

POST /feeds HTTP/1.1
User-Agent: <YOUR_USER_AGENT>
Host: gateway.cycloptux.com
Accept: application/json
Authorization: <ACCESS_TOKEN>

{
    "feed_identifier": "92473777",
    "webhook_channel": "789481328328048660",
    "webhook_options": {
        "filter_event": ["live"]
    }
}

HTTP Response Example

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": "62535fdab94a1c7f5e1d19f4",
    "feed_identifier": "92473777",
    "webhook_options": {
        "filter_game": null,
        "filter_event": [
            "live"
        ],
        "custom_header": null,
        "webhook-name": null,
        "no-username-overwrite": false,
        "no-avatar-overwrite": false
    },
    "display_info": {
        "user_name": "discord",
        "display_name": "Discord",
        "user_url": "https://www.twitch.tv/discord",
        "game_names": null
    },
    "webhook_info": {
        "name": "GiselleBot Social Feeds",
        "avatar": null,
        "channel_id": "789481328328048660"
    }
}

This endpoint creates a new feed in a server.

HTTP Request

POST https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/twitch/feeds

Request body parameters:

ParameterTypeRequiredDescription
feed_identifierStringtrueThe feed-specific identifier.
webhook_channelStringtrue*The ID of the channel the feed will be posted to. If the channel ID is specified, the bot will attempt to create a webhook in that channel (if a usable one isn't already present). At least one between webhook_channel and webhook_url must be filled.
webhook_urlStringtrue*The URL of the webhook the feed will be posted to. At least one between webhook_channel and webhook_url must be filled.
webhook_optionsObjectfalseThe options for the feed, as described in the corresponding object in Get Twitch Feeds. If you don't pass one or more options, or don't pass the whole object, default options will be used.

feed_identifier must be a Twitch username or user ID. The corresponding parameter of the response will always be the Twitch user ID.

When using filter_game, each element of the array must be a Twitch game name or game ID. The corresponding element of the response will always be the Twitch game ID(s).

Note

To find the Twitch user ID from a Twitch username, use Get Twitch User ID. To find the Twitch game ID from a Twitch game name, use Get Twitch Game ID.

HTTP Response

The response consists of a feed object.

Refer to Get Twitch Feeds for the full list of parameters.

Update Twitch Feed

HTTP Request Example

PATCH /feeds/62535fdab94a1c7f5e1d19f4 HTTP/1.1
User-Agent: <YOUR_USER_AGENT>
Host: gateway.cycloptux.com
Accept: application/json
Authorization: <ACCESS_TOKEN>

{
    "webhook_options": {
        "filter_game": ["Just Chatting"],
        "filter_event": null
    }
}

HTTP Response Example

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": "62535fdab94a1c7f5e1d19f4",
    "feed_identifier": "92473777",
    "webhook_options": {
        "filter_game": [
            "509658"
        ],
        "filter_event": null,
        "custom_header": null,
        "webhook-name": null,
        "no-username-overwrite": false,
        "no-avatar-overwrite": false
    },
    "display_info": {
        "user_name": "discord",
        "display_name": "Discord",
        "user_url": "https://www.twitch.tv/discord",
        "game_names": null
    },
    "webhook_info": {
        "name": "GiselleBot Social Feeds",
        "avatar": null,
        "channel_id": "789481328328048660"
    }
}

This endpoint updates a feed in a server.

HTTP Request

PATCH https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/twitch/feeds/:feedId

You must send a body with the updated webhook_options object. Refer to Get Twitch Feeds for the full list of parameters. You cannot update the feed_identifier, webhook_channel or webhook_url for an existing feed.

HTTP Response

The response consists of a feed object.

Refer to Get Twitch Feeds for the full list of parameters.

Delete Twitch Feed

HTTP Request Example

DELETE /feeds/62535fdab94a1c7f5e1d19f4 HTTP/1.1
User-Agent: <YOUR_USER_AGENT>
Host: gateway.cycloptux.com
Accept: application/json
Authorization: <ACCESS_TOKEN>

HTTP Response Example

HTTP/1.1 200 OK
Content-Type: application/json

{
    "success": true
}

This endpoint deletes a feed in a server.

HTTP Request

DELETE https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/twitch/feeds/:feedId

HTTP Response

The response consists of an atomic object, containing a success parameter (Boolean) indicating whether the feed was successfully deleted.