Skip to main content
GiselleBot GiselleBot

Forms Builder

These endpoints control the Forms Builder module.

Note

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

Note

The documentation often refers to the formId parameter. In interacting with the API, this is what you'll find in form objects as workflow_id.

Get Trello Options

HTTP Request Example

GET /trelloOptions 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

{
    "options": [
        "Description",
        "Title",
        "List",
        "Label",
        "Attachment",
        "Private"
    ]
}

This endpoint retrieves the list of available options that can be used, when generating a form question, to map the question fields to Trello board/card options.

The same information is provided through the Get Form endpoint.

HTTP Request

GET https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/forms/trelloOptions

HTTP Response

The response contains the options array of strings, with the following values:

ValueDescription
DescriptionThe description (content) of a Trello card.
TitleThe title of a Trello card.
ListThe name of a list on the Trello board.
LabelA label on a Trello board, assigned to the card.
AttachmentThe attachment of a Trello card.
PrivateAny field marked with "Private" will not be sent to Trello.

Get Trello Boards

HTTP Request Example

GET /trelloBoards 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

{
    "trello_boards": [
        {
            "id": "0",
            "name": "Disable Trello integration"
        },
        {
            "id": "5c4e576b0386d8313e9e3722",
            "name": "GiselleBot Support Center :: Bug Reports & Future Development"
        }
    ]
}
HTTP/1.1 200 OK
Content-Type: application/json

{
    "trello_boards": [
        {
            "id": "-1",
            "name": "Trello team not paired"
        }
    ]
}

This endpoint retrieves the list of available Trello boards that can be used, when creating a form question, to publish approved submissions (provided the server has a paired Trello team).

The same information is provided through the Get Form endpoint.

HTTP Request

GET https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/forms/trelloBoards

HTTP Response

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

ParameterTypeDescription
idStringThe ID of the Trello board.
nameStringThe name of the Trello board.

When fetching boards, two "special" boards can be found:

  • { "id": "0", "name": "Disable Trello integration" } -> This board ID can be passed in certain options in order to disable the Trello integration.
  • { "id": "-1", "name": "Trello team not paired" } -> This board is shown when the server is not paired to any Trello team.

Get Forms

HTTP Request Example

GET / 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

{
    "forms": [
        {
            "workflow_id": 1,
            "trello_integration": true,
            "workflow_live": true,
            "title": "Bug Reports",
            "color_hex": "#3a7fdb"
        },
        ...
    ]
}

This endpoint retrieves the list of all forms in a server.

HTTP Request

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

HTTP Response

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

ParameterTypeDescription
workflow_idIntegerThe ID of the form.
trello_integrationBooleanWhether the Trello integration is enabled for the form (a.k.a. "Trello Mode").
workflow_liveBooleanWhether the form is currently enabled.
titleStringThe title of the form.
color_hexStringThe form color, as a hexadecimal string.

Get Form

HTTP Request Example

GET /1 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

{
    "workflow_id": 1,
    "channel_id": "534754593490337802",
    "fwd_channel_ids": [
        "539252303400796211"
    ],
    "role_mentions": [
        "539276949307260928"
    ],
    "timestamp_created": "2019-01-28T01:07:25.274Z",
    "workflow_live": true,
    "trello_integration": true,
    "anonymize": true,
    "disable_downvote": false,
    "disable_upvote": false,
    "extended_embed": true,
    "trello_board": "5c4e576b0386d8313e9e3722",
    "title": "Bug Reports",
    "color_hex": "#3a7fdb",
    "highlight_attachments": false,
    "anonymize_rejection": false,
    "disable_mentions": false,
    "disable_priorities": false,
    "steps": [
        {
            "step_id": 1,
            "type": "reaction",
            "string": "What bot are you leaving a bug report for?",
            "answers_validation": [
                "GiselleBot",
                "Belfast-chan",
                "Other"
            ],
            "char_limit": [
                1,
                2000
            ],
            "alias": "Bot Name",
            "trello_mapping": "Label"
        },
        ...
    ],
    "trello_options": [...],
    "trello_boards": [...]
}

This endpoint retrieves one form for a server.

HTTP Request

GET https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/forms/:formId

HTTP Response

The response consists of a form object, with following parameters:

