התחלת השיחה

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

הנציג שולח הודעת פתיחה בכל פעם שהמשתמש פותח שיחה. נציג יכול גם להציג מתחילים שיחה כדי להוביל משתמשים בנתיבים ידועים או נפוצים.

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

רעיונות לפתיחת שיחה

הגדרות ברמת הנציג וברמת המיקום

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

  • רמת הנציג: הגדרות השיחה האלה חלות על כל השיחות עם לכל נקודות הכניסה.

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

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

    הודעת פתיחה ברמת המיקום עשויה להתחיל בכיתוב 'תודה שפנית אלינו קבוצת Bridgepoint Runners ב- Amphitheatre Pkwy..." רעיונות למשפטי פתיחה יכולים להתמקד לפי משימות או נתונים מבוססי-מיקום. הודעה אופליין עשויה לכלול אזכור של המועד שבו המיקום ייפתח בפעם הבאה.

לוקאלים

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

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

מערכת Business Messages משתמשת בלוקאל של ההודעה שטופלה כדי לקבוע את סוג השיחה ההגדרות שיחולו.

הודעת פתיחה

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

רעיונות לפתיחת שיחה

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

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

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

נציג יכול להכיל עד 5 רעיונות לפתיחת שיחה, וכל סימן לתחילת פעולה יכול הם יכולים לכלול 35 תווים לכל היותר.

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

הודעות אופליין

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

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

הודעה אופליין גרועה

"מצטערים, אנחנו סגורים".

הודעה טובה במצב אופליין

"אנחנו סגורים עכשיו, אבל נהיה זמינים שוב מחר בשעה 8:00". אם המיקום דרושה לך עזרה דחופה, אפשר לפנות לתמיכה במספר +12223334444 או בכתובת support@gtb.com."

כדי לערוך הודעות במצב אופליין כדאי לעיין במאמר עדכון הגדרות שיחה.

עדכון הגדרות השיחה

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

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

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

כדי לעדכן את הגדרות השיחה, צריך את הדברים הבאים:

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

    לא יודעים מה name של הנציג? אפשר להיעזר במאמר רשימת כל הנציגים של מותג.

  • להגדרות ברמת המיקום, המיקום name (לדוגמה, "brands/12345/locations/67890")

    אם אינך יודע name של המיקום, אפשר לעיין במאמר פירוט כל המיקומים עבור מותג.

  • הלוקאל שיש לעדכן, כשפת ISO 639-1 בת שני תווים קוד

  • הודעת פתיחה חדשה

  • כתובת URL של מדיניות פרטיות

  • (אופציונלי) טקסט למשפטי פתיחה

  • (אופציונלי) נתוני דיווח חוזר על המרה (PostBack) לתחילת שיחה

  • (אופציונלי) הודעה חדשה במצב אופליין

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

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

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

אם לא רוצים להתחיל שיחה חדשה, אפשר להשמיט את conversationStarters ואת כל בשדות צאצא.

הגדרות ברמת הנציג

cURL

# This code updates the conversational settings of a Business Messages agent.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch

# Replace the __BRAND_ID__, __AGENT_ID__ and __LOCALE__
# 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.conversationalSettings.__LOCALE__" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "businessMessagesAgent": {
    "conversationalSettings": {
      "__LOCALE__": {
        "welcomeMessage": {
          "text": "My first welcome message"
        },
        "offlineMessage": {
          "text": "My first offline message"
        },
        "privacyPolicy": {
          "url": "https://www.your-company-website.com/privacy"
        },
        "conversationStarters": [
          {
            "suggestion": {
              "reply": {
                "text": "Suggestion 1",
                "postbackData": "post_back_suggestion_1"
              }
            }
          }
        ]
      }
    }
  }
}'

Node.js

/**
 * This code snippet updates the conversationalSettings of a Business Messages agent.
 * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch
 *
 * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js
 * Business Communications client library.
 */

/**
 * Edit the values below:
 */
const BRAND_ID = 'EDIT_HERE';
const AGENT_ID = 'EDIT_HERE';
const LOCALE = 'en';
const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json';

const businesscommunications = require('businesscommunications');
const {google} = require('googleapis');

// Initialize the Business Communications API
const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});

// Set the scope that we need for the Business Communications API
const scopes = [
  'https://www.googleapis.com/auth/businesscommunications',
];

// Set the private key to the service account file
const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY);

