פעולות בלחיצה אחת

פעולות בלחיצה אחת מאפשרות למשתמשים לבצע פעולות ישירות מתיבת הדואר הנכנס בלי לצאת מ-Gmail. כדי לבצע פעולות בלחיצה אחת, צריך להצהיר על HttpActionHandler עם כתובת ה-URL של השירות. פרטים נוספים זמינים במאמר בנושא טיפול בבקשות לפעולה.

כפתור אישור ב-Gmail
פעולות בלחיצה אחת ב-Gmail.

תרחישים לדוגמה

הפעולות בלחיצה אחת שנתמכות כרגע ב-Gmail הן:

אישור הפעולה

אפשר להוסיף לאימיילים לחצן לאישור בלחיצה אחת, כדי שהמשתמשים יוכלו לאשר, לאמת או לאשר קבלה של משהו. כשהמשתמש ילחץ על הלחצן, תונפק בקשת HTTP מ-Google לשירות שלכם, והאישור יתועד. אפשר ליצור אינטראקציה עם ConfirmAction רק פעם אחת.

ההצהרה הבאה מוסיפה לחצן ConfirmAction לאימייל בנושא דוח הוצאות:

JSON-LD

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "potentialAction": {
    "@type": "ConfirmAction",
    "name": "Approve Expense",
    "handler": {
      "@type": "HttpActionHandler",
      "url": "https://myexpenses.com/approve?expenseId=abc123"
    }
  },
  "description": "Approval request for John's $10.13 expense for office supplies"
}
</script>

מיקרו נתונים

<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="potentialAction" itemscope itemtype="http://schema.org/ConfirmAction">
    <meta itemprop="name" content="Approve Expense"/>
    <div itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
      <link itemprop="url" href="https://myexpenses.com/approve?expenseId=abc123"/>
    </div>
  </div>
  <meta itemprop="description" content="Approval request for John's $10.13 expense for office supplies"/>
</div>

שמירת הפעולה

אפשר להשתמש ב-SaveAction כדי לתאר אינטראקציות כמו שמירת שובר או הוספת שירים לתור ההשמעה. אפשר ליצור אינטראקציה עם SaveAction רק פעם אחת.

ההצהרה הבאה מוסיפה כפתור SaveAction לאימייל בנוגע למבצע:

JSON-LD

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "potentialAction": {
    "@type": "SaveAction",
    "name": "Save Offer",
    "handler": {
      "@type": "HttpActionHandler",
      "url": "https://offers-everywhere.com/save?offerId=xyz789"
    }
  },
  "description": "$5 meal at Joe's Diner"
}
</script>

מיקרו נתונים

<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="potentialAction" itemscope itemtype="http://schema.org/SaveAction">
    <meta itemprop="name" content="Save Offer"/>
    <div itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
      <link itemprop="url" href="https://offers-everywhere.com/save?offerId=xyz789"/>
    </div>
  </div>
  <meta itemprop="description" content="$5 meal at Joe's Diner"/>
</div>

בדיקת תגי העיצוב

כדי לאמת את תגי העיצוב, אפשר להשתמש בכלי לבדיקת סימון אימיילים. מדביקים את קוד התיוג ולוחצים על הלחצן אימות כדי לסרוק את התוכן ולקבל דוח על שגיאות שקיימות בו.

מפרט

למידע על המאפיינים שזמינים לפעולות האלה, אפשר לעיין במסמכי התיעוד של הסוגים הספציפיים ConfirmAction ו-SaveAction.