การทำงานแบบคลิกเดียวช่วยให้ผู้ใช้ทำงานจากกล่องจดหมายได้โดยตรงโดยไม่ต้องออกจาก Gmail การดำเนินการแบบคลิกเดียวทำได้โดยการประกาศ HttpActionHandler
ด้วย URL ของบริการ โปรดดูรายละเอียดเพิ่มเติมที่การจัดการคำขอการดำเนินการ
การดำเนินการด้วยคลิกเดียวใน Gmail
กรณีการใช้งาน
ปัจจุบันการทำงานแบบคลิกเดียวใน Gmail มีดังนี้
ก่อนเริ่มต้นยืนยันการทำงาน
คุณสามารถเพิ่มปุ่มยืนยันแบบคลิกเดียวในอีเมลที่กำหนดให้ผู้ใช้อนุมัติ ยืนยัน และรับทราบบางอย่าง เมื่อผู้ใช้คลิกที่ปุ่ม จะมีการส่งคำขอ HTTP จาก Google ไปยังบริการของคุณ โดยจะบันทึกการยืนยันไว้ โต้ตอบกับ ConfirmAction
ได้ 1 ครั้งเท่านั้น
การประกาศต่อไปนี้จะเพิ่มปุ่ม 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>
Microdata
<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
ได้ 1 ครั้งเท่านั้น
การประกาศต่อไปนี้จะเพิ่มปุ่ม 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>
Microdata
<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 ที่เฉพาะเจาะจง