איך אוספים ומנהלים אנשי קשר ב-Google Chat

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

כך נראית אפליקציית Chat בפעולה:

  • טופס ליצירת קשר דרך פקודה דרך שורת הפקודות.
    איור 1. אפליקציית Chat מגיבה לפקודת הלוכס /about בהודעת טקסט ובלחצן שפותח טופס ליצירת קשר.
  • טופס ליצירת קשר בתיבת דו-שיח.
    איור 2. נפתחת תיבת דו-שיח באפליקציית Chat שבה המשתמשים יכולים להזין מידע על איש קשר.
  • תיבת דו-שיח לאישור ולבדיקה.
    איור 3. אפליקציית Chat מחזירה תיבת דו-שיח לאישור, כדי שהמשתמשים יוכלו לבדוק את המידע ולאשר אותו לפני השליחה.
  • הודעת טקסט לאישור איש הקשר החדש.
    איור 4. אחרי שהמשתמש שולח את הטופס, אפליקציית Chat שולחת הודעת טקסט פרטית כדי לאשר את השליחה.
  • טופס ליצירת קשר מהודעה בכרטיס.
    איור 5. האפליקציה Chat גם מציעה למשתמשים להוסיף איש קשר מכרטיס בהודעה.

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

מטרות

ארכיטקטורה

אפליקציית Chat מבוססת על Google Apps Script ומשתמשת באירועי אינטראקציה כדי לעבד את המידע של משתמשי Chat ולהשיב להם.

בדוגמה הבאה אפשר לראות איך משתמשים בדרך כלל מקיימים אינטראקציה עם אפליקציית Chat:

  1. משתמש פותח צ'אט ישיר עם אפליקציית Chat, או מוסיף את אפליקציית Chat למרחב קיים.

  2. אפליקציית Chat מציגה למשתמש טופס ליצירת קשר כדי להוסיף איש קשר, כשהטופס בנוי כcardאובייקט. כדי להציג את הטופס ליצירת קשר, אפליקציית Chat מגיבה למשתמשים בדרכים הבאות:

    • מגיב לאזכורי @ולהודעות בצ'אט ישיר עם הודעה בכרטיס שמכילה את טופס יצירת הקשר.
    • מגיב לפקודת הלוכסן /addContact על ידי פתיחת תיבת דו-שיח עם טופס יצירת הקשר.
    • מגיב לפקודת הלוכס /about בהודעת טקסט עם הכפתור הוספת איש קשר, שמשתמשים יכולים ללחוץ עליו כדי לפתוח תיבת דו-שיח עם טופס יצירת הקשר.
  3. כשמוצג למשתמש טופס ליצירת קשר, הוא מזין את הפרטים ליצירת קשר בשדות ובווידג'טים הבאים:

    • השם הפרטי ושם המשפחה: ווידג'ט textInput שמקבל מחרוזות.
    • תאריך לידה: ווידג'ט dateTimePicker שמקבל רק תאריכים.
    • סוג איש הקשר: ווידג'ט של לחצני בחירה שמאפשר למשתמשים לבחור ולהגיש ערך מחרוזת יחיד (Personal או Work). selectionInput
    • הלחצן בדיקה ושליחה: מערך buttonList עם ווידג'ט button שהמשתמש לוחץ עליו כדי לשלוח את הערכים שהוא מזין.
  4. אפליקציית Google Chat מטפלת בCARD_CLICKEDאירוע אינטראקציה כדי לעבד את הערכים שהמשתמש מזין, ומציגה את הערכים בכרטיס אישור.

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

  6. אפליקציית Google Chat שולחת הודעת טקסט פרטית שמאשרת את השליחה.

הכנת הסביבה

בקטע הזה מוסבר איך ליצור ולהגדיר פרויקט ב-Google Cloud לאפליקציית Chat.

יצירת פרויקט של Google Cloud

מסוף Google Cloud

  1. במסוף Google Cloud, עוברים אל תפריט > IAM & Admin > Create a Project (יצירת פרויקט).

    כניסה לדף Create a Project

  2. בשדה Project Name (שם הפרויקט), מזינים שם תיאורי לפרויקט.

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

  3. בשדה Location, לוחצים על Browse כדי להציג מיקומים אפשריים לפרויקט. אחר כך לוחצים על בחירה.
  4. לוחצים על יצירה. מערכת Google Cloud מעבירה אתכם לדף Dashboard והפרויקט נוצר תוך כמה דקות.

CLI של gcloud

באחת מסביבות הפיתוח הבאות, ניגשים אל Google Cloud CLI‏ (gcloud):

  • Cloud Shell: כדי להשתמש בטרמינל אונליין שבו כבר מוגדר ה-CLI של gcloud, צריך להפעיל את Cloud Shell.
    הפעלת Cloud Shell
  • מעטפת מקומית: כדי להשתמש בסביבת פיתוח מקומית צריך להתקין ולהפעיל את ה-CLI של gcloud.
    כדי ליצור פרויקט ב-Cloud, משתמשים בפקודה gcloud projects create:
    gcloud projects create PROJECT_ID
    מחליפים את PROJECT_ID במזהה של הפרויקט שרוצים ליצור.

הגדרת אימות והרשאה

כדי להשתמש באפליקציות ב-Google Chat, צריך להגדיר מסך הסכמה ל-OAuth כדי שהמשתמשים יוכלו לאשר את האפליקציה באפליקציות של Google Workspace, כולל Google Chat.

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

  1. במסוף Google Cloud, נכנסים לתפריט > > Branding.

    מעבר לדף 'מיתוג'

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

    1. בקטע App Information (פרטי האפליקציה), בשדה App name (שם האפליקציה), מקלידים Contact Manager.
    2. בקטע User support email (כתובת אימייל לתמיכה במשתמשים), בוחרים את כתובת האימייל או קבוצת Google המתאימה.
    3. לוחצים על הבא.
    4. בקטע קהל, בוחרים באפשרות פנימי. אם אי אפשר לבחור באפשרות פנימי, בוחרים באפשרות חיצוני.
    5. לוחצים על הבא.
    6. בקטע פרטים ליצירת קשר, מזינים כתובת אימייל שאליה אפשר לשלוח התראות על שינויים בפרויקט.
    7. לוחצים על הבא.
    8. בקטע סיום, קוראים את המדיניות של Google בנושא נתוני משתמשים בשירותי API. אם אתם מסכימים, מסמנים את התיבה אני מסכים/ה למדיניות של Google בנושא נתוני משתמשים בשירותי API.
    9. לוחצים על המשך.
    10. לוחצים על יצירה.
    11. אם בחרתם באפשרות חיצוני לסוג המשתמש, מוסיפים משתמשי בדיקה:
      1. לוחצים על קהל.
      2. בקטע משתמשי בדיקה, לוחצים על הוספת משתמשים.
      3. מזינים את כתובת האימייל שלכם ושל משתמשים מורשים אחרים לבדיקה, ואז לוחצים על שמירה.

יצירה ופריסה של אפליקציה ל-Chat

בקטע הבא, מעתיקים ומעדכנים פרויקט שלם בסקריפט של Google Apps שמכיל את כל קוד האפליקציה הנדרש לאפליקציית Chat, כך שאין צורך להעתיק ולהדביק כל קובץ בנפרד.

אם רוצים, אפשר לראות את הפרויקט כולו ב-GitHub.

הצגת הקוד ב-GitHub

סקירה כללית של כל קובץ:

main.gs

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

הצגת הקוד main.gs

apps-script/contact-form-app/main.gs
/**
 * Copyright 2024 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Responds to a MESSAGE interaction event in Google Chat.
 *
 * @param {Object} event the MESSAGE interaction event from Chat API.
 * @return {Object} message response that opens a dialog or sends private
 *                          message with text and card.
 */
function onMessage(event) {
  if (event.message.slashCommand) {
    switch (event.message.slashCommand.commandId) {
      case 1:
        // If the slash command is "/about", responds with a text message and button
        // that opens a dialog.
        return {
          text: "Manage your personal and business contacts 📇. To add a " +
                  "contact, use the slash command `/addContact`.",
          accessoryWidgets: [{
            buttonList: { buttons: [{
              text: "Add Contact",
              onClick: { action: {
                function: "openInitialDialog",
                interaction: "OPEN_DIALOG"
              }}
            }]}
          }]
        }
      case 2:
        // If the slash command is "/addContact", opens a dialog.
        return openInitialDialog();
    }
  }

  // If user sends the Chat app a message without a slash command, the app responds
  // privately with a text and card to add a contact.
  return {
    privateMessageViewer: event.user,
    text: "To add a contact, try `/addContact` or complete the form below:",
    cardsV2: [{
      cardId: "addContactForm",
      card: {
        header: { title: "Add a contact" },
        sections:[{ widgets: CONTACT_FORM_WIDGETS.concat([{
          buttonList: { buttons: [{
            text: "Review and submit",
            onClick: { action: { function : "openConfirmation" }}
          }]}
        }])}]
      }
    }]
  };
}

/**
 * Responds to CARD_CLICKED interaction events in Google Chat.
 *
 * @param {Object} event the CARD_CLICKED interaction event from Google Chat.
 * @return {Object} message responses specific to the dialog handling.
 */
function onCardClick(event) {
  // Initial dialog form page
  if (event.common.invokedFunction === "openInitialDialog") {
    return openInitialDialog();
  // Confirmation dialog form page
  } else if (event.common.invokedFunction === "openConfirmation") {
    return openConfirmation(event);
  // Submission dialog form page
  } else if (event.common.invokedFunction === "submitForm") {
    return submitForm(event);
  }
}

/**
 * Opens the initial step of the dialog that lets users add contact details.
 *
 * @return {Object} a message with an action response to open a dialog.
 */
function openInitialDialog() {
  return { actionResponse: {
    type: "DIALOG",
    dialogAction: { dialog: { body: { sections: [{
      header: "Add new contact",
      widgets: CONTACT_FORM_WIDGETS.concat([{
        buttonList: { buttons: [{
          text: "Review and submit",
          onClick: { action: { function: "openConfirmation" }}
        }]}
      }])
    }]}}}
  }};
}

/**
 * Returns the second step as a dialog or card message that lets users confirm details.
 *
 * @param {Object} event the interactive event with form inputs.
 * @return {Object} returns a dialog or private card message.
 */
function openConfirmation(event) {
  const name = fetchFormValue(event, "contactName") ?? "";
  const birthdate = fetchFormValue(event, "contactBirthdate") ?? "";
  const type = fetchFormValue(event, "contactType") ?? "";
  const cardConfirmation = {
    header: "Your contact",
    widgets: [{
      textParagraph: { text: "Confirm contact information and submit:" }}, {
      textParagraph: { text: "<b>Name:</b> " + name }}, {
      textParagraph: {
        text: "<b>Birthday:</b> " + convertMillisToDateString(birthdate)
      }}, {
      textParagraph: { text: "<b>Type:</b> " + type }}, {
      buttonList: { buttons: [{
        text: "Submit",
        onClick: { action: {
          function: "submitForm",
          parameters: [{
            key: "contactName", value: name }, {
            key: "contactBirthdate", value: birthdate }, {
            key: "contactType", value: type
          }]
        }}
      }]}
    }]
  };

  // Returns a dialog with contact information that the user input.
  if (event.isDialogEvent) {
    return { action_response: {
      type: "DIALOG",
      dialogAction: { dialog: { body: { sections: [ cardConfirmation ]}}}
    }};
  }

  // Updates existing card message with contact information that the user input.
  return {
    actionResponse: { type: "UPDATE_MESSAGE" },
    privateMessageViewer: event.user,
    cardsV2: [{
      card: { sections: [cardConfirmation]}
    }]
  }
}

/**
  * Validates and submits information from a dialog or card message
  * and notifies status.
  *
  * @param {Object} event the interactive event with parameters.
  * @return {Object} a message response that opens a dialog or posts a private
  *                  message.
  */
function submitForm(event) {
  const contactName = event.common.parameters["contactName"];
  // Checks to make sure the user entered a contact name.
  // If no name value detected, returns an error message.
  const errorMessage = "Don't forget to name your new contact!";
  if (!contactName && event.dialogEventType === "SUBMIT_DIALOG") {
    return { actionResponse: {
      type: "DIALOG",
      dialogAction: { actionStatus: {
        statusCode: "INVALID_ARGUMENT",
        userFacingMessage: errorMessage
      }}
    }};
  }
  if (!contactName) {
    return {
      privateMessageViewer: event.user,
      text: errorMessage
    };
  }

  // The Chat app indicates that it received form data from the dialog or card.
  // Sends private text message that confirms submission.
  const confirmationMessage = "✅ " + contactName + " has been added to your contacts.";
  if (event.dialogEventType === "SUBMIT_DIALOG") {
    return {
      actionResponse: {
        type: "DIALOG",
        dialogAction: { actionStatus: {
          statusCode: "OK",
          userFacingMessage: "Success " + contactName
        }}
      }
    };
  }
  return {
    actionResponse: { type: "NEW_MESSAGE" },
    privateMessageViewer: event.user,
    text: confirmationMessage
  };
}

/**
 * Extracts form input value for a given widget.
 *
 * @param {Object} event the CARD_CLICKED interaction event from Google Chat.
 * @param {String} widgetName a unique ID for the widget, specified in the widget's name field.
 * @returns the value inputted by the user, null if no value can be found.
 */
function fetchFormValue(event, widgetName) {
  const formItem = event.common.formInputs[widgetName][""];
  // For widgets that receive StringInputs data, the value input by the user.
  if (formItem.hasOwnProperty("stringInputs")) {
    const stringInput = event.common.formInputs[widgetName][""].stringInputs.value[0];
    if (stringInput != null) {
      return stringInput;
    }
  // For widgets that receive dateInput data, the value input by the user.
  } else if (formItem.hasOwnProperty("dateInput")) {
    const dateInput = event.common.formInputs[widgetName][""].dateInput.msSinceEpoch;
     if (dateInput != null) {
       return dateInput;
     }
  }

  return null;
}

/**
 * Converts date in milliseconds since epoch to user-friendly string.
 *
 * @param {Object} millis the milliseconds since epoch time.
 * @return {string} Display-friend date (English US).
 */
function convertMillisToDateString(millis) {
  const date = new Date(millis);
  const options = { year: 'numeric', month: 'long', day: 'numeric' };
  return date.toLocaleDateString('en-US', options);
}
contactForm.gs

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

הצגת הקוד contactForm.gs

apps-script/contact-form-app/contactForm.gs
/**
 * Copyright 2024 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * The section of the contact card that contains the form input widgets. Used in a dialog and card message.
 * To add and preview widgets, use the Card Builder: https://addons.gsuite.google.com/uikit/builder
 */
const CONTACT_FORM_WIDGETS = [
  {
    "textInput": {
      "name": "contactName",
      "label": "First and last name",
      "type": "SINGLE_LINE"
    }
  },
  {
    "dateTimePicker": {
      "name": "contactBirthdate",
      "label": "Birthdate",
      "type": "DATE_ONLY"
    }
  },
  {
    "selectionInput": {
      "name": "contactType",
      "label": "Contact type",
      "type": "RADIO_BUTTON",
      "items": [
        {
          "text": "Work",
          "value": "Work",
          "selected": false
        },
        {
          "text": "Personal",
          "value": "Personal",
          "selected": false
        }
      ]
    }
  }
];
appsscript.json

מניפסט של Apps Script שמגדיר ומגדיר את פרויקט Apps Script עבור אפליקציית Chat.

הצגת הקוד appsscript.json

apps-script/contact-form-app/appsscript.json
{
  "timeZone": "America/Los_Angeles",
  "dependencies": {},
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "chat": {}
}

איך מוצאים את מספר הפרויקט ואת מזהה הפרויקט ב-Cloud

  1. במסוף Google Cloud, נכנסים לפרויקט ב-Cloud.

    כניסה למסוף Google Cloud

  2. לוחצים על סמל ההגדרות והכלים > הגדרות הפרויקט.

  3. שימו לב לערכים בשדות מספר הפרויקט ומזהה הפרויקט. משתמשים בהם בקטעים הבאים.

יצירת פרויקט Apps Script

כדי ליצור פרויקט Apps Script ולקשר אותו לפרויקט Cloud:

  1. לוחצים על הלחצן הבא כדי לפתוח את פרויקט Apps Script‏ Manage contacts in Google Chat (ניהול אנשי קשר ב-Google Chat).
    פתיחת הפרויקט
  2. לוחצים על סקירה כללית.
  3. בדף הסקירה הכללית, לוחצים על הסמל ליצירת עותק יצירת עותק.
  4. נותנים שם לעותק של פרויקט Apps Script:

    1. לוחצים על עותק של ניהול אנשי קשר ב-Google Chat.

    2. בשדה שם הפרויקט, כותבים Contact Manager - Google Chat app.

    3. לוחצים על Rename.

הגדרת פרויקט Cloud לפרויקט Apps Script

  1. בפרויקט Apps Script, לוחצים על הסמל של הגדרות הפרויקט הגדרות הפרויקט.
  2. בקטע פרויקט Google Cloud Platform (GCP)‎, לוחצים על שינוי הפרויקט.
  3. בקטע מספר הפרויקט ב-GCP, מדביקים את מספר הפרויקט ב-Cloud.
  4. לוחצים על הגדרת פרויקט. הפרויקט ב-Cloud והפרויקט ב-Apps Script מקושרים עכשיו.

יצירת פריסה של Apps Script

אחרי שכל הקוד מוכן, פורסים את פרויקט Apps Script. משתמשים במזהה הפריסה כשמגדירים את אפליקציית Chat ב-Google Cloud.

  1. ב-Apps Script, פותחים את הפרויקט של אפליקציית Chat.

    מעבר אל Apps Script

  2. לוחצים על פריסה > פריסה חדשה.

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

  4. בשדה תיאור, מזינים תיאור לגרסה הזו, כמו Test of Contact Manager.

  5. לוחצים על פריסה. ‫Apps Script מדווח על פריסה מוצלחת ומספק מזהה פריסה.

  6. לוחצים על העתקה כדי להעתיק את מזהה הפריסה ואז לוחצים על סיום.

הגדרת אפליקציית Chat במסוף Google Cloud

בקטע הזה נסביר איך להגדיר את Google Chat API במסוף Google Cloud עם מידע על אפליקציית Chat, כולל מזהה הפריסה שיצרתם זה עתה מפרויקט Apps Script.

  1. במסוף Google Cloud, לוחצים על תפריט > מוצרים נוספים > Google Workspace > ספריית מוצרים > Google Chat API > ניהול > הגדרה.

    כניסה להגדרות של Chat API

  2. בשדה App name, כותבים Contact Manager.

  3. בקטע כתובת ה-URL של הדמות, מקלידים https://developers.google.com/chat/images/contact-icon.png.

  4. בקטע תיאור, מקלידים Manage your personal and business contacts.

  5. מעבירים את המתג הפעלה של תכונות אינטראקטיביות למצב פעיל.

  6. בקטע פונקציונליות, בוחרים באפשרות הצטרפות למרחבים ולשיחות קבוצתיות.

  7. בקטע הגדרות חיבור, בוחרים באפשרות Apps Script.

  8. בקטע Deployment ID (מזהה פריסה), מדביקים את מזהה הפריסה של Apps Script שהועתק בקטע הקודם כשיוצרים את פריסת Apps Script.

  9. בקטע Commands (פקודות), מגדירים את הפקודות דרך שורת הפקודות /about ו-/addContact:

    1. לוחצים על הוספת פקודה דרך שורת הפקודות כדי להגדיר את הפקודה הראשונה דרך שורת הפקודות.
    2. בשדה Name, כותבים About.
    3. בשדה Command ID (מזהה הפקודה), מקלידים 1.
    4. בקטע תיאור, מקלידים Learn how to use this Chat app to manage your contacts.
    5. בקטע סוג הפקודה, בוחרים באפשרות Slash command.
    6. בשדה Slash command name, כותבים /about.
    7. בוחרים באפשרות הקישור פותח תיבת דו-שיח.
    8. לוחצים על סיום.
    9. כדי להגדיר עוד פקודה דרך שורת הפקודות, לוחצים על הוספת פקודה.
    10. בשדה Name, כותבים Add a contact.
    11. בשדה Command ID (מזהה הפקודה), מקלידים 2.
    12. בקטע תיאור, מקלידים Submit information about a contact.
    13. בקטע סוג הפקודה, בוחרים באפשרות Slash command.
    14. בשדה Slash command name, כותבים /addContact.
    15. בוחרים באפשרות הקישור פותח תיבת דו-שיח.
    16. לוחצים על סיום.
  10. בקטע חשיפה, מסמנים את התיבה הפיכת אפליקציית Chat הזו לזמינה לאנשים ולקבוצות ספציפיים ב-YOUR DOMAIN ומזינים את כתובת האימייל.

  11. בקטע יומנים, בוחרים באפשרות רישום שגיאות ביומן.

  12. לוחצים על שמירה. תוצג הודעה שההגדרה נשמרה.

אפשר להתקין את האפליקציה של Chat ולבדוק אותה ב-Chat.

בדיקת אפליקציית Chat

כדי לבדוק את אפליקציית Chat, פותחים מרחב לצ'אט ישיר עם אפליקציית Chat ושולחים הודעה:

  1. פותחים את Google Chat באמצעות חשבון Google Workspace שציינתם כשנוספתם כבודקים מהימנים.

    מעבר אל Google Chat

  2. לוחצים על צ'אט חדש.
  3. בשדה הוספת אדם אחד או יותר, מקלידים את השם של אפליקציית Chat.
  4. בוחרים את אפליקציית Chat מתוך התוצאות. ייפתח צ'אט ישיר.

  1. בצ'אט ישיר חדש עם אפליקציית Chat, כותבים /addContact ומקישים על Enter.

  2. בתיבת הדו-שיח שנפתחת, מזינים את הפרטים ליצירת קשר:

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

  4. בתיבת הדו-שיח לאישור, בודקים את המידע ששלחתם ולוחצים על שליחה. אפליקציית Chat עונה בהודעת טקסט עם הכיתוב CONTACT NAME has been added to your contacts..

  5. אפשר גם לבדוק ולשלוח את טופס יצירת הקשר בדרכים הבאות:

    • משתמשים בפקודת הסלאש /about. התשובה של אפליקציית הצ'אט היא הודעת טקסט עם לחצן של ווידג'ט אביזר שכתוב עליו Add a contact. אפשר ללחוץ על הלחצן כדי לפתוח תיבת דו-שיח עם טופס יצירת הקשר.
    • שולחים לאפליקציית Chat הודעה בצ'אט ישיר בלי להשתמש בפקודת לוכסן, כמו Hello. אפליקציית Chat תשיב עם טקסט וכרטיס שמכילים את הטופס ליצירת קשר.

הסרת המשאבים

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

  1. במסוף Google Cloud, עוברים לדף Manage resources. לוחצים על תפריט > IAM & Admin > Manage Resources.

    כניסה ל-Resource Manager

  2. ברשימת הפרויקטים, בוחרים את הפרויקט שרוצים למחוק ולוחצים על Delete .
  3. כדי למחוק את הפרויקט, כותבים את מזהה הפרויקט בתיבת הדו-שיח ולוחצים על Shut down.