Package google.apps.card.v1

فهرست

اکشن

عملی که رفتار هنگام ارسال فرم را توصیف می‌کند. برای مثال، می‌توانید یک اسکریپت Apps Script را برای مدیریت فرم فراخوانی کنید. اگر این عمل اجرا شود، مقادیر فرم به سرور ارسال می‌شوند.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
function

string

یک تابع سفارشی که هنگام کلیک یا فعال شدن عنصر حاوی آن، فراخوانی می‌شود.

برای مثال، به بخش «خواندن داده‌های فرم» مراجعه کنید.

parameters[]

ActionParameter

فهرست پارامترهای عملیاتی

loadIndicator

LoadIndicator

نشانگر بارگذاری را مشخص می‌کند که اکشن هنگام فراخوانی اکشن نمایش می‌دهد.

persistValues

bool

نشان می‌دهد که آیا مقادیر فرم پس از انجام عمل باقی می‌مانند یا خیر. مقدار پیش‌فرض false است.

اگر true ، مقادیر فرم پس از اجرای اکشن باقی می‌مانند. برای اینکه کاربر بتواند در حین پردازش اکشن، تغییراتی ایجاد کند، LoadIndicator روی NONE تنظیم کنید. برای پیام‌های کارت در برنامه‌های چت، باید ResponseType اکشن را نیز روی UPDATE_MESSAGE تنظیم کنید و از همان card_id کارتی که اکشن در آن قرار دارد استفاده کنید.

اگر false باشد، مقادیر فرم هنگام اجرای اکشن پاک می‌شوند. برای جلوگیری از ایجاد تغییرات توسط کاربر در حین پردازش اکشن، LoadIndicator روی SPINNER تنظیم کنید.

interaction

Interaction

اختیاری. هنگام باز کردن یک کادر محاوره‌ای الزامی است.

در پاسخ به تعامل با کاربر، مانند کلیک کاربر روی دکمه‌ای در یک پیام کارتی، چه باید کرد؟

اگر مشخص نشده باشد، برنامه با اجرای یک action - مانند باز کردن یک لینک یا اجرای یک تابع - به صورت عادی پاسخ می‌دهد.

با مشخص کردن یک interaction ، برنامه می‌تواند به روش‌های تعاملی خاصی پاسخ دهد. برای مثال، با تنظیم interaction روی OPEN_DIALOG ، برنامه می‌تواند یک کادر محاوره‌ای باز کند. در صورت مشخص شدن، نشانگر بارگیری نشان داده نمی‌شود. اگر برای یک افزونه مشخص شود، کل کارت حذف می‌شود و هیچ چیزی در کلاینت نشان داده نمی‌شود.

برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

requiredWidgets[]

string

اختیاری. این لیست را با نام ویجت‌هایی که این اقدام برای ارسال معتبر به آنها نیاز دارد، پر کنید.

اگر ویجت‌های فهرست‌شده در اینجا هنگام فراخوانی این اقدام مقداری نداشته باشند، ارسال فرم لغو می‌شود.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

allWidgetsAreRequired

bool

اختیاری. اگر این مقدار درست باشد، تمام ویجت‌ها توسط این اقدام الزامی در نظر گرفته می‌شوند.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

پارامتر عمل

فهرست پارامترهای رشته‌ای که هنگام فراخوانی متد اکشن باید ارائه شوند. برای مثال، سه دکمه‌ی چرت زدن را در نظر بگیرید: چرت زدن الان، چرت زدن یک روز، یا چرت زدن هفته‌ی بعد. می‌توانید از action method = snooze() استفاده کنید و نوع چرت زدن و زمان چرت زدن را در فهرست پارامترهای رشته‌ای وارد کنید.

برای کسب اطلاعات بیشتر، به CommonEventObject مراجعه کنید.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
key

string

نام پارامتر برای اسکریپت اکشن.

value

string

مقدار پارامتر.

تعامل

اختیاری. هنگام باز کردن یک کادر محاوره‌ای الزامی است.

در پاسخ به تعامل با کاربر، مانند کلیک کاربر روی دکمه‌ای در یک پیام کارتی، چه باید کرد؟

اگر مشخص نشده باشد، برنامه با اجرای یک action - مانند باز کردن یک لینک یا اجرای یک تابع - به صورت عادی پاسخ می‌دهد.

با مشخص کردن یک interaction ، برنامه می‌تواند به روش‌های تعاملی خاصی پاسخ دهد. برای مثال، با تنظیم interaction روی OPEN_DIALOG ، برنامه می‌تواند یک کادر محاوره‌ای باز کند.

در صورت مشخص شدن، نشانگر بارگیری نشان داده نمی‌شود. اگر برای یک افزونه مشخص شود، کل کارت حذف می‌شود و هیچ چیزی در کلاینت نشان داده نمی‌شود.

برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

انوم‌ها
INTERACTION_UNSPECIFIED مقدار پیش‌فرض. action به صورت عادی اجرا می‌شود.
OPEN_DIALOG

یک کادر محاوره‌ای ، یک رابط کاربری پنجره‌ای و مبتنی بر کارت که برنامه‌های چت برای تعامل با کاربران از آن استفاده می‌کنند، باز می‌کند.

فقط توسط برنامه‌های چت در پاسخ به کلیک روی دکمه روی پیام‌های کارت پشتیبانی می‌شود. اگر برای یک افزونه مشخص شود، کل کارت حذف می‌شود و هیچ چیزی در کلاینت نشان داده نمی‌شود.

برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

شاخص بار

نشانگر بارگذاری را مشخص می‌کند که اکشن هنگام فراخوانی اکشن نمایش می‌دهد.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

انوم‌ها
SPINNER یک چرخنده را نمایش می‌دهد تا نشان دهد که محتوا در حال بارگذاری است.
NONE هیچ چیزی نمایش داده نمی‌شود.

استایل حاشیه

گزینه‌های سبک برای حاشیه یک کارت یا ویجت، شامل نوع و رنگ حاشیه.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
type

BorderType

نوع حاشیه.

strokeColor

Color

رنگ‌هایی که باید هنگام تعیین نوع BORDER_TYPE_STROKE استفاده شوند.

برای تنظیم رنگ خط دور متن، مقداری را برای فیلدهای red ، green و blue مشخص کنید. این مقدار باید یک عدد اعشاری بین ۰ و ۱ بر اساس مقدار رنگ RGB باشد، که در آن 0 (۰/۲۵۵) نشان‌دهنده عدم وجود رنگ و 1 (۲۵۵/۲۵۵) نشان‌دهنده حداکثر شدت رنگ است.

برای مثال، کد زیر رنگ را در حداکثر شدت خود به قرمز تنظیم می‌کند:

"color": {
   "red": 1,
   "green": 0,
   "blue": 0,
}

فیلد alpha برای رنگ خط دور متن در دسترس نیست. در صورت مشخص شدن، این فیلد نادیده گرفته می‌شود.

cornerRadius

int32

شعاع گوشه برای حاشیه.

نوع حاشیه

انواع حاشیه‌ای که برای ویجت‌ها اعمال می‌شود را نشان می‌دهد.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

انوم‌ها
BORDER_TYPE_UNSPECIFIED استفاده نکنید. نامشخص.
NO_BORDER بدون مرز.
STROKE مقدار پیش‌فرض. طرح کلی.

دکمه

یک دکمه متنی، آیکون یا ترکیبی از متن و آیکون که کاربران می‌توانند روی آن کلیک کنند. برای مثال در برنامه‌های چت گوگل، به «افزودن دکمه» مراجعه کنید.

برای تبدیل یک تصویر به دکمه‌ی قابل کلیک، یک Image (نه یک ImageComponent ) مشخص کنید و یک اکشن onClick تنظیم کنید.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
text

string

متنی که درون دکمه نمایش داده می‌شود.

icon

Icon

یک آیکون درون دکمه نمایش داده می‌شود. اگر هم icon و هم text تنظیم شده باشند، آیکون قبل از متن ظاهر می‌شود.

color

Color

اختیاری. رنگ دکمه. در صورت تنظیم، type دکمه روی FILLED تنظیم می‌شود و رنگ فیلدهای text و icon برای خوانایی بیشتر، روی رنگی متضاد تنظیم می‌شود. برای مثال، اگر رنگ دکمه روی آبی تنظیم شود، هر متن یا آیکونی در دکمه روی سفید تنظیم می‌شود.

برای تنظیم رنگ دکمه، مقداری را برای فیلدهای red ، green و blue مشخص کنید. این مقدار باید یک عدد اعشاری بین ۰ و ۱ بر اساس مقدار رنگ RGB باشد، که در آن 0 (۰/۲۵۵) نشان‌دهنده عدم وجود رنگ و 1 (۲۵۵/۲۵۵) نشان‌دهنده حداکثر شدت رنگ است.

برای مثال، کد زیر رنگ را در حداکثر شدت خود به قرمز تنظیم می‌کند:

"color": {
   "red": 1,
   "green": 0,
   "blue": 0,
}

فیلد alpha برای رنگ دکمه در دسترس نیست. در صورت مشخص شدن، این فیلد نادیده گرفته می‌شود.

onClick

OnClick

الزامی. عملی که هنگام کلیک کاربر روی دکمه انجام می‌شود، مانند باز کردن یک لینک یا اجرای یک تابع سفارشی.

disabled

bool

اگر true ، دکمه در حالت غیرفعال نمایش داده می‌شود و به اقدامات کاربر پاسخ نمی‌دهد.

altText

string

متن جایگزینی که برای دسترسی‌پذیری استفاده می‌شود.

متن توصیفی تنظیم کنید که به کاربران اطلاع دهد دکمه چه کاری انجام می‌دهد. برای مثال، اگر دکمه‌ای یک هایپرلینک را باز می‌کند، می‌توانید بنویسید: «یک تب جدید در مرورگر باز می‌کند و به مستندات توسعه‌دهندگان گوگل چت در https://developers.google.com/workspace/chat هدایت می‌شود» .

type

Type

اختیاری. نوع دکمه. در صورت عدم تنظیم، نوع دکمه به صورت پیش‌فرض OUTLINED خواهد بود. اگر فیلد color تنظیم شود، نوع دکمه به صورت FILLED تنظیم می‌شود و هر مقداری که برای این فیلد تنظیم شود، نادیده گرفته می‌شود.

نوع

اختیاری. نوع دکمه. اگر فیلد color تنظیم شده باشد، type به صورت اجباری FILLED تنظیم می‌شود.

برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

انوم‌ها
TYPE_UNSPECIFIED استفاده نکنید. نامشخص.
OUTLINED دکمه‌های با حاشیه‌ی مشخص، دکمه‌هایی با تأکید متوسط ​​هستند. آن‌ها معمولاً شامل اقداماتی هستند که مهم هستند، اما اقدام اصلی در یک برنامه‌ی چت یا یک افزونه نیستند.
FILLED یک دکمه‌ی توپر، دارای یک محفظه با رنگ ثابت است. این دکمه بیشترین تأثیر بصری را دارد و برای انجام اقدامات مهم و اصلی در یک برنامه‌ی چت یا یک افزونه توصیه می‌شود.
FILLED_TONAL دکمه‌های با تُن رنگی توپر، حد وسط بین دکمه‌های توپر و دکمه‌های با تُن رنگی مشخص هستند. این دکمه‌ها در مواردی مفید هستند که یک دکمه با اولویت پایین‌تر، به تأکید بیشتری نسبت به دکمه با تُن رنگی مشخص نیاز داشته باشد.
BORDERLESS یک دکمه در حالت پیش‌فرض دارای یک محفظه نامرئی نیست. اغلب برای اقدامات با اولویت پایین استفاده می‌شود، به خصوص هنگام ارائه چندین گزینه.

لیست دکمه

فهرستی از دکمه‌ها که به صورت افقی قرار گرفته‌اند. برای مثال در برنامه‌های چت گوگل، به «افزودن یک دکمه» مراجعه کنید.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
buttons[]

Button

مجموعه‌ای از دکمه‌ها.

کارت

رابط کارتی که در یک پیام Google Chat یا افزونه Google Workspace نمایش داده می‌شود.

کارت‌ها از یک طرح‌بندی تعریف‌شده، عناصر رابط کاربری تعاملی مانند دکمه‌ها و رسانه‌های غنی مانند تصاویر پشتیبانی می‌کنند. از کارت‌ها برای ارائه اطلاعات دقیق، جمع‌آوری اطلاعات از کاربران و راهنمایی کاربران برای برداشتن گام بعدی استفاده کنید.

با استفاده از ابزار ساخت کارت، کارت‌ها را طراحی و پیش‌نمایش کنید.

سازنده کارت را باز کنید

برای آشنایی با نحوه ساخت کارت‌ها، به مستندات زیر مراجعه کنید:

توجه: می‌توانید تا ۱۰۰ ویجت به هر کارت اضافه کنید. هر ویجتی که فراتر از این محدودیت باشد نادیده گرفته می‌شود. این محدودیت هم برای پیام‌ها و پنجره‌های گفتگو در برنامه‌های Google Chat و هم برای کارت‌های موجود در افزونه‌های Google Workspace اعمال می‌شود.

مثال: پیام کارت برای برنامه Google Chat

نمونه کارت تماس

برای ایجاد پیام کارت نمونه در گوگل چت، از JSON زیر استفاده کنید:

{
  "cardsV2": [
    {
      "cardId": "unique-card-id",
      "card": {
        "header": {
           "title": "Sasha",
           "subtitle": "Software Engineer",
           "imageUrl":
           "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png",
           "imageType": "CIRCLE",
           "imageAltText": "Avatar for Sasha"
         },
         "sections": [
           {
             "header": "Contact Info",
             "collapsible": true,
             "uncollapsibleWidgetsCount": 1,
             "widgets": [
               {
                 "decoratedText": {
                   "startIcon": {
                     "knownIcon": "EMAIL"
                   },
                   "text": "sasha@example.com"
                 }
               },
               {
                 "decoratedText": {
                   "startIcon": {
                     "knownIcon": "PERSON"
                   },
                   "text": "<font color=\"#80e27e\">Online</font>"
                 }
               },
               {
                 "decoratedText": {
                   "startIcon": {
                     "knownIcon": "PHONE"
                   },
                   "text": "+1 (555) 555-1234"
                 }
               },
               {
                 "buttonList": {
                   "buttons": [
                     {
                       "text": "Share",
                       "onClick": {
                        "openLink": {
                           "url": "https://example.com/share"
                         }
                       }
                     },
                     {
                       "text": "Edit",
                       "onClick": {
                         "action": {
                           "function": "goToView",
                           "parameters": [
                             {
                               "key": "viewType",
                               "value": "EDIT"
                             }
                           ]
                         }
                       }
                     }
                   ]
                 }
               }
             ]
           }
         ]
       }
    }
  ]
}
فیلدها
header

CardHeader

سربرگ کارت. سربرگ معمولاً شامل یک تصویر در ابتدای کارت و یک عنوان است. سربرگ‌ها همیشه در بالای کارت ظاهر می‌شوند.

sections[]

Section

شامل مجموعه‌ای از ویجت‌ها است. هر بخش، سربرگ اختیاری مخصوص به خود را دارد. بخش‌ها به صورت بصری توسط یک جداکننده خط از هم جدا می‌شوند. برای مثال در برنامه‌های چت گوگل، به بخش تعریف یک بخش از یک کارت مراجعه کنید.

sectionDividerStyle

DividerStyle

سبک جداکننده بین سرصفحه، بخش‌ها و پاصفحه.

cardActions[]

CardAction

اقدامات کارت. اقدامات به منوی نوار ابزار کارت اضافه می‌شوند.

برای افزونه‌های Google Workspace در دسترس است و برای برنامه‌های Google Chat در دسترس نیست.

برای مثال، JSON زیر یک منوی عملیات کارت با گزینه‌های Settings و Send Feedback می‌سازد:

"cardActions": [
  {
    "actionLabel": "Settings",
    "onClick": {
      "action": {
        "functionName": "goToView",
        "parameters": [
          {
            "key": "viewType",
            "value": "SETTING"
         }
        ],
        "loadIndicator": "LoadIndicator.SPINNER"
      }
    }
  },
  {
    "actionLabel": "Send Feedback",
    "onClick": {
      "openLink": {
        "url": "https://example.com/feedback"
      }
    }
  }
]
name

string

نام کارت. به عنوان شناسه کارت در پیمایش کارت استفاده می‌شود.

برای افزونه‌های Google Workspace در دسترس است و برای برنامه‌های Google Chat در دسترس نیست.

fixedFooter

CardFixedFooter

پاورقی ثابت که در پایین این کارت نشان داده شده است.

تنظیم fixedFooter بدون مشخص کردن primaryButton یا secondaryButton باعث خطا می‌شود. برای برنامه‌های چت، می‌توانید از fixed footers در دیالوگ‌ها استفاده کنید، اما نمی‌توانید از card messages استفاده کنید.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

displayStyle

DisplayStyle

در افزونه‌های Google Workspace، ویژگی‌های نمایش peekCardHeader را تنظیم می‌کند.

برای افزونه‌های Google Workspace در دسترس است و برای برنامه‌های Google Chat در دسترس نیست.

peekCardHeader

CardHeader

هنگام نمایش محتوای متنی، هدر کارت Peek به عنوان یک نگهدارنده عمل می‌کند تا کاربر بتواند بین کارت‌های صفحه اصلی و کارت‌های متنی به جلو حرکت کند.

برای افزونه‌های Google Workspace در دسترس است و برای برنامه‌های Google Chat در دسترس نیست.

کارت اکشن

یک اقدام کارت، عملی است که با کارت مرتبط است. برای مثال، یک کارت فاکتور ممکن است شامل اقداماتی مانند حذف فاکتور، ایمیل کردن فاکتور یا باز کردن فاکتور در مرورگر باشد.

برای افزونه‌های Google Workspace در دسترس است و برای برنامه‌های Google Chat در دسترس نیست.

فیلدها
actionLabel

string

برچسبی که به عنوان آیتم منوی عملیات نمایش داده می‌شود.

onClick

OnClick

عمل onClick برای این مورد عملیاتی.

پاورقی ثابت کارت

یک پاورقی (چسبنده) ثابت که در پایین کارت ظاهر می‌شود.

تنظیم fixedFooter بدون مشخص کردن primaryButton یا secondaryButton باعث خطا می‌شود.

برای برنامه‌های چت، می‌توانید از پاورقی‌های ثابت در دیالوگ‌ها استفاده کنید، اما نمی‌توانید از پیام‌های کارتی استفاده کنید. برای مثال در برنامه‌های چت گوگل، به بخش افزودن پاورقی ثابت مراجعه کنید.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
primaryButton

Button

دکمه اصلی پاورقی ثابت. این دکمه باید یک دکمه متنی با متن و رنگ تنظیم شده باشد.

secondaryButton

Button

دکمه ثانویه پاورقی ثابت. این دکمه باید یک دکمه متنی با متن و رنگ تنظیم شده باشد. اگر secondaryButton تنظیم شده باشد، باید primaryButton نیز تنظیم کنید.

هدر کارت

نشان‌دهنده‌ی سربرگ کارت است. برای مثال در برنامه‌های چت گوگل، به افزودن سربرگ مراجعه کنید.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
title

string

الزامی. عنوان سربرگ کارت. سربرگ ارتفاع ثابتی دارد: اگر هم عنوان و هم زیرعنوان مشخص شده باشند، هر کدام یک خط را اشغال می‌کنند. اگر فقط عنوان مشخص شده باشد، هر دو خط را اشغال می‌کند.

subtitle

string

عنوان فرعی سربرگ کارت. در صورت مشخص بودن، در خط جداگانه‌ای زیر title ظاهر می‌شود.

imageType

ImageType

شکلی که برای برش تصویر استفاده می‌شود.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

imageUrl

string

آدرس اینترنتی HTTPS تصویر در هدر کارت.

imageAltText

string

متن جایگزین این تصویر که برای دسترسی‌پذیری استفاده می‌شود.

سبک نمایش

در افزونه‌های Google Workspace، نحوه نمایش یک کارت را تعیین می‌کند.

برای افزونه‌های Google Workspace در دسترس است و برای برنامه‌های Google Chat در دسترس نیست.

انوم‌ها
DISPLAY_STYLE_UNSPECIFIED استفاده نکنید. نامشخص.
PEEK سربرگ کارت در پایین نوار کناری ظاهر می‌شود و تا حدی کارت بالایی فعلی دسته کارت‌ها را می‌پوشاند. کلیک روی سربرگ، کارت را به دسته کارت‌ها منتقل می‌کند. اگر کارت سربرگ نداشته باشد، به جای آن از یک سربرگ تولید شده استفاده می‌شود.
REPLACE مقدار پیش‌فرض. کارت با جایگزینی نمای کارت بالایی در دسته کارت‌ها نمایش داده می‌شود.

سبک جداکننده

سبک جداکننده کارت. در حال حاضر فقط برای جداکننده‌های بین بخش‌های کارت استفاده می‌شود.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

انوم‌ها
DIVIDER_STYLE_UNSPECIFIED استفاده نکنید. نامشخص.
SOLID_DIVIDER گزینه پیش‌فرض. یک جداکننده‌ی محکم ایجاد کنید.
NO_DIVIDER اگر تنظیم شود، هیچ جداکننده‌ای رندر نمی‌شود. این استایل جداکننده را به طور کامل از طرح‌بندی حذف می‌کند. نتیجه معادل این است که اصلاً جداکننده‌ای اضافه نشود.

ویجت تودرتو

فهرستی از ویجت‌ها که می‌توانند در یک طرح‌بندی شامل، مانند یک CarouselCard ، نمایش داده شوند. برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

فیلدها

data فیلد اتحادیه.

data می‌توانند فقط یکی از موارد زیر باشند:

textParagraph

TextParagraph

ویجت پاراگراف متنی.

buttonList

ButtonList

یک ویجت لیست دکمه‌ای.

image

Image

یک ویجت تصویر.

بخش

یک بخش شامل مجموعه‌ای از ویجت‌ها است که به ترتیب مشخص شده به صورت عمودی رندر می‌شوند.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
header

string

متنی که در بالای یک بخش ظاهر می‌شود. از متن ساده با قالب‌بندی HTML پشتیبانی می‌کند. برای اطلاعات بیشتر در مورد قالب‌بندی متن، به افزونه‌های قالب‌بندی متن در برنامه‌های چت گوگل و قالب‌بندی متن در افزونه‌های فضای کاری گوگل مراجعه کنید.

widgets[]

Widget

تمام ابزارک‌های موجود در بخش. باید حداقل شامل یک ابزارک باشد.

collapsible

bool

نشان می‌دهد که آیا این بخش قابل جمع شدن است یا خیر.

بخش‌های قابل جمع شدن، برخی یا همه ویجت‌ها را پنهان می‌کنند، اما کاربران می‌توانند با کلیک روی «نمایش بیشتر» بخش را گسترش دهند تا ویجت‌های پنهان شده آشکار شوند. کاربران می‌توانند با کلیک روی «نمایش کمتر» دوباره ویجت‌ها را پنهان کنند.

برای تعیین اینکه کدام ویجت‌ها پنهان هستند، uncollapsibleWidgetsCount را مشخص کنید.

uncollapsibleWidgetsCount

int32

تعداد ویجت‌های غیرقابل‌جمع که حتی با جمع شدن یک بخش، قابل مشاهده باقی می‌مانند.

برای مثال، وقتی یک بخش شامل پنج ویجت باشد و uncollapsibleWidgetsCount روی 2 تنظیم شده باشد، دو ویجت اول همیشه نمایش داده می‌شوند و سه ویجت آخر به طور پیش‌فرض جمع می‌شوند. uncollapsibleWidgetsCount فقط زمانی در نظر گرفته می‌شود که collapsible برابر true باشد.

collapseControl

CollapseControl

اختیاری. دکمه باز و بسته کردن بخش را تعریف کنید. این دکمه فقط در صورتی نمایش داده می‌شود که بخش قابل باز شدن باشد. اگر این فیلد تنظیم نشود، دکمه پیش‌فرض استفاده می‌شود.

یک چرخ فلک که به عنوان اسلایدر نیز شناخته می‌شود، می‌چرخد و لیستی از ویجت‌ها را در قالب نمایش اسلاید نمایش می‌دهد، با دکمه‌هایی که به ویجت قبلی یا بعدی می‌روند.

برای مثال، این یک نمایش JSON از یک چرخ و فلک است که شامل سه ویجت پاراگراف متنی است.

{
  "carouselCards": [
    {
      "widgets": [
        {
          "textParagraph": {
            "text": "First text paragraph in carousel",
          }
        }
      ]
    },
    {
      "widgets": [
        {
          "textParagraph": {
            "text": "Second text paragraph in carousel",
          }
        }
      ]
    },
    {
      "widgets": [
        {
          "textParagraph": {
            "text": "Third text paragraph in carousel",
          }
        }
      ]
    }
  ]
}

برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

فیلدها
carouselCards[]

CarouselCard

فهرستی از کارت‌های موجود در چرخ و فلک.

کارت چرخ فلک

کارتی که می‌تواند به عنوان یک آیتم چرخ و فلکی نمایش داده شود. برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

فیلدها
widgets[]

NestedWidget

فهرستی از ابزارک‌های نمایش داده شده در کارت چرخ فلک. ابزارک‌ها به ترتیبی که مشخص شده‌اند نمایش داده می‌شوند.

footerWidgets[]

NestedWidget

فهرستی از ابزارک‌ها که در پایین کارت چرخ فلک نمایش داده می‌شود. ابزارک‌ها به ترتیبی که مشخص شده‌اند نمایش داده می‌شوند.

تراشه

یک متن، آیکون یا متن و آیکون که کاربران می‌توانند روی آن کلیک کنند.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
icon

Icon

تصویر آیکون. اگر هم icon و هم text تنظیم شده باشند، آیکون قبل از متن ظاهر می‌شود.

label

string

متنی که درون تراشه نمایش داده می‌شود.

onClick

OnClick

اختیاری. عملی که هنگام کلیک کاربر روی تراشه انجام می‌شود، مانند باز کردن یک لینک یا اجرای یک تابع سفارشی.

enabled
(deprecated)

bool

اینکه آیا تراشه در حالت فعال است و به اقدامات کاربر پاسخ می‌دهد یا خیر. مقدار پیش‌فرض true است. منسوخ شده است. به جای آن از disabled استفاده کنید.

disabled

bool

اینکه آیا تراشه در حالت غیرفعال است و اقدامات کاربر را نادیده می‌گیرد یا خیر. مقدار پیش‌فرض false است.

altText

string

متن جایگزینی که برای دسترسی‌پذیری استفاده می‌شود.

متن توصیفی تنظیم کنید که به کاربران اطلاع دهد تراشه چه کاری انجام می‌دهد. برای مثال، اگر تراشه یک پیوند را باز می‌کند، بنویسید: «یک برگه مرورگر جدید باز می‌کند و به مستندات توسعه‌دهنده Google Chat در https://developers.google.com/workspace/chat می‌رود» .

چیپ لیست

فهرستی از تراشه‌ها که به صورت افقی چیده شده‌اند، که می‌توانند به صورت افقی اسکرول شوند یا به خط بعدی بروند.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
layout

Layout

طرح‌بندی لیست تراشه‌های مشخص‌شده.

chips[]

Chip

مجموعه‌ای از چیپس‌ها.

طرح بندی

طرح لیست تراشه‌ها.

انوم‌ها
LAYOUT_UNSPECIFIED استفاده نکنید. نامشخص.
WRAPPED مقدار پیش‌فرض. اگر فضای افقی کافی وجود نداشته باشد، لیست تراشه‌ها به خط بعدی می‌رود.
HORIZONTAL_SCROLLABLE اگر چیپ‌ها در فضای موجود جا نشوند، به صورت افقی حرکت می‌کنند.

کنترل جمع‌شونده

نمایانگر یک کنترل باز و بسته شدن است.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
horizontalAlignment

HorizontalAlignment

تراز افقی دکمه‌ی باز و بسته شدن.

expandButton

Button

اختیاری. یک دکمه قابل تنظیم برای گسترش بخش تعریف کنید. هر دو فیلد expandButton و collapseButton باید تنظیم شوند. فقط تنظیم یک فیلد اعمال نمی‌شود. اگر این فیلد تنظیم نشود، از دکمه پیش‌فرض استفاده می‌شود.

collapseButton

Button

اختیاری. یک دکمه قابل تنظیم برای جمع کردن بخش تعریف کنید. هر دو فیلد expandButton و collapseButton باید تنظیم شوند. فقط تنظیم یک فیلد اعمال نمی‌شود. اگر این فیلد تنظیم نشود، از دکمه پیش‌فرض استفاده می‌شود.

ستون‌ها

ویجت Columns حداکثر ۲ ستون را در یک کارت یا کادر محاوره‌ای نمایش می‌دهد. می‌توانید به هر ستون ویجت اضافه کنید؛ ویجت‌ها به ترتیبی که مشخص شده‌اند ظاهر می‌شوند. برای مثال در برنامه‌های چت گوگل، به نمایش کارت‌ها و کادرهای محاوره‌ای در ستون‌ها مراجعه کنید.

ارتفاع هر ستون توسط ستون بلندتر تعیین می‌شود. برای مثال، اگر ستون اول از ستون دوم بلندتر باشد، هر دو ستون ارتفاع ستون اول را دارند. از آنجا که هر ستون می‌تواند شامل تعداد متفاوتی از ویجت‌ها باشد، نمی‌توانید ردیف تعریف کنید یا ویجت‌ها را بین ستون‌ها تراز کنید.

ستون‌ها در کنار هم نمایش داده می‌شوند. می‌توانید عرض هر ستون را با استفاده از فیلد HorizontalSizeStyle تنظیم کنید. اگر عرض صفحه نمایش کاربر خیلی باریک باشد، ستون دوم زیر ستون اول قرار می‌گیرد:

  • در وب، ستون دوم در صورتی که عرض صفحه نمایش کمتر یا مساوی ۴۸۰ پیکسل باشد، جمع می‌شود.
  • در دستگاه‌های iOS، اگر عرض صفحه نمایش کمتر یا مساوی ۳۰۰ pt باشد، ستون دوم جمع می‌شود.
  • در دستگاه‌های اندروید، اگر عرض صفحه نمایش کمتر یا مساوی ۳۲۰ dp باشد، ستون دوم جمع می‌شود.

برای اضافه کردن بیش از دو ستون یا استفاده از ردیف‌ها، از ویجت Grid استفاده کنید.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است. رابط‌های کاربری افزونه‌هایی که از ستون‌ها پشتیبانی می‌کنند عبارتند از:

  • کادر محاوره‌ای که هنگام باز کردن افزونه از پیش‌نویس ایمیل توسط کاربران نمایش داده می‌شود.
  • کادر محاوره‌ای که هنگام باز کردن افزونه از منوی «افزودن پیوست» در رویداد تقویم گوگل توسط کاربران نمایش داده می‌شود.
فیلدها
columnItems[]

Column

آرایه‌ای از ستون‌ها. می‌توانید تا ۲ ستون را در یک کارت یا کادر محاوره‌ای قرار دهید.

ستون

یک ستون.

افزونه‌های Google Workspace و برنامه‌های چت

فیلدها
horizontalSizeStyle

HorizontalSizeStyle

مشخص می‌کند که یک ستون چگونه عرض کارت را پر کند.

horizontalAlignment

HorizontalAlignment

مشخص می‌کند که آیا ویجت‌ها در سمت چپ، راست یا مرکز یک ستون ترازبندی شوند.

verticalAlignment

VerticalAlignment

مشخص می‌کند که آیا ویجت‌ها در بالا، پایین یا مرکز یک ستون ترازبندی شوند یا خیر.

widgets[]

Widgets

آرایه‌ای از ویجت‌ها که در یک ستون قرار گرفته‌اند. ویجت‌ها به ترتیبی که مشخص شده‌اند، نمایش داده می‌شوند.

سبک اندازه افقی

مشخص می‌کند که یک ستون چگونه عرض کارت را پر می‌کند. عرض هر ستون به HorizontalSizeStyle و عرض ویجت‌های درون ستون بستگی دارد.

افزونه‌های Google Workspace و برنامه‌های چت

انوم‌ها
HORIZONTAL_SIZE_STYLE_UNSPECIFIED استفاده نکنید. نامشخص.
FILL_AVAILABLE_SPACE مقدار پیش‌فرض. ستون فضای موجود را تا ۷۰٪ از عرض کارت پر می‌کند. اگر هر دو ستون روی FILL_AVAILABLE_SPACE تنظیم شده باشند، هر ستون ۵۰٪ از فضا را پر می‌کند. در وب، اگر هنوز فضای خالی در کارت وجود داشته باشد، ستون برای جلوگیری از بسته‌بندی غیرضروری، گسترش می‌یابد.
FILL_MINIMUM_SPACE ستون کمترین فضای ممکن و حداکثر 30٪ از عرض کارت را پر می‌کند. در وب، اگر هنوز فضای خالی در کارت وجود داشته باشد، ستون گسترش می‌یابد تا از بسته‌بندی غیرضروری جلوگیری شود.

ترازبندی عمودی

مشخص می‌کند که آیا ویجت‌ها در بالا، پایین یا مرکز یک ستون ترازبندی شوند یا خیر.

افزونه‌های Google Workspace و برنامه‌های چت

انوم‌ها
VERTICAL_ALIGNMENT_UNSPECIFIED استفاده نکنید. نامشخص.
CENTER مقدار پیش‌فرض. ویجت‌ها را در مرکز ستون تراز می‌کند.
TOP ویجت‌ها را در بالای یک ستون تراز می‌کند.
BOTTOM ویجت‌ها را در پایین ستون تراز می‌کند.

ابزارک‌ها

ویجت‌های پشتیبانی‌شده‌ای که می‌توانید در یک ستون قرار دهید.

افزونه‌های Google Workspace و برنامه‌های چت

فیلدها

data فیلد اتحادیه.

data می‌توانند فقط یکی از موارد زیر باشند:

textParagraph

TextParagraph

ویجت TextParagraph

image

Image

ویجت Image .

decoratedText

DecoratedText

ویجت DecoratedText

buttonList

ButtonList

ویجت ButtonList

textInput

TextInput

ویجت TextInput

selectionInput

SelectionInput

ویجت SelectionInput .

dateTimePicker

DateTimePicker

ویجت انتخابگر DateTimePicker

chipList

ChipList

ویجت ChipList .

اقدامات داده

یک افزونه که داده‌های Google Workspace را به‌روزرسانی می‌کند.

فیلدها
hostAppDataAction

HostAppDataActionMarkup

نحوه به‌روزرسانی داده‌های Google Workspace را تعریف می‌کند.

انتخابگر تاریخ و زمان

به کاربران اجازه می‌دهد تاریخ، زمان یا هر دو را وارد کنند. از اعتبارسنجی ارسال فرم پشتیبانی می‌کند. وقتی Action.all_widgets_are_required روی true تنظیم شده باشد یا این ویجت در Action.required_widgets مشخص شده باشد، عملیات ارسال مسدود می‌شود مگر اینکه مقداری انتخاب شود. برای مثال در برنامه‌های چت گوگل، به بخش «اجازه دهید کاربر تاریخ و زمان را انتخاب کند» مراجعه کنید.

کاربران می‌توانند متن را وارد کنند یا از انتخابگر برای انتخاب تاریخ و زمان استفاده کنند. اگر کاربران تاریخ یا زمان نامعتبری وارد کنند، انتخابگر خطایی را نشان می‌دهد که از کاربران می‌خواهد اطلاعات را به درستی وارد کنند.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
name

string

نامی که DateTimePicker در رویداد ورودی فرم با آن شناسایی می‌شود.

برای جزئیات بیشتر در مورد کار با ورودی‌های فرم، به بخش «دریافت داده‌های فرم» مراجعه کنید.

label

string

متنی که کاربران را به وارد کردن تاریخ، زمان یا تاریخ و زمان ترغیب می‌کند. برای مثال، اگر کاربران در حال برنامه‌ریزی قرار ملاقات هستند، از برچسبی مانند Appointment date یا Appointment date and time استفاده کنید.

type

DateTimePickerType

اینکه آیا ویجت از وارد کردن تاریخ، زمان یا تاریخ و زمان پشتیبانی می‌کند یا خیر.

valueMsEpoch

int64

مقدار پیش‌فرض نمایش داده شده در ویجت، بر حسب میلی‌ثانیه از زمان آغاز یونیکس .

مقدار را بر اساس نوع انتخابگر ( DateTimePickerType ) مشخص کنید:

  • DATE_AND_TIME : یک تاریخ و زمان تقویمی بر حسب UTC. برای مثال، برای نمایش ۱ ژانویه ۲۰۲۳ در ساعت ۱۲:۰۰ بعد از ظهر به وقت UTC، از 1672574400000 استفاده کنید.
  • DATE_ONLY : یک تاریخ تقویمی در ساعت 00:00:00 UTC. برای مثال، برای نمایش ۱ ژانویه ۲۰۲۳، از 1672531200000 استفاده کنید.
  • TIME_ONLY : زمان بر حسب UTC. برای مثال، برای نمایش ساعت ۱۲:۰۰ بعد از ظهر، از 43200000 (یا 12 * 60 * 60 * 1000 ) استفاده کنید.
timezoneOffsetDate

int32

عددی که نشان‌دهنده‌ی اختلاف منطقه‌ی زمانی نسبت به UTC، بر حسب دقیقه است. در صورت تنظیم، value_ms_epoch در منطقه‌ی زمانی مشخص شده نمایش داده می‌شود. در صورت عدم تنظیم، مقدار پیش‌فرض روی تنظیمات منطقه‌ی زمانی کاربر تنظیم می‌شود.

onChangeAction

Action

زمانی که کاربر روی ذخیره یا پاک کردن از رابط DateTimePicker کلیک کند، فعال می‌شود.

نوع انتخابگر تاریخ و زمان

قالب تاریخ و زمان در ویجت DateTimePicker . تعیین می‌کند که آیا کاربران می‌توانند تاریخ، زمان یا هر دو را وارد کنند.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

انوم‌ها
DATE_AND_TIME کاربران تاریخ و زمان را وارد می‌کنند.
DATE_ONLY کاربران یک تاریخ وارد می‌کنند.
TIME_ONLY کاربران یک زمان وارد می‌کنند.

متن تزئین‌شده

ویجتی که متن را با تزئینات اختیاری مانند برچسب در بالا یا پایین متن، یک نماد در جلوی متن، یک ویجت انتخاب یا یک دکمه بعد از متن نمایش می‌دهد. برای مثال در برنامه‌های چت گوگل، به نمایش متن با متن تزئینی مراجعه کنید.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
icon
(deprecated)

Icon

به نفع startIcon منسوخ شده است.

startIcon

Icon

آیکونی که در جلوی متن نمایش داده می‌شود.

startIconVerticalAlignment

VerticalAlignment

اختیاری. تراز عمودی آیکون شروع. اگر تنظیم نشود، آیکون به صورت عمودی در مرکز قرار می‌گیرد.

برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

topLabel

string

متنی که بالای text ظاهر می‌شود. همیشه کوتاه می‌شود.

topLabelText

TextParagraph

معادل TextParagraph top_label . همیشه کوتاه می‌کند. امکان قالب‌بندی پیچیده‌تری نسبت به top_label را فراهم می‌کند.

برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

text

string

متن اصلی الزامی است.

از قالب‌بندی ساده پشتیبانی می‌کند. برای اطلاعات بیشتر در مورد قالب‌بندی متن، به افزونه‌های قالب‌بندی متن در برنامه‌های چت گوگل و قالب‌بندی متن در فضای کاری گوگل مراجعه کنید.

contentText

TextParagraph

معادل text در TextParagraph . امکان قالب‌بندی پیچیده‌تری نسبت به text را فراهم می‌کند.

برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

wrapText

bool

تنظیم متن پوششی. اگر true ، متن پوشش داده شده و در چند خط نمایش داده می‌شود. در غیر این صورت، متن کوتاه می‌شود.

فقط روی text اعمال می‌شود، نه روی topLabel و bottomLabel .

bottomLabel

string

متنی که زیر text ظاهر می‌شود. همیشه متن را می‌پوشاند.

bottomLabelText

TextParagraph

معادل TextParagraph bottom_label . همیشه در بر می‌گیرد. امکان قالب‌بندی پیچیده‌تری نسبت به bottom_label را فراهم می‌کند.

برای برنامه‌های Google Chat در دسترس است و برای افزونه‌های Google Workspace در دسترس نیست.

onClick

OnClick

این اکشن زمانی فعال می‌شود که کاربران روی topLabel یا bottomLabel کلیک کنند.

control فیلد Union. یک دکمه، سوئیچ، کادر انتخاب یا تصویری که در سمت راست متن در ویجت decoratedText ظاهر می‌شود. control می‌تواند فقط یکی از موارد زیر باشد:
button

Button

دکمه‌ای که کاربر می‌تواند با کلیک روی آن، عملی را انجام دهد.

switchControl

SwitchControl

یک ویجت سوئیچ که کاربر می‌تواند با کلیک روی آن، وضعیت آن را تغییر داده و عملی را انجام دهد.

endIcon

Icon

نمادی که بعد از متن نمایش داده می‌شود.

پشتیبانی از آیکون‌های پیش‌فرض و سفارشی

سوئیچ کنترل

یا یک سوئیچ به سبک toggle یا یک کادر انتخاب درون یک ویجت decoratedText .

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فقط در ویجت decoratedText پشتیبانی می‌شود.

فیلدها
name

string

نامی که ویجت سوئیچ در رویداد ورودی فرم با آن شناسایی می‌شود.

برای جزئیات بیشتر در مورد کار با ورودی‌های فرم، به بخش «دریافت داده‌های فرم» مراجعه کنید.

value

string

مقداری که توسط کاربر وارد شده و به عنوان بخشی از رویداد ورودی فرم برگردانده می‌شود.

برای جزئیات بیشتر در مورد کار با ورودی‌های فرم، به بخش «دریافت داده‌های فرم» مراجعه کنید.

selected

bool

وقتی true ، سوئیچ انتخاب شده است.

onChangeAction

Action

عملی که هنگام تغییر حالت سوئیچ باید انجام شود، مانند اینکه چه تابعی اجرا شود.

controlType

ControlType

نحوه نمایش سوئیچ در رابط کاربری.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

نوع کنترل

نحوه نمایش سوئیچ در رابط کاربری.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

انوم‌ها
SWITCH یک کلید به سبک تاگل.
CHECKBOX به نفع CHECK_BOX منسوخ شده است.
CHECK_BOX یک کادر انتخاب.

تقسیم کننده

این نوع هیچ فیلدی ندارد.

جداکننده‌ای بین ابزارک‌ها را به صورت یک خط افقی نمایش می‌دهد. برای مثال در برنامه‌های چت گوگل، به بخش «افزودن جداکننده افقی بین ابزارک‌ها» مراجعه کنید.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

برای مثال، JSON زیر یک جداکننده ایجاد می‌کند:

"divider": {}

پایان ناوبری

برای افزونه‌ها در گوگل چت ، یک کادر محاوره‌ای را می‌بندد.

فیلدها
action

Action

برای افزونه‌های موجود در گوگل چت ، عملی که یک کادر محاوره‌ای را می‌بندد.

برای افزونه‌های Google Workspace در دسترس است و برای برنامه‌های Google Chat در دسترس نیست.

اکشن

برای افزونه‌ها در گوگل چت ، اقداماتی برای بستن یک پنجره گفتگو .

انوم‌ها
ACTION_UNSPECIFIED اقدام مشخص نشده است.
CLOSE_DIALOG یک کادر محاوره‌ای را می‌بندد.
CLOSE_DIALOG_AND_EXECUTE یک کادر محاوره‌ای را می‌بندد و کارتی را که کادر محاوره‌ای را باز کرده است، به‌روزرسانی می‌کند.

دریافت پاسخ تکمیل خودکار

پاسخی برای دریافت ظرف تکمیل خودکار، که شامل عناصر لازم برای نمایش موارد تکمیل خودکار برای فیلد متنی است.

برای افزونه‌های Google Workspace موجود است و برای برنامه‌های Google Chat موجود نیست. برای مثال:

{
  "autoComplete": {
    "items": [
      {
        "text": "C++"
      },
      {
        "text": "Java"
      },
      {
        "text": "JavaScript"
      },
      {
        "text": "Python"
      }
    ]
  }
}
فیلدها
autoComplete

Suggestions

schema

string

این یک فیلد طرحواره بدون عملیات است که ممکن است در نشانه‌گذاری برای بررسی نحو وجود داشته باشد.

شبکه

یک شبکه با مجموعه‌ای از آیتم‌ها را نمایش می‌دهد. آیتم‌ها فقط می‌توانند شامل متن یا تصویر باشند. برای ستون‌های واکنش‌گرا یا برای افزودن بیش از متن یا تصویر، Columns استفاده کنید. برای مثال در برنامه‌های چت گوگل، به نمایش یک شبکه با مجموعه‌ای از آیتم‌ها مراجعه کنید.

یک شبکه می‌تواند از هر تعداد ستون و آیتم پشتیبانی کند. تعداد ردیف‌ها با تقسیم آیتم‌ها بر ستون‌ها تعیین می‌شود. یک شبکه با ۱۰ آیتم و ۲ ستون، ۵ ردیف دارد. یک شبکه با ۱۱ آیتم و ۲ ستون، ۶ ردیف دارد.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

برای مثال، JSON زیر یک جدول دو ستونی با یک آیتم ایجاد می‌کند:

"grid": {
  "title": "A fine collection of items",
  "columnCount": 2,
  "borderStyle": {
    "type": "STROKE",
    "cornerRadius": 4
  },
  "items": [
    {
      "image": {
        "imageUri": "https://www.example.com/image.png",
        "cropStyle": {
          "type": "SQUARE"
        },
        "borderStyle": {
          "type": "STROKE"
        }
      },
      "title": "An item",
      "textAlignment": "CENTER"
    }
  ],
  "onClick": {
    "openLink": {
      "url": "https://www.example.com"
    }
  }
}
فیلدها
title

string

متنی که در هدر شبکه نمایش داده می‌شود.

items[]

GridItem

مواردی که باید در شبکه نمایش داده شوند.

borderStyle

BorderStyle

سبک حاشیه‌ای که برای هر آیتم شبکه‌ای اعمال می‌شود.

columnCount

int32

تعداد ستون‌هایی که در جدول نمایش داده می‌شوند. اگر این فیلد مشخص نشده باشد، از مقدار پیش‌فرض استفاده می‌شود و آن مقدار پیش‌فرض بسته به محل نمایش جدول (کادر محاوره‌ای در مقابل کادر محاوره‌ای) متفاوت است.

onClick

OnClick

این تابع فراخوانی توسط هر آیتم شبکه به صورت جداگانه مورد استفاده مجدد قرار می‌گیرد، اما شناسه و اندیس آیتم در لیست آیتم‌ها به پارامترهای تابع فراخوانی اضافه می‌شود.

آیتم شبکه‌ای

یک آیتم را در یک طرح شبکه‌ای نشان می‌دهد. آیتم‌ها می‌توانند شامل متن، تصویر یا متن و تصویر باشند.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

فیلدها
id

string

یک شناسه‌ی مشخص‌شده توسط کاربر برای این آیتم شبکه. این شناسه در پارامترهای فراخوانی onClick شبکه‌ی والد بازگردانده می‌شود.

image

ImageComponent

تصویری که در آیتم شبکه‌ای نمایش داده می‌شود.

title

string

عنوان آیتم شبکه‌ای.

subtitle

string

زیرعنوان آیتم شبکه‌ای.

layout

GridItemLayout

طرح‌بندی مورد استفاده برای آیتم شبکه‌ای.

طرح‌بندی آیتم شبکه‌ای

گزینه‌های مختلف طرح‌بندی موجود برای یک آیتم شبکه‌ای را نشان می‌دهد.

برای برنامه‌های Google Chat و افزونه‌های Google Workspace موجود است.

انوم‌ها
GRID_ITEM_LAYOUT_UNSPECIFIED استفاده نکنید. نامشخص.
TEXT_BELOW عنوان و زیرعنوان در زیر تصویر آیتم شبکه‌ای نشان داده می‌شوند.
TEXT_ABOVE عنوان و زیرعنوان در بالای تصویر آیتم شبکه‌ای نشان داده می‌شوند.

آیکون

نمادی که در یک ابزارک روی کارت نمایش داده می‌شود. برای مثال در برنامه‌های چت گوگل، به افزودن یک نماد مراجعه کنید.

پشتیبانی از آیکون‌های پیش‌فرض و سفارشی

Available for Google Chat apps and Google Workspace add-ons.

Fields
altText

string

Optional. A description of the icon used for accessibility. If unspecified, the default value Button is provided. As a best practice, you should set a helpful description for what the icon displays, and if applicable, what it does. For example, A user's account portrait , or Opens a new browser tab and navigates to the Google Chat developer documentation at https://developers.google.com/workspace/chat .

If the icon is set in a Button , the altText appears as helper text when the user hovers over the button. However, if the button also sets text , the icon's altText is ignored.

imageType

ImageType

The crop style applied to the image. In some cases, applying a CIRCLE crop causes the image to be drawn larger than a built-in icon.

Union field icons . The icon displayed in the widget on the card. icons can be only one of the following:
knownIcon

string

Display one of the built-in icons provided by Google Workspace.

For example, to display an airplane icon, specify AIRPLANE . For a bus, specify BUS .

For a full list of supported icons, see built-in icons .

iconUrl

string

Display a custom icon hosted at an HTTPS URL.

برای مثال:

"iconUrl":
"https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png"

Supported file types include .png and .jpg .

materialIcon

MaterialIcon

Display one of the Google Material Icons .

For example, to display a checkbox icon , use

"materialIcon": {
  "name": "check_box"
}

Available for Google Chat apps and unavailable for Google Workspace add-ons.

تصویر

An image that is specified by a URL and can have an onClick action. For an example, see Add an image .

Available for Google Chat apps and Google Workspace add-ons.

Fields
imageUrl

string

The HTTPS URL that hosts the image.

برای مثال:

https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png
onClick

OnClick

When a user clicks the image, the click triggers this action.

altText

string

The alternative text of this image that's used for accessibility.

ImageComponent

Represents an image.

Available for Google Chat apps and Google Workspace add-ons.

Fields
imageUri

string

The image URL.

altText

string

The accessibility label for the image.

cropStyle

ImageCropStyle

The crop style to apply to the image.

borderStyle

BorderStyle

The border style to apply to the image.

ImageCropStyle

Represents the crop style applied to an image.

Available for Google Chat apps and Google Workspace add-ons.

For example, here's how to apply a 16:9 aspect ratio:

cropStyle {
 "type": "RECTANGLE_CUSTOM",
 "aspectRatio": 16/9
}
Fields
type

ImageCropType

The crop type.

aspectRatio

double

The aspect ratio to use if the crop type is RECTANGLE_CUSTOM .

For example, here's how to apply a 16:9 aspect ratio:

cropStyle {
 "type": "RECTANGLE_CUSTOM",
 "aspectRatio": 16/9
}

ImageCropType

Represents the crop style applied to an image.

Available for Google Chat apps and Google Workspace add-ons.

Enums
IMAGE_CROP_TYPE_UNSPECIFIED Don't use. Unspecified.
SQUARE Default value. Applies a square crop.
CIRCLE Applies a circular crop.
RECTANGLE_CUSTOM Applies a rectangular crop with a custom aspect ratio. Set the custom aspect ratio with aspectRatio .
RECTANGLE_4_3 Applies a rectangular crop with a 4:3 aspect ratio.

LinkPreview

Card action that previews a third-party link by displaying a card and smart chip. To learn more, see Preview links with smart chips .

Available for Google Workspace add-ons and unavailable for Google Chat apps.

For example, the following JSON returns a unique title for the link preview and its smart chip, and a preview card with a header and text description:

{
  "action": {
    "linkPreview": {
      "title": "Smart chip title",
      "linkPreviewTitle": "Link preview title",
      "previewCard": {
        "header": {
          "title": "Preview card header",
        },
        "sections": [
          {
            "widgets": [
              {
                "textParagraph": {
                  "text": "Description of the link."
                }
              }
            ]
          }
        ]
      }
    }
  }
}

The example returns the following link preview:

Example link preview

Fields
previewCard

Card

A card that displays information about a link from a third-party service.

title

string

The title that displays in the smart chip for the link preview. If unset, the smart chip displays the header of the previewCard .

linkPreviewTitle

string

The title that displays in the link preview. If unset, the link preview displays the header of the previewCard .

MaterialIcon

A Google Material Icon , which includes over 2500+ options.

For example, to display a checkbox icon with customized weight and grade, write the following:

{
  "name": "check_box",
  "fill": true,
  "weight": 300,
  "grade": -25
}

Available for Google Chat apps and unavailable for Google Workspace add-ons.

Fields
name

string

The icon name defined in the Google Material Icon , for example, check_box . Any invalid names are abandoned and replaced with empty string and results in the icon failing to render.

fill

bool

Whether the icon renders as filled. Default value is false.

To preview different icon settings, go to Google Font Icons and adjust the settings under Customize .

weight

int32

The stroke weight of the icon. Choose from {100, 200, 300, 400, 500, 600, 700}. If absent, default value is 400. If any other value is specified, the default value is used.

To preview different icon settings, go to Google Font Icons and adjust the settings under Customize .

grade

int32

Weight and grade affect a symbol's thickness. Adjustments to grade are more granular than adjustments to weight and have a small impact on the size of the symbol. Choose from {-25, 0, 200}. If absent, default value is 0. If any other value is specified, the default value is used.

To preview different icon settings, go to Google Font Icons and adjust the settings under Customize .

ModifyCard

For add-ons in Google Chat , updates a card based on a user interaction. The array must only contain a single object.

Fields

Union field operation .

operation can be only one of the following:

updateWidget

UpdateWidget

For add-ons in Google Chat , updates a widget in a card or dialog.

UpdateWidget

For add-ons in Google Chat , updates a widget in a card or dialog. It is used for providing auto-complete suggestions when user types in an input box. See Suggest multiselect items for more details.

Fields
Union field updated_widget . The updates to a widget. updated_widget can be only one of the following:
selectionInputWidgetSuggestions

SelectionInputWidgetSuggestions

For selectionInput widgets, an array of suggested items in a multiselect menu. When a multiselect menu uses an external data source to populate its items, the widget can dynamically populate suggestions based on what they type into the menu. For more information, see Collect information from Google Chat users .

SelectionInputWidgetSuggestions

For a selectionInput widget that uses a multiselect menu, returns selection items from an external dynamic data source.

Fields
suggestions[]

SelectionItem

An array of selectable items that appear to a user after they type into a multiselect menu.

Updates or navigates between cards in a card stack.

Available for Google Workspace add-ons and unavailable for Google Chat apps.

برای مثال:

1) Return a new card (Navigate forward).

 navigations : {
    pushCard : CARD
  }

2) Update the card on top of the stack (in place update).

  navigations : {
    popCard : true,
  }, {
    pushCard : CARD
  }

3) Go back one step without updating.

  navigations : {
    popCard : true,
  }

4) Go back multiple steps and update that card.

  navigations : {
    popCard : true,
  }, ... {
    pushCard : CARD
  }

5) Go back multiple steps to a defined CARD_NAME .

  navigations : {
    popToCardName : CARD_NAME,
  }, {
    pushCard : CARD
  }

6) Go back to the root and update that card.

  navigations : {
    popToRoot : true
  }, {
    pushCard : CARD
  }

7) Pop to the specified card and pop that one as well.

navigations : { popToCardName : CARD_NAME }, { popCard : true, }

8) Replace the top card with a new card.

  navigations : {
    updateCard : CARD
  }
Fields

Union field navigate_action .

navigate_action can be only one of the following:

popToRoot

bool

Pops all cards off except the root card.

pop

bool

Pops one card off.

popToCard

string

Pops all cards above the specified card with given card name.

pushCard

Card

Pushes a card onto the card stack.

For dialogs in Google Chat , opens or updates a dialog.

updateCard

Card

Updates the top card with a new card and preserves filled form fields values. For a non-equivalent field, the value is dropped.

For dialogs in Google Chat , opens or updates a dialog.

endNavigation

EndNavigation

For add-ons in Google Chat , closes a dialog .

اعلان

An action that displays a notification in the host Google Workspace application when a user interacts with a card.

For add-ons in Google Chat , displays a notification when users submit and close a dialog .

Available for Google Workspace add-ons and unavailable for Google Chat apps.

Fields
text

string

Plain text to display for the notification, without HTML tags.

OnClick

Represents how to respond when users click an interactive element on a card, such as a button.

Available for Google Chat apps and Google Workspace add-ons.

Fields

Union field data .

data can be only one of the following:

action

Action

If specified, an action is triggered by this onClick .

openDynamicLinkAction

Action

An add-on triggers this action when the action needs to open a link. This differs from the open_link above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.

Available for Google Workspace add-ons and unavailable for Google Chat apps.

card

Card

A new card is pushed to the card stack after clicking if specified.

Available for Google Workspace add-ons and unavailable for Google Chat apps.

overflowMenu

OverflowMenu

If specified, this onClick opens an overflow menu.

OnClose

What the client does when a link opened by an OnClick action is closed.

Implementation depends on client platform capabilities. For example, a web browser might open a link in a pop-up window with an OnClose handler.

If both OnOpen and OnClose handlers are set, and the client platform can't support both values, OnClose takes precedence.

Available for Google Workspace add-ons and unavailable for Google Chat apps.

Enums
NOTHING Default value. The card doesn't reload; nothing happens.
RELOAD

Reloads the card after the child window closes.

If used in conjunction with OpenAs.OVERLAY , the child window acts as a modal dialog and the parent card is blocked until the child window closes.

OpenAs

When an OnClick action opens a link, then the client can either open it as a full-size window (if that's the frame used by the client), or an overlay (such as a pop-up). The implementation depends on the client platform capabilities, and the value selected might be ignored if the client doesn't support it. FULL_SIZE is supported by all clients.

Available for Google Workspace add-ons and unavailable for Google Chat apps.

Enums
FULL_SIZE The link opens as a full-size window (if that's the frame used by the client).
OVERLAY The link opens as an overlay, such as a pop-up.

OverflowMenu

A widget that presents a pop-up menu with one or more actions that users can invoke. For example, showing non-primary actions in a card. You can use this widget when actions don't fit in the available space. To use, specify this widget in the OnClick action of widgets that support it. For example, in a Button .

Available for Google Chat apps and Google Workspace add-ons.

Fields
items[]

OverflowMenuItem

Required. The list of menu options.

OverflowMenuItem

An option that users can invoke in an overflow menu.

Available for Google Chat apps and Google Workspace add-ons.

Fields
startIcon

Icon

The icon displayed in front of the text.

text

string

Required. The text that identifies or describes the item to users.

onClick

OnClick

Required. The action invoked when a menu option is selected. This OnClick cannot contain an OverflowMenu , any specified OverflowMenu is dropped and the menu item disabled.

disabled

bool

Whether the menu option is disabled. Defaults to false.

RenderActions

A set of render instructions that tells a host application how to render a card or perform an action in response to a user interaction.

Available for Google Workspace add-ons and unavailable for Google Chat apps.

Fields
action

Action

The action that add-ons can use to update the UI.

Add-ons in Google Chat .

hostAppAction

HostAppActionMarkup

Actions handled by individual host apps.

schema

string

This is a no-op schema field that might be present in the markup for syntax checking.

اکشن

The actions that add-ons can use in cards or the host application.

Available for Google Workspace add-ons and unavailable for Google Chat apps.

Fields
navigations[]

Navigation

Pushes, pops, or updates a card.

Add-ons in Google Chat .

notification

Notification

Displays a notification in the host Google Workspace application when a user interacts with a card.

For add-ons in Google Chat , displays a notification when users submit and close a dialog .

linkPreview

LinkPreview

Available in Google Docs, Google Sheets, and Google Slides. Previews links with smart chips and card. For details, see Preview links with smart chips .

modifyOperations[]

ModifyCard

For add-ons in Google Chat , updates a card based on a user interaction. The array must only contain a single object.

SelectionInput

A widget that creates one or more UI items that users can select. Supports form submission validation for dropdown and multiselect menus only. When Action.all_widgets_are_required is set to true or this widget is specified in Action.required_widgets , the submission action is blocked unless a value is selected. For example, a dropdown menu or checkboxes. You can use this widget to collect data that can be predicted or enumerated. For an example in Google Chat apps, see Add selectable UI elements .

Chat apps can process the value of items that users select or input. For details about working with form inputs, see Receive form data .

To collect undefined or abstract data from users, use the TextInput widget.

Available for Google Chat apps and Google Workspace add-ons.

Fields
name

string

Required. The name that identifies the selection input in a form input event.

For details about working with form inputs, see Receive form data .

label

string

The text that appears above the selection input field in the user interface.

Specify text that helps the user enter the information your app needs. For example, if users are selecting the urgency of a work ticket from a drop-down menu, the label might be "Urgency" or "Select urgency".

type

SelectionType

The type of items that are displayed to users in a SelectionInput widget. Selection types support different types of interactions. For example, users can select one or more checkboxes, but they can only select one value from a dropdown menu.

items[]

SelectionItem

An array of selectable items. For example, an array of radio buttons or checkboxes. Supports up to 100 items.

onChangeAction

Action

If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button that submits the form.

For details about working with form inputs, see Receive form data .

multiSelectMaxSelectedItems

int32

For multiselect menus, the maximum number of items that a user can select. Minimum value is 1 item. If unspecified, defaults to 3 items.

multiSelectMinQueryLength

int32

For multiselect menus, the number of text characters that a user inputs before the menu returns suggested selection items.

If unset, the multiselect menu uses the following default values:

  • If the menu uses a static array of SelectionInput items, defaults to 0 characters and immediately populates items from the array.
  • If the menu uses a dynamic data source ( multi_select_data_source ), defaults to 3 characters before querying the data source to return suggested items.
hintText

string

Optional. Text that appears below the selection input field meant to assist users by prompting them to enter a certain value. This text is always visible.

Only supported by Google Workspace Workflows, but not Google Chat API or Google Workspace Add-ons.

Union field multi_select_data_source . For a multiselect menu, a data source that dynamically populates selection items.

Available for Google Chat apps and unavailable for Google Workspace add-ons. multi_select_data_source can be only one of the following:

externalDataSource

Action

An external data source, such as a relational database.

platformDataSource

PlatformDataSource

A data source from Google Workspace.

PlatformDataSource

For a SelectionInput widget that uses a multiselect menu, a data source from Google Workspace. Used to populate items in a multiselect menu.

Available for Google Chat apps and unavailable for Google Workspace add-ons.

Fields
Union field data_source . The data source. data_source can be only one of the following:
commonDataSource

CommonDataSource

A data source shared by all Google Workspace applications, such as users in a Google Workspace organization.

hostAppDataSource

HostAppDataSourceMarkup

A data source that's unique to a Google Workspace host application, such spaces in Google Chat.

This field supports the Google API Client Libraries but isn't available in the Cloud Client Libraries. To learn more, see Install the client libraries .

CommonDataSource

A data source shared by all Google Workspace applications .

Available for Google Chat apps and unavailable for Google Workspace add-ons.

Enums
UNKNOWN Default value. Don't use.
USER Google Workspace users. The user can only view and select users from their Google Workspace organization.

SelectionItem

An item that users can select in a selection input, such as a checkbox or switch. Supports up to 100 items.

Available for Google Chat apps and Google Workspace add-ons.

Fields
text

string

The text that identifies or describes the item to users.

value

string

The value associated with this item. The client should use this as a form input value.

For details about working with form inputs, see Receive form data .

selected

bool

Whether the item is selected by default. If the selection input only accepts one value (such as for radio buttons or a dropdown menu), only set this field for one item.

bottomText

string

For multiselect menus, a text description or label that's displayed below the item's text field.

Union field startIcon . For multiselect menus, the URL for the icon displayed next to the item's text field. Supports PNG and JPEG files. Must be an HTTPS URL. For example, https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png . startIcon can be only one of the following:
startIconUri

string

SelectionType

The format for the items that users can select. Different options support different types of interactions. For example, users can select multiple checkboxes, but can only select one item from a dropdown menu.

Each selection input supports one type of selection. Mixing checkboxes and switches, for example, isn't supported.

Available for Google Chat apps and Google Workspace add-ons.

Enums
CHECK_BOX A set of checkboxes. Users can select one or more checkboxes.
RADIO_BUTTON A set of radio buttons. Users can select one radio button.
SWITCH A set of switches. Users can turn on one or more switches.
DROPDOWN A dropdown menu. Users can select one item from the menu.
MULTI_SELECT

A menu with a text box. Users can type and select one or more items. For Google Workspace add-ons, you must populate items using a static array of SelectionItem objects.

For Google Chat apps, you can also populate items using a dynamic data source and autosuggest items as users type in the menu. For example, users can start typing the name of a Google Chat space and the widget autosuggests the space. To dynamically populate items for a multiselect menu, use one of the following types of data sources:

  • Google Workspace data: Items are populated using data from Google Workspace, such as Google Workspace users or Google Chat spaces.
  • External data: Items are populated from an external data source outside of Google Workspace.

For examples of how to implement multiselect menus for Chat apps, see Add a multiselect menu .

Available for Google Chat apps and Google Workspace add-ons.

SubmitFormResponse

A response to a form submit other than getting an autocomplete container, which contains the actions the card should perform and/or the add-on host app should perform, and whether the card's state has changed.

Available for Google Workspace add-ons and unavailable for Google Chat apps. For example:

{
  "renderActions": {
    "action": {
      "notification": {
        "text": "Email address is added: salam.heba@example.com"
      }
    },
    "hostAppAction": {
      "gmailAction": {
        "openCreatedDraftAction": {
          "draftId": "msg-a:r-79766936926021702",
          "threadServerPermId": "thread-f:15700999851086004"
        }
      }
    }
  }
}
Fields
renderActions

RenderActions

A set of render instructions that tells the card to perform an action and/or tells the add-on host app to perform an app-specific action.

stateChanged

bool

Whether the state of the cards has changed and data in existing cards is stale.

schema

string

This is a no-op schema field that may be present in the markup for syntax checking.

پیشنهادات

Suggested values that users can enter. These values appear when users click inside the text input field. As users type, the suggested values dynamically filter to match what the users have typed.

For example, a text input field for programming language might suggest Java, JavaScript, Python, and C++. When users start typing Jav , the list of suggestions filters to show Java and JavaScript .

Suggested values help guide users to enter values that your app can make sense of. When referring to JavaScript, some users might enter javascript and others java script . Suggesting JavaScript can standardize how users interact with your app.

When specified, TextInput.type is always SINGLE_LINE , even if it's set to MULTIPLE_LINE .

Available for Google Chat apps and Google Workspace add-ons.

Fields
items[]

SuggestionItem

A list of suggestions used for autocomplete recommendations in text input fields.

SuggestionItem

One suggested value that users can enter in a text input field.

Available for Google Chat apps and Google Workspace add-ons.

Fields

Union field content .

content can be only one of the following:

text

string

The value of a suggested input to a text input field. This is equivalent to what users enter themselves.

TextInput

A field in which users can enter text. Supports suggestions and on-change actions. Supports form submission validation. When Action.all_widgets_are_required is set to true or this widget is specified in Action.required_widgets , the submission action is blocked unless a value is entered. For an example in Google Chat apps, see Add a field in which a user can enter text .

Chat apps receive and can process the value of entered text during form input events. For details about working with form inputs, see Receive form data .

When you need to collect undefined or abstract data from users, use a text input. To collect defined or enumerated data from users, use the SelectionInput widget.

Available for Google Chat apps and Google Workspace add-ons.

Fields
name

string

The name by which the text input is identified in a form input event.

For details about working with form inputs, see Receive form data .

label

string

The text that appears above the text input field in the user interface.

Specify text that helps the user enter the information your app needs. For example, if you are asking someone's name, but specifically need their surname, write surname instead of name .

Required if hintText is unspecified. Otherwise, optional.

hintText

string

Text that appears below the text input field meant to assist users by prompting them to enter a certain value. This text is always visible.

Required if label is unspecified. Otherwise, optional.

value

string

The value entered by a user, returned as part of a form input event.

For details about working with form inputs, see Receive form data .

type

Type

How a text input field appears in the user interface. For example, whether the field is single or multi-line.

onChangeAction

Action

What to do when a change occurs in the text input field. For example, a user adding to the field or deleting text.

Examples of actions to take include running a custom function or opening a dialog in Google Chat.

initialSuggestions

Suggestions

Suggested values that users can enter. These values appear when users click inside the text input field. As users type, the suggested values dynamically filter to match what the users have typed.

For example, a text input field for programming language might suggest Java, JavaScript, Python, and C++. When users start typing Jav , the list of suggestions filters to show just Java and JavaScript .

Suggested values help guide users to enter values that your app can make sense of. When referring to JavaScript, some users might enter javascript and others java script . Suggesting JavaScript can standardize how users interact with your app.

When specified, TextInput.type is always SINGLE_LINE , even if it's set to MULTIPLE_LINE .

Available for Google Chat apps and Google Workspace add-ons.

autoCompleteAction

Action

Optional. Specify what action to take when the text input field provides suggestions to users who interact with it.

If unspecified, the suggestions are set by initialSuggestions and are processed by the client.

If specified, the app takes the action specified here, such as running a custom function.

Available for Google Workspace add-ons and unavailable for Google Chat apps.

validation

Validation

Specify the input format validation necessary for this text field.

Available for Google Chat apps and Google Workspace add-ons.

placeholderText

string

Text that appears in the text input field when the field is empty. Use this text to prompt users to enter a value. For example, Enter a number from 0 to 100 .

Available for Google Chat apps and unavailable for Google Workspace add-ons.

نوع

How a text input field appears in the user interface. For example, whether it's a single line input field, or a multi-line input. If initialSuggestions is specified, type is always SINGLE_LINE , even if it's set to MULTIPLE_LINE .

Available for Google Chat apps and Google Workspace add-ons.

Enums
SINGLE_LINE The text input field has a fixed height of one line.
MULTIPLE_LINE The text input field has a fixed height of multiple lines.

TextParagraph

A paragraph of text that supports formatting. For an example in Google Chat apps, see Add a paragraph of formatted text . For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace add-ons .

Available for Google Chat apps and Google Workspace add-ons.

Fields
text

string

The text that's shown in the widget.

maxLines

int32

The maximum number of lines of text that are displayed in the widget. If the text exceeds the specified maximum number of lines, the excess content is concealed behind a show more button. If the text is equal or shorter than the specified maximum number of lines, a show more button isn't displayed.

The default value is 0, in which case all context is displayed. Negative values are ignored.

textSyntax

TextSyntax

The syntax of the text. If not set, the text is rendered as HTML.

Available for Google Chat apps and unavailable for Google Workspace add-ons.

TextSyntax

Syntax to use for formatting text.

Available for Google Chat apps and unavailable for Google Workspace add-ons.

Enums
TEXT_SYNTAX_UNSPECIFIED The text is rendered as HTML if unspecified.
HTML The text is rendered as HTML. This is the default value.
MARKDOWN The text is rendered as Markdown.

اعتبارسنجی

Represents the necessary data for validating the widget it's attached to.

Available for Google Chat apps and Google Workspace add-ons.

Fields
characterLimit

int32

Specify the character limit for text input widgets. Note that this is only used for text input and is ignored for other widgets.

Available for Google Chat apps and Google Workspace add-ons.

inputType

InputType

Specify the type of the input widgets.

Available for Google Chat apps and Google Workspace add-ons.

InputType

The type of the input widget.

Enums
INPUT_TYPE_UNSPECIFIED Unspecified type. Do not use.
TEXT Regular text that accepts all characters.
INTEGER An integer value.
FLOAT A float value.
EMAIL An email address.
EMOJI_PICKER A emoji selected from system-provided emoji picker.

ویجت

Each card is made up of widgets.

A widget is a composite object that can represent one of text, images, buttons, and other object types.

Fields
horizontalAlignment

HorizontalAlignment

Specifies whether widgets align to the left, right, or center of a column.

Union field data . A widget can only have one of the following items. You can use multiple widget fields to display more items. data can be only one of the following:
textParagraph

TextParagraph

Displays a text paragraph. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace add-ons .

For example, the following JSON creates a bolded text:

"textParagraph": {
  "text": "  <b>bold text</b>"
}
image

Image

Displays an image.

For example, the following JSON creates an image with alternative text:

"image": {
  "imageUrl":
  "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png",
  "altText": "Chat app avatar"
}
decoratedText

DecoratedText

Displays a decorated text item.

For example, the following JSON creates a decorated text widget showing email address:

"decoratedText": {
  "icon": {
    "knownIcon": "EMAIL"
  },
  "topLabel": "Email Address",
  "text": "sasha@example.com",
  "bottomLabel": "This is a new Email address!",
  "switchControl": {
    "name": "has_send_welcome_email_to_sasha",
    "selected": false,
    "controlType": "CHECKBOX"
  }
}
buttonList

ButtonList

A list of buttons.

For example, the following JSON creates two buttons. The first is a blue text button and the second is an image button that opens a link:

"buttonList": {
  "buttons": [
    {
      "text": "Edit",
      "color": {
        "red": 0,
        "green": 0,
        "blue": 1,
      },
      "disabled": true,
    },
    {
      "icon": {
        "knownIcon": "INVITE",
        "altText": "check calendar"
      },
      "onClick": {
        "openLink": {
          "url": "https://example.com/calendar"
        }
      }
    }
  ]
}
textInput

TextInput

Displays a text box that users can type into.

For example, the following JSON creates a text input for an email address:

"textInput": {
  "name": "mailing_address",
  "label": "Mailing Address"
}

As another example, the following JSON creates a text input for a programming language with static suggestions:

"textInput": {
  "name": "preferred_programing_language",
  "label": "Preferred Language",
  "initialSuggestions": {
    "items": [
      {
        "text": "C++"
      },
      {
        "text": "Java"
      },
      {
        "text": "JavaScript"
      },
      {
        "text": "Python"
      }
    ]
  }
}
selectionInput

SelectionInput

Displays a selection control that lets users select items. Selection controls can be checkboxes, radio buttons, switches, or dropdown menus.

For example, the following JSON creates a dropdown menu that lets users choose a size:

"selectionInput": {
  "name": "size",
  "label": "Size"
  "type": "DROPDOWN",
  "items": [
    {
      "text": "S",
      "value": "small",
      "selected": false
    },
    {
      "text": "M",
      "value": "medium",
      "selected": true
    },
    {
      "text": "L",
      "value": "large",
      "selected": false
    },
    {
      "text": "XL",
      "value": "extra_large",
      "selected": false
    }
  ]
}
dateTimePicker

DateTimePicker

Displays a widget that lets users input a date, time, or date and time.

For example, the following JSON creates a date time picker to schedule an appointment:

"dateTimePicker": {
  "name": "appointment_time",
  "label": "Book your appointment at:",
  "type": "DATE_AND_TIME",
  "valueMsEpoch": 796435200000
}
divider

Divider

Displays a horizontal line divider between widgets.

For example, the following JSON creates a divider:

"divider": {
}
grid

Grid

Displays a grid with a collection of items.

A grid supports any number of columns and items. The number of rows is determined by the upper bounds of the number items divided by the number of columns. A grid with 10 items and 2 columns has 5 rows. A grid with 11 items and 2 columns has 6 rows.

Available for Google Chat apps and Google Workspace add-ons.

For example, the following JSON creates a 2 column grid with a single item:

"grid": {
  "title": "A fine collection of items",
  "columnCount": 2,
  "borderStyle": {
    "type": "STROKE",
    "cornerRadius": 4
  },
  "items": [
    {
      "image": {
        "imageUri": "https://www.example.com/image.png",
        "cropStyle": {
          "type": "SQUARE"
        },
        "borderStyle": {
          "type": "STROKE"
        }
      },
      "title": "An item",
      "textAlignment": "CENTER"
    }
  ],
  "onClick": {
    "openLink": {
      "url": "https://www.example.com"
    }
  }
}
columns

Columns

Displays up to 2 columns.

To include more than 2 columns, or to use rows, use the Grid widget.

For example, the following JSON creates 2 columns that each contain text paragraphs:

"columns": {
  "columnItems": [
    {
      "horizontalSizeStyle": "FILL_AVAILABLE_SPACE",
      "horizontalAlignment": "CENTER",
      "verticalAlignment": "CENTER",
      "widgets": [
        {
          "textParagraph": {
            "text": "First column text paragraph"
          }
        }
      ]
    },
    {
      "horizontalSizeStyle": "FILL_AVAILABLE_SPACE",
      "horizontalAlignment": "CENTER",
      "verticalAlignment": "CENTER",
      "widgets": [
        {
          "textParagraph": {
            "text": "Second column text paragraph"
          }
        }
      ]
    }
  ]
}
carousel

Carousel

A carousel contains a collection of nested widgets. For example, this is a JSON representation of a carousel that contains two text paragraphs.

{
  "widgets": [
    {
      "textParagraph": {
        "text": "First text paragraph in the carousel."
      }
    },
    {
      "textParagraph": {
        "text": "Second text paragraph in the carousel."
      }
    }
  ]
}
chipList

ChipList

A list of chips.

For example, the following JSON creates two chips. The first is a text chip and the second is an icon chip that opens a link:

"chipList": {
  "chips": [
    {
      "text": "Edit",
      "disabled": true,
    },
    {
      "icon": {
        "knownIcon": "INVITE",
        "altText": "check calendar"
      },
      "onClick": {
        "openLink": {
          "url": "https://example.com/calendar"
        }
      }
    }
  ]
}

HorizontalAlignment

Specifies whether widgets align to the left, right, or center of a column.

Available for Google Chat apps and unavailable for Google Workspace add-ons.

Enums
HORIZONTAL_ALIGNMENT_UNSPECIFIED Don't use. Unspecified.
START Default value. Aligns widgets to the start position of the column. For left-to-right layouts, aligns to the left. For right-to-left layouts, aligns to the right.
CENTER Aligns widgets to the center of the column.
END Aligns widgets to the end position of the column. For left-to-right layouts, aligns widgets to the right. For right-to-left layouts, aligns widgets to the left.

ImageType

The shape used to crop the image.

Available for Google Chat apps and Google Workspace add-ons.

Enums
SQUARE Default value. Applies a square mask to the image. For example, a 4x3 image becomes 3x3.
CIRCLE Applies a circular mask to the image. For example, a 4x3 image becomes a circle with a diameter of 3.

VerticalAlignment

Represents vertical alignment attribute.

Enums
VERTICAL_ALIGNMENT_UNSPECIFIED Unspecified type. Do not use.
TOP Alignment to the top position.
MIDDLE Alignment to the middle position.
BOTTOM Alignment to the bottom position.