ParameterTypeDescription
workflow_idIntegerThe ID of the form.
channel_idStringThe channel ID of the authorization channel.
fwd_channel_idsArray<String>The channel IDs of the forwarding channels.
role_mentionsArray<String>The role IDs of the authorized role(s).
public_mentionsArray<String>The role IDs of the public role mentions.
timestamp_createdStringThe timestamp of the form creation.
workflow_liveBooleanWhether the form is currently enabled.
trello_integrationBooleanWhether the Trello integration is enabled for the form (a.k.a. "Trello Mode").
anonymizeBooleanWhether the public submissionms are anonymized in Discord Mode (hidden submitter info).
disable_downvoteBooleanWhether the downvote tracking feature (and downvote arrow application for new submissions) is disabled.
disable_upvoteBooleanWhether the upvote tracking feature (and upvote arrow application for new submissions) is disabled.
extended_embedBooleanWhether the extended embed mode is enabled in "Trello Mode" for public in-Discord summary messages.
trello_boardStringThe ID of the Trello board linked to the form.
titleStringThe title of the form.
color_hexStringThe form color, as a hexadecimal string.
highlight_attachmentsBooleanWhether the attachment highlighting feature is enabled.
anonymize_rejectionBooleanWhether the name of the user that rejected a submission will appear in the rejection message.
disable_mentionsBooleanWhether the authorized role(s) will not be mentioned when a new submission is received.
disable_prioritiesBooleanWhether the priority buttons are not applied to the validation message.
stepsArray<Object>An array of steps (questions) for the form (see below for more info).
trello_optionsArray<String>Equivalent to the options array from Get Trello Options.
trello_boardsArray<Object>Equivalent to the trello_boards array from Get Trello Boards.

Each step (question) has the following parameters:

ParameterTypeDescription
step_idIntegerThe ID of the step. This will be recalculated based on the order of the steps when editing the form.
typeStringThe type of question. Accepted values are message or reaction.
stringStringThe content of the question.
answers_validationArray<String>If type is set to reaction, the list of possible answers. If type is set to message, the list of validation words/sentences (answers will be ignored unless the message contains at least one of the chosen words/sentences).
char_limitArray<Integer>An array of two elements, specifying the minimum and maximum number of characters an answer can have. The first element must be higher than 0. The second element must be lower than, or equal to, 2000. The second integer must be higher than, or equal to, the first.
aliasStringA short alias/title that will replace the full question when the submission is sent.
trello_mappingStringThe mapping of the question into one of the entities of the Trello board, if "Trello Mode" is enabled. Refer to Get Trello Options.

Create Form

HTTP Request Example

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

{
    "channel_id": "534754593490337802",
    "fwd_channel_ids": [
        "895420834318020628"
    ],
    "role_mentions": [
        "530800536627314698"
    ],
    "public_mentions": [],
    "trello_integration": false,
    ...
    "steps": [...]
}

HTTP Response Example

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

{
    "workflow_id": 4,
    "channel_id": "534754593490337802",
    "fwd_channel_ids": [
        "895420834318020628"
    ],
    "role_mentions": [
        "530800536627314698"
    ],
    "public_mentions": [],
    "trello_integration": false,
    ...
    "steps": [...],
    "trello_options": [...],
    "trello_boards": [...]
}

This endpoint creates a new form for a server.

HTTP Request

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

The request body must include the full form. Validation checks on individual fields are run server-side. Refer to Get Form for the full list of parameters.

HTTP Response

The response consists of a form object. The workflow_id found in the object must be used as formId in subsequent calls.

Refer to Get Form for the full list of parameters.

Update Form

HTTP Request Example

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

{
    "workflow_id": 1,
    "channel_id": "534754593490337802",
    ...
    "workflow_live": false,
    ...
    "disable_downvote": true,
    "disable_upvote": true,
    ...
    "steps": [...]
}

HTTP Response Example

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

{
    "workflow_id": 1,
    "channel_id": "534754593490337802",
    ...
    "workflow_live": false,
    ...
    "disable_downvote": true,
    "disable_upvote": true,
    ...
    "steps": [...],
    "trello_options": [...],
    "trello_boards": [...]
}

This endpoint updates one form for a server.

HTTP Request

PATCH https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/forms/:formId

The request body must include the full updated form. Validation checks on individual fields are run server-side. Refer to Get Form for the full list of parameters.

HTTP Response

The response consists of a form object.

Refer to Get Form for the full list of parameters.

Delete Form

HTTP Request Example

DELETE /1 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 one form for a server.

HTTP Request

DELETE https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/forms/:formId

HTTP Response

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

Get New Form Template

HTTP Request Example

GET /new 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

{
    "workflow_id": null,
    "channel_id": null,
    "fwd_channel_ids": [],
    "role_mentions": [],
    "public_mentions": [],
    "timestamp_created": null,
    "trello_integration": false,
    "trello_board": "-1",
    "workflow_live": false,
    "title": "TITLE_NOT_FOUND",
    "color_hex": "#00d084",
    ...
    "steps": [],
    "trello_options": [...],
    "trello_boards": [...]
}

This endpoint generates a new form template that can be used as a base to create a new form through Create Form.

HTTP Request

GET https://gateway.cycloptux.com/api/v1/bots/:appClientId/servers/:serverId/modules/forms/new

HTTP Response

The response consists of a "template" form object. The workflow_id is assigned by the server when the template is sent through Create Form.

Refer to Get Form for the full list of parameters.