Text

    This component renders a text string in one row. You can specify font color, size, and weight.

    The text messages to be sent can also be written in multiple languages, and they will be displayed in the language that matches the client device's language settings.

    For more information, refer to multi language parameters in Send Messages (Text).

    API Type

    Server API

    Request URL

    https://apis.worksmobile.com/r/{API ID}/message/v1/bot/{botNo}/message/push

    HTTP Method

    POST(Content-Type: application/json; charset=UTF-8)

    Request

    Parameter Type Required Description
    type string Y Set this parameter to text.
    text string Y Text.
    Be sure to set either one of the text property or contents property.
    If you set the contents property, text is ignored.
    contents array of objects N Array of spans.
    Be sure to set either one of the text property or contents property.
    If you set the contents property, text is ignored.
    flex number N The ratio of the width or height of this component within the parent box. For more information, see Width and height of components.
    margin string N Minimum space between this component and the previous component in the parent element. For more information, see margin property of the component in “How to Place Components and Adjust Child Components.”
    position string N Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values:

    relative : Use the previous box as reference.
    absolute : Use the top left of parent element as reference.

    The default value is relative. For more information, see Offset in “How to Place Components and Adjust Child Components.”
    offsetTop string N The top offset. For more information, see Offset in “How to Place Components and Adjust Child Components.”
    offsetBottom string N The bottom offset. For more information, see Offset in “How to Place Components and Adjust Child Components.”
    offsetStart string N The left offset. For more information, see Offset in “How to Place Components and Adjust Child Components.”
    offsetEnd string N The right offset. For more information, see Offset in “How to Place Components and Adjust Child Components.”
    size string N Font size.
    You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, or 5xl.
    The size increases in the order of listing.

    The default value is md.
    align string N Alignment style in horizontal direction.
    For more information, see Alignment in horizontal direction in “How to Place Components and Adjust Child Components.”
    gravity string N Alignment style in vertical direction.
    For more information, see Alignment in vertical direction in “How to Place Components and Adjust Child Components.”
    wrap boolean N true to wrap text. The default value is false.
    If set to true, you can use a new line character (\n) to begin on a new line.

    For more information, see Wrapping text in “Flexible Template Elements.”
    maxLines number N Max number of lines.

    If the text does not fit in the specified number of lines, an ellipsis (…) is displayed at the end of the last line.
    If set to 0, all the text is displayed.

    The default value is 0.
    weight string N Font weight. You can specify one of the following values: regular or bold.
    Specifying bold makes the font bold.

    The default value is regular.
    color string N Font color. Use a hexadecimal color code.
    action object N Action performed when this image is tapped. Specify an action object.
    style string N Style of the text. Specify one of the following values:

    normal : Normal
    italic : Italic

    The default value is normal.
    decoration string N Decoration of the text. Specify one of the following values:

    none : No decoration
    underline : Underline
    line-through : Strikethrough

    The default value is none.

    Request Example

    
    {
      "type": "bubble",
      "body": {
        "type": "box",
        "layout": "vertical",
        "contents": [
          {
            "type": "text",
            "text": "The work site begins to move.",
            "size": "sm",
            "align": "center",
            "color": "#ff0000"
          },
          {
            "type": "text",
            "text": "The work site begins to move.",
            "size": "md",
            "align": "center",
            "color": "#00ff00"
          },
          {
            "type": "text",
            "text": "The work site begins to move.",
            "size": "lg",
            "align": "center",
            "weight": "bold",
            "color": "#0000ff"
          }
        ]
      }
    }