async function main() {
  const authClient = await initCredentials();

  const agentName = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID;

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: agentName,
      updateMask: 'businessMessagesAgent.conversationalSettings.' + LOCALE,
      resource: {
        businessMessagesAgent: {
          conversationalSettings: {
            [LOCALE]: {
              privacyPolicy: { url: 'https://www.your-company-website.com/privacy' },
              welcomeMessage: { text: 'My updated welcome message' },
              offlineMessage: { text: 'My updated offline message' },
              conversationStarters: [
                {
                  suggestion: {
                    reply: {
                      'text': 'Suggestion 2',
                     'postbackData': 'post_back_suggestion_2',
                    },
                  },
                }
              ],
            },
          }
        }
      }
    };

    bcApi.brands.agents.patch(apiParams, {}, (err, response) => {
      if (err !== undefined && err !== null) {
        console.dir(err);
      } else {
        // Agent found
        console.log(response.data);
      }
    });
  }
  else {
    console.log('Authentication failure.');
  }
}

/**
 * Initializes the Google credentials for calling the
 * Business Messages API.
 */
 async function initCredentials() {
  // Configure a JWT auth client
  const authClient = new google.auth.JWT(
    privatekey.client_email,
    null,
    privatekey.private_key,
    scopes,
  );

  return new Promise(function(resolve, reject) {
    // Authenticate request
    authClient.authorize(function(err, tokens) {
      if (err) {
        reject(false);
      } else {
        resolve(authClient);
      }
    });
  });
}

main();

Java

import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.businesscommunications.v1.BusinessCommunications;
import com.google.api.services.businesscommunications.v1.model.*;
import com.google.common.collect.ImmutableMap;
import java.io.FileInputStream;
import java.util.Arrays;

class Main {
  /**
   * Initializes credentials used by the Business Communications API.
   */
  private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
    BusinessCommunications.Builder builder = null;
    try {
      GoogleCredential credential = GoogleCredential
            .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));

      credential = credential.createScoped(Arrays.asList(
          "https://www.googleapis.com/auth/businesscommunications"));

      credential.refreshToken();

      HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
      JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();

      // Create instance of the Business Communications API
      builder = new BusinessCommunications
          .Builder(httpTransport, jsonFactory, null)
          .setApplicationName(credential.getServiceAccountProjectId());

      // Set the API credentials and endpoint
      builder.setHttpRequestInitializer(credential);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return builder;
  }

  public static void main(String args[]) {
    try {
      // Create client library reference
      BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();

      String agentName = "brands/BRAND_ID/agents/AGENT_ID";

      Agent agent = new Agent().setBusinessMessagesAgent(
          new BusinessMessagesAgent().setConversationalSettings(ImmutableMap.of("LOCALE",
              new ConversationalSetting()
                  .setPrivacyPolicy(new PrivacyPolicy().setUrl("PRIVACY_POLICY_URL"))
                  .setWelcomeMessage(new WelcomeMessage().setText("WELCOME_MESSAGE"))
                  .setOfflineMessage(new OfflineMessage().setText("OFFLINE_MESSAGE"))
                  .setConversationStarters(Arrays.asList(
                      new ConversationStarters().setSuggestion(new Suggestion()
                          .setReply(new SuggestedReply()
                              .setText("REPLY_TEXT")
                              .setPostbackData("POSTBACK_DATA"))),
                      )))));

      BusinessCommunications.Brands.Agents.Patch request = builder
          .build().brands().agents().patch(agentName, agent);

      request.setUpdateMask("businessMessagesAgent.conversationalSettings.LOCALE");

      Agent updatedAgent = request.execute();
      System.out.println(updatedAgent.toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
הקוד הזה מבוסס על Java Business ספריית לקוח לתקשורת.

Python

"""This code updates the conversational settings of a Business Messages agent.

Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/patch

This code is based on the https://github.com/google-business-communications/python-businessmessages
Python Business Messages client library.
"""

from oauth2client.service_account import ServiceAccountCredentials
from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1
from businesscommunications.businesscommunications_v1_messages import (
    Agent,
    BusinessMessagesAgent,
    ConversationStarters,
    ConversationalSetting,
    OfflineMessage,
    PrivacyPolicy,
    WelcomeMessage,
    NegativeBotFeedbackMessage,
    BusinesscommunicationsBrandsAgentsPatchRequest,
)

# Edit the values below:
BRAND_ID = 'EDIT_HERE'
AGENT_ID = 'EDIT_HERE'
SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
SERVICE_ACCOUNT_FILE = './service_account_key.json'

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

client = BusinesscommunicationsV1(credentials=credentials)

agents_service = BusinesscommunicationsV1.BrandsAgentsService(client)

agent_name = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID

agent=Agent(
                businessMessagesAgent=BusinessMessagesAgent(
                        conversationalSettings=BusinessMessagesAgent.ConversationalSettingsValue(
                        additionalProperties=[BusinessMessagesAgent.ConversationalSettingsValue.AdditionalProperty(
                            key='en',
                            value=ConversationalSetting(
                                privacyPolicy=PrivacyPolicy(url='https://www.your-company-website.com/privacy'),
                                welcomeMessage=WelcomeMessage(text='Welcome to Business Messages'),
                            offlineMessage=OfflineMessage(text='This is an offline message'),
                                conversationStarters=[
                                    ConversationStarters(
                                        suggestion=Suggestion(
                                           reply=SuggestedReply(text='Option 1',
                                  postbackData='option_1')
                                        )
                                    )]
                                )
                            )
                        ]
                    )
                )
)

updated_agent = agents_service.Patch(
        BusinesscommunicationsBrandsAgentsPatchRequest(
            agent=agent,
            name=agent_name,
            updateMask='businessMessagesAgent.conversationalSettings.en'
        )
    )

print(updated_agent)

הגדרות ברמת המיקום

# 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.locations/patch

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

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/locations/__LOCATION_ID__?updateMask=conversationalSettings.__LOCALE__" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "conversationalSettings": {
    "__LOCALE__": {
      "welcomeMessage": {
        "text": "My second welcome message"
      },
      "offlineMessage": {
        "text": "My second offline message"
      },
      "privacyPolicy": {
        "url": "https://www.your-company-website.com/privacy"
      },
      "conversationStarters": [
        {
          "suggestion": {
            "reply": {
              "text": "Suggestion 2",
              "postbackData": "post_back_suggestion_2"
            }
          }
        }
      ]
    }
  }
}'

למידע על עיצוב וערכים: brands.agents.patch brands.locations.patch, וגם ConversationalSetting.

דוגמאות

הגדרות ברמת הנציג

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/BRAND_ID/agents/AGENT_ID?updateMask=businessMessagesAgent.conversationalSettings.en" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \
-d "{
    'businessMessagesAgent': {
        'conversationalSettings': {
            'en': {
                'welcomeMessage': {
                    'text': 'Thanks for contacting Growing Tree Bank. What can I help with today?',
                },
                'offlineMessage': {
                    'text': 'We\'re closed for the night. Please reach out to us again tomorrow.',
                },
                'privacyPolicy': {
                    'url': 'https://www.growingtreebank.com/privacy',
                },
                'conversationStarters': [
                    {
                        'suggestion': {
                            'reply': {
                                'text': 'Set up an account',
                                'postbackData': 'new-account',
                            },
                        },
                    },
                    {
                        'suggestion': {
                            'reply': {
                                'text': 'Look up account information',
                                'postbackData': 'account-lookup',
                            },
                        },
                    },
                ],
            },
        },
    },
}"

הגדרות ברמת המיקום

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/12345/locations/67890?updateMask=conversationalSettings.en" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json /path/to/service/account/key businesscommunications)" \
-d "{
    'conversationalSettings': {
        'en': {
            'welcomeMessage': {
                'text': 'Thanks for contacting Growing Tree Bank on Amphitheatre Pkwy. What can I help with today?',
            },
            'offlineMessage': {
                'text': 'We\'re closed for the night. Please reach out to us again tomorrow.',
            },
            'privacyPolicy': {
                'url': 'https://www.growingtreebank.com/privacy',
            },
            'conversationStarters': [
                {
                    'suggestion': {
                        'reply': {
                            'text': 'What are your hours?',
                            'postbackData': 'hours',
                        },
                    },
                },
                {
                    'suggestion': {
                        'reply': {
                            'text': 'Set up an account',
                            'postbackData': 'new-account',
                        },
                    },
                },
                {
                    'suggestion': {
                        'reply': {
                            'text': 'Look up account information',
                            'postbackData': 'account-lookup',
                        },
                    },
                },
                {
                    'suggestion': {
                        'action': {
                            'text': 'Call us',
                            'postbackData': 'call',
                            'dialAction': {
                              'phoneNumber': '+12223334444',
                            },
                        },
                    },
                },
            ],
        },
    },
}"