בשיחות עם נציגים של Business Messages, הודעת הפתיחה קובעת את הטון של האינטראקציה. ההודעה גם מאפשרת למשתמשים לדעת מה הסוכן יכול לעשות, וכך הם יכולים להתאים את השאלות והציפיות שלהם.
הנציג שולח הודעת פתיחה בכל פעם שהמשתמש פותח שיחה. הסוכן יכול גם להציג הצעות להתחלת שיחה כדי להנחות את המשתמשים בנתיבים מוכרים או נפוצים.
אם משתמש ינסה להתחיל שיחה מחוץ לשעות הפעילות של הנציג, הנציג יציג הודעה על אי-פעילות שבה תוכלו לשתף ערוצים חלופיים או להציע פעולות להמשך. ההגדרות האלה מאפשרות לכם לשפר את המהימנות והשימושיות של הנציג.
הגדרות ברמת הסוכן והמיקום
אפשר להגדיר את ההגדרות של השיחה ברמת הסוכן או ברמת המיקום.
ברמת הנציג: ההגדרות האלה לשיחות חלות על כל השיחות עם הנציג בכל נקודות הכניסה.
הודעת פתיחה ברמת הסוכן יכולה להתחיל במילים "תודה שפנית אלינו Bridgepoint Runners..." ההצעות לתחילת שיחה יכולות להתמקד בפעולות או במידע שרלוונטיים לכל החברה.
ברמת המיקום: ההגדרות האלה מבטלות את ההגדרות ברמת הנציג, והן חלות רק על שיחות עם המיקום הזה דרך
PLACESHEETוMAPSנקודות הכניסה.הודעת פתיחה ברמת המיקום יכולה להתחיל כך: "תודה שפנית אל Bridgepoint Runners ב-Amphitheatre Pkwy..." הצעות לפתיחת שיחה יכולות להתמקד במשימות או במידע שמבוססים על מיקום. בהודעה במצב אופליין יכול להיות שייכתב מתי המקום ייפתח בפעם הבאה.
לוקאלים
נציגים ומיקומים יכולים לציין הגדרות נפרדות לכל לוקאל שהם תומכים בו. לדוגמה, נציג יכול לציין הודעת פתיחה באנגלית עבור הלוקאל en, ואותה הודעת פתיחה בספרדית עבור הלוקאל es. התכונה 'הודעות לעסקים' מוצאת התאמה בין הלוקאל שמדווח על ידי מכשיר המשתמש לבין הלוקאלים שמוגדרים לסוכן או למיקום.
התאמה ללוקאל מדווחת בשדה resolvedLocale של כל הודעה. אפשר לציין את defaultLocale של סוכן או מיקום, שמשפיע על המשקל של התאמת הלוקאל. מידע על לוקליזציה ואזורים
הפלטפורמה 'הודעות לעסקים' משתמשת בלוקאל שנפתר כדי לקבוע אילו הגדרות של שיחות יחולו.
הודעת פתיחה
ההודעה הראשונה בשיחה בין נציג למשתמש היא הודעת הפתיחה של הנציג. הודעת הפתיחה מופיעה אוטומטית אחרי שהמשתמש מתחיל שיחה חדשה. הודעת פתיחה טובה מגדירה למשתמשים את הציפיות לגבי האינטראקציה עם הנציג. כדי לערוך הודעת פתיחה, אפשר לעיין במאמר בנושא עדכון הגדרות השיחה.
רעיונות לפתיחת שיחה
הודעת פתיחה טובה מסבירה את הפונקציונליות של הנציג ברמה גבוהה, והיא לא מוגבלת. הצעות טובות לפתיחת שיחה מפנות את המשתמשים לשאלות נפוצות או לפונקציונליות מוכרת.
הנושאים לשיחה מופיעים כרשימה של הצעות לתשובות אחת מעל השנייה, מיד אחרי הודעת הפתיחה. כשמשתמש מקיש על הודעת פתיחה, הסוכן מקבל תוכן מוגדר מראש ונתוני פוסטבק שהגדרתם כשציינתם את הודעת הפתיחה.
אם נציג תומך בפונקציונליות אוטומטית לבקשות מסוימות, יכול להיות ששאלות פתיחה לשיחה ימופו לבקשות האלה, כך שתוכלו להסתמך על קלט מוכר לאוטומציה ולשלוח שאלות חופשיות של משתמשים לנציגים חיים שמוכנים לענות.
לכל נציג יכולים להיות עד 5 משפטי פתיחה לשיחה, וכל משפט יכול לכלול עד 35 תווים.
כדי להוסיף או לערוך הצעות לפתיחת שיחה, אפשר לעיין במאמר בנושא עדכון ההגדרות של שיחות.
הודעות על אי-פעילות
כשמשתמש מתחיל שיחה עם נציג מחוץ לשעות הפעילות של הנציג (כפי שהוגדרו ב-MessagingAvailability), המשתמש מקבל את ההודעה על אי-פעילות של הנציג. כשמפעילים הודעה במצב אופליין, המערכת בודקת רק את הזמינות של נציג אנושי. נציגים שיש להם רק נציגי בוט תמיד שולחים הודעת פתיחה. הודעה טובה על אי-פעילות
- הסבר למה הסוכן לא זמין
- הנחיית המשתמש לגבי השלבים הבאים המתאימים או ערוצי תקשורת חלופיים
- התשובה תהיה באותו סגנון של הודעת הפתיחה והנושאים לשיחה
הודעה לא טובה במצב אופליין
"מצטערים, אנחנו סגורים".
הודעה טובה על אי-פעילות
"אנחנו סגורים כרגע, אבל נעמוד לרשותך שוב מחר מהשעה 8:00". אם אתם צריכים עזרה דחופה, אתם יכולים לפנות לתמיכה בטלפון +12223334444 או באימייל support@gtb.com."
הוראות לעריכת הודעה אופליין זמינות במאמר עדכון הגדרות השיחה.
עדכון הגדרות השיחה
כדי לנהל הודעת פתיחה או התחלות שיחה, שולחים בקשת PATCH באמצעות Business Communications 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(); } } }
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',
},
},
},
},
],
},
},
}"