הגדרת הזמינות להעברת הודעות

כדי שהמשתמשים יוכלו להתחיל שיחות עם הנציג, צריך להגדיר את זמינות הנציג לשליחת הודעות ב-Business Messages.

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

זמינות של בוטים ואנשים

אפשר לציין זמינות נפרדת של בוטים ושל נציגים אנושיים.

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

אם רוצים להפעיל סוכן בנקודות כניסה שמנוהלות על ידי Google, כולל נקודות כניסה שמבוססות על מיקום ונקודות כניסה לא מקומיות (למעט Google Ads), חובה להגדיר זמינות של נציג אנושי. כדי לציין את הזמינות של נציג אנושי, צריך לציין רק את הימים בשבוע והשעות שבהן יש נציגים אנושיים שיכולים לענות על שאלות.

אם נציגי בוט זמינים 24 שעות ביממה, אבל נציגים אנושיים זמינים מ-8:00 עד 20:00, אתם יכולים לציין את שעות הפעילות של כל אחד מהם בנפרד.

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

עדכון הזמינות של הצ'אט

כדי לעדכן את הזמינות של הצ'אט, שולחים בקשת PATCH באמצעות Business Communications API כדי לעדכן את השדות primaryAgentInteraction ו-additionalAgentInteractions של הסוכן.

כשמעדכנים את השדות האלה, צריך לכלול ערכים לכל השדות באובייקט SupportedAgentInteraction. בקשות עדכון מחליפות את התוכן של כל השדות שאתם עורכים, כולל שדות צאצא. לדוגמה, אם אתם שולחים בקשה להוספת מופע ל-hours, אתם צריכים לכלול גם את כל המופעים הקודמים של hours, אחרת העדכון ידרוס אותם.

דרישות מוקדמות

לפני שמעדכנים את זמינות הצ'אט, צריך לוודא שיש לכם את הפריטים הבאים:

  • הנתיב למפתח של חשבון השירות בפרויקט GCP במכונת הפיתוח
  • הסוכן name (לדוגמה, brands/12345/agents/67890)

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

  • אזורי זמן, ימים בשבוע ושעות שבהם הבוט זמין

  • אזורי זמן, ימים בשבוע ושעות שבהם יש נציג אנושי

אם אתם לא יודעים מהם הערכים הנוכחיים של primaryAgentInteraction ושל additionalAgentInteractions, תוכלו להיעזר במאמר קבלת פרטי נציג.

שליחת הבקשה לעדכון

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

אם יש לכם זמינות של בוטים ושל נציגים אנושיים, אתם צריכים לציין את הזמינות של הבוטים ב-primaryAgentInteraction ואת הזמינות של הנציגים האנושיים במופע של additionalAgentInteractions.

בוט ואדם

# This code updates the agent interaction of a bot and human representatives.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch

# Replace the __BRAND_ID__ and __AGENT_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__?updateMask=businessMessagesAgent.primaryAgentInteraction,businessMessagesAgent.additionalAgentInteractions" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "businessMessagesAgent": {
    "primaryAgentInteraction": {
      "interactionType": "BOT",
      "botRepresentative": {
        "botMessagingAvailability": {
          "hours": [
            {
              "startTime": {
                "hours": 20,
                "minutes": 0
              },
              "endTime": {
                "hours": 8,
                "minutes": 0
              },
              "timeZone": "America/Los_Angeles",
              "startDay": "MONDAY",
              "endDay": "SUNDAY"
            }
          ]
        }
      }
    },
    "additionalAgentInteractions": [
      {
        "interactionType": "HUMAN",
        "humanRepresentative": {
          "humanMessagingAvailability": {
            "hours": [
              {
                "startTime": {
                  "hours": 8,
                  "minutes": 0
                },
                "endTime": {
                  "hours": 20,
                  "minutes": 0
                },
                "timeZone": "America/Los_Angeles",
                "startDay": "MONDAY",
                "endDay": "SUNDAY"
              }
            ]
          }
        }
      }
    ]
  }
}'

בוט בלבד

# This code updates the primary agent interaction of a bot representative
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch

# Replace the __BRAND_ID__ and __AGENT_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__?updateMask=businessMessagesAgent.primaryAgentInteraction" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "businessMessagesAgent": {
    "primaryAgentInteraction": {
      "interactionType": "BOT",
      "botRepresentative": {
        "botMessagingAvailability": {
          "hours": [
            {
              "startTime": {
                "hours": 20,
                "minutes": 0
              },
              "endTime": {
                "hours": 8,
                "minutes": 0
              },
              "timeZone": "America/Los_Angeles",
              "startDay": "MONDAY",
              "endDay": "SUNDAY"
            }
          ]
        }
      }
    }
  }
}'

אנושי בלבד

# This code updates the primary agent interaction of a human representative
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch

# Replace the __BRAND_ID__ and __AGENT_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__?updateMask=businessMessagesAgent.primaryAgentInteraction" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "businessMessagesAgent": {
    "primaryAgentInteraction": {
      "interactionType": "HUMAN",
      "humanRepresentative": {
        "humanMessagingAvailability": {
          "hours": [
            {
              "startTime": {
                "hours": 20,
                "minutes": 0
              },
              "endTime": {
                "hours": 8,
                "minutes": 0
              },
              "timeZone": "America/Los_Angeles",
              "startDay": "MONDAY",
              "endDay": "SUNDAY"
            }
          ]
        }
      }
    }
  }
}'

אפשרויות העיצוב והערכים מפורטות במאמרים בנושא brands.agents.patch וSupportedAgentInteraction.