/ Platform API
Platform API
    Chat Platform API v3
    Chat Platform API
    Chat Platform API
    Version 3

    Update channel settings by a custom channel type

    Copy link

    You can update the settings for a specific custom channel type using this API.


    HTTP Request

    Copy link
    PUT https://api-{application_id}.sendbird.com/v3/applications/settings_by_channel_custom_type/{custom_type}
    

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    custom_type

    string

    Specifies the custom channel type.


    Request body

    Copy link

    The following table lists the properties of an HTTP request that this action supports.

    Optional
    Property nameTypeDescription

    display_past_message

    boolean

    Determines whether to display past messages to new members of a group channel. If set to true, the entire message history of the channel is shown to members who newly join the channel. (Default: false)

    allow_links

    boolean

    Determines whether to allow clickable links in a message within the application. (Default: true)

    max_message_length

    integer

    Specifies the maximum character length of a message allowed to be sent within the application. Acceptable values are 50, 100, 200, 500, 1000, 5000, 10000, and 20000. (Default: 5000)

    user_messages_per_channel

    integer

    Specifies the maximum number of messages which a user is allowed to send in a channel during the time duration set in the user_messages_per_channel_duration property. A value of -1 indicates that the system limit is imposed. The system allows a user to send up to five messages per second. (Default: -1)

    user_messages_per_channel_duration

    integer

    Specifies the time duration in seconds in which a user can send the set number of messages in a channel. This property works in conjunction with user_messages_per_channel. For example, if the value of user_messages_per_channel is set to 7 and the value of user_messages_per_channel_duration is set to 3, a user can send seven messages in three seconds and any messages beyond the seventh one will be blocked. (Default: 1)

    domain_filter

    nested object

    A domain filter configuration to filter out text and file messages with URLs that contain the domain set.

    domain_filter.domains[]

    array of strings

    Specifies an array of domains to detect. Each item of the array should be specified in a combination of domain name and TLD (top level domain) like amazon.com.

    domain_filter.type

    integer

    Determines which filter to apply to messages with URLs that contain any of the domain set. Acceptable values are the following.
    - 0 (none): Takes no action on matching messages. This is the default value.
    - 1 (allow): Only allows messages containing URLs that match the domains property.
    - 2 (block): Blocks messages containing URLs that match the domains property.
    - 3 (replace): Detects and replaces URLs that match the domains property with asterisks (*).

    profanity_filter

    nested object

    A filter configuration on certain words and patterns for matching character combinations in strings, which are not allowed to be used within the application.

    profanity_filter.keywords[]

    array of strings

    Specifies an array of words to detect.
    -*word filters all words that end with "word" including "word" itself.
    - word* filters all words that start with "word" including "word" itself.

    profanity_filter.regex_filters[]

    array of strings

    Specifies an array of regular expressions used for detecting. Each item of the list should be specified in {"regex": "a pattern in regular expression"}format.

    profanity_filter.type

    integer

    Determines which filtering method to apply to messages that contain the specified keywords or regular expressions. Acceptable values are the following.
    - 0 (none): Takes no action on matched messages. This is the default value.
    - 1 (replace): Detects and replaces words that match the keywords property with asterisks (*).
    - 2 (block): Prevents users from sending messages that contain the keywords property or match the regex_filters property.

    profanity_triggered_moderation

    nested object

    A moderation configuration on which penalty is automatically imposed on users who reach the profanity violation limit within a channel.

    profanity_triggered_moderation.count

    integer

    Specifies the number of profanity violation limit before a penalty is imposed on a user.
    - A value of 0 indicates that automatically-triggered moderation is turned off.
    - A value of greater than or equal to 1 indicates that the moderation is turned on and imposes a penalty on a user who commits a number of violations equal to or beyond the set value of the count property within the set time of the duration property. (Default: 0)

    profanity_triggered_moderation.duration

    integer

    Specifies the duration of the time window in seconds which counts the number of a user’s violations within a channel. For example, if the count property is set to 2 and the duration property is set to 5, the number of violations equal to or beyond two will be moderated for every five seconds. The maximum value is 86400 which indicates 24 hours. (Default: 1 second)

    profanity_triggered_moderation.action

    integer

    Determines the type of moderation penalty within a channel which is permanently imposed on users until canceled. Acceptable values are 0 (no action), 1 (mute), 2 (kick), and 3 (ban). (Default: 0)

    image_moderation

    nested object

    A moderation configuration on inappropriate images in the application. Google Cloud Vision API is used for image moderation and supports many types of images.

    image_moderation.type

    integer

    Determines the moderation method to apply to the images and image URLs in the text and file messages. Acceptable values are the following.
    - 0 (none): No moderation is imposed. This is the default setting.
    - 1 (normal): The messages with images or image URLs are blocked if the images or image URLs violate the content policies.
    - 2 (strict): The file messages with no images are also blocked in addition to the messages with explicit images or inappropriate image URLs.

    image_moderation.soft_block

    boolean

    If true, the moderation method set by the type property above is ignored and no moderation is imposed on the text and file messages in regard to explicit images or inappropriate image URLs. It will only give the image analysis results in the response. If set to false, the image moderation works according to the moderation method already set.

    image_moderation.limits

    nested object

    A set of values returned after an image has been moderated. These limit numbers range from one to five and specify the likelihood of the image passing the moderation standard. Acceptable likelihood values are 0 (unknown), 1 (very unlikely), 2 (unlikely), 3 (possible), 4 (likely), and 5 (very likely).

    image_moderation.limits.adult

    integer

    Specifies the likelihood of the image containing an adult content.

    image_moderation.limits.spoof

    integer

    Specifies spoof likelihood which is the likelihood that a modification was made to the image to make it appear funny or offensive.

    image_moderation.limits.medical

    integer

    Specifies the likelihood of the image being a medical image.

    image_moderation.limits.violence

    integer

    Specifies the likelihood of the image containing violent content.

    image_moderation.limits.racy

    integer

    Specifies the likelihood of the image containing racy content.

    image_moderation.check_urls

    boolean

    Determines whether to check if the image URLs in the text and file messages are appropriate.

    push_template

    nested object

    A configuration of a push notification template for the specified custom channel type.

    push_template.MESG

    string

    Specifies the message content to be displayed in the push notifications for user messages sent in the specified custom channel type. You can customize the message with variables like {sender_name}, {channel_name}, {message}, {file_name}, and {file_type_friendly}.

    push_template.FILE

    string

    Specifies the message content to be displayed in the push notification for file messages sent in the specified custom channel type. You can customize the message with variables like {sender_name}, {channel_name}, {message}, {file_name}, and {file_type_friendly}.

    push_template.ADMM

    string

    Specifies the message content to be displayed in the push notification for admin messages sent in the specified custom channel type. You can customize the message with variables like {sender_name}, {channel_name}, {message}, {file_name}, and {file_type_friendly}.


    Responses

    Copy link

    If successful, this action returns the settings for channels with the custom type in the response body.

    {
        "domain_filter": {
            "domains": ["espn.com", "sports.yahoo.com"],
            "type": 1,
            "should_check_global": true
        },
        "profanity_filter": {
            "keywords": "dumb,dummy",
            "regex_filters": [
                {
                    "regex": "[^!@#$%^&*]*(damn|crap)[^!@#$%^&*]*"
                },
                {
                    "regex": "(http://|https://)?(casino|sex|betting)+([-.]{1}[a-z0-9]+)*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?"
                }
            ],
            "type": 2,
            "should_check_global": false
        },
        "custom_type": "Sports",
        "display_past_message": true,
        "image_moderation": {   // The default settings of image moderation.
            "type": 0,
            "soft_block": false,
            "limits": {
                "adult": 3,
                "spoof": 5,
                "medical": 5,
                "violence": 3,
                "racy": 4
            },
            "check_urls": false
        },
        "push_template": {
            "MESG": {
                "title": "",
                "body": "A new message arrived."
            },
            "FILE": "{sender_name} sent {filename} file",
            "ADMM": "New announcement: {message}"
        },
        "allow_links": true,
        "user_messages_per_channel_duration": 1,
        "user_messages_per_channel": -1,
        "profanity_triggered_moderation": {
            "count": 0,
            "duration": 1,
            "action": 0
        },
        "message_retention_hours": 1440
    }
    

    In the case of an error, an error object like below is returned. See the error codes section for more details.

    {
        "message": "Invalid value: \"JSON body.\".",
        "code": 400201,
        "error": true
    }