Görüşmeyi başlatma

Business Messages temsilcileriyle görüşmelerde, karşılama mesajı uygun bir üslup belirlemektir. Ayrıca, kullanıcılara temsilcinin neler yaptığı hakkında bilgi verir. kullanıcının sorularını ve beklentilerini şekillendirir.

Kullanıcı her görüşme açtığında temsilci bir karşılama mesajı gönderir. İlgili içeriği oluşturmak için kullanılan temsilci, görüşme başlatıcılar da gösterebilir bilinen veya sık kullanılan yollarda yönlendirilebilir.

Kullanıcı, temsilcinin çalışma saatlerinin dışında görüşme başlatmaya çalışırsa Temsilcinin, çevrimdışı bir mesaj göstermesi alternatif kanalları paylaşmak veya sonraki adımlar için öneride bulunmak için kullanabilirsiniz. Google Cloud'un aracınızın güvenilirliğini ve kullanılabilirliğini artırabilirsiniz.

Gemini konusunu açarken söylenebilecekler

Temsilci ve konum düzeyindeki ayarlar

Görüşme ayarlarını temsilci veya konum düzeyinde belirtebilirsiniz.

  • Temsilci düzeyi: Bu sohbet ayarları aracısı olmalıdır.

    Temsilci düzeyinde karşılama mesajı, şu şekilde başlayabilir: "İletişim kurduğunuz için teşekkür ederiz Bridgepoint Runners..." Görüşme başlatıcılar işlem veya bilgi sağlar.

  • Konum düzeyi: Bu ayarlar, aracı düzeyindeki ayarları geçersiz kılar ve yalnızca PLACESHEET ve üzeri konumdaki ileti dizilerinde geçerlidir. MAPS giriş puanı.

    Konum düzeyinde karşılama mesajı, "İletişim kurduğunuz için teşekkür ederiz Bridgepoint Runners on Amphitheatre Pkwy..." Görüşme başlatıcılar odaklanabilir görevlere veya bilgilere odaklanıyor. Çevrimdışı bir mesajda bundan bahsedilebilir. müşterinin ne zaman açılacağına karar verebiliriz.

Yerel ayarlar

Aracılar ve konumlar, kullandıkları yerel ayarlar için ayrı ayarlar belirtebilir destek. Örneğin, bir temsilci "en" "es" için İspanyolca karşılama mesajının aynısını kullanın. yerel ayar. Business Messages, kullanıcı cihazının bildirilen yerel ayarı ile bir temsilcinin veya konumun sohbet ayarlarına sahip olduğu yerel ayarlar.

Bu yerel ayar eşleşmesi her iletinin resolvedLocale alanı boş bırakılamaz. Siz bir temsilcinin veya konumun, ağırlıkların çözümlenen defaultLocale değerini belirtebilir yerel ayar eşleşmesi. Yerelleştirme ve yerel ayarlar.

Business Messages, hangi konuşma dilini belirlemek için çözümlenmiş yerel ayarı kullanır? ayarlarını yapabilirsiniz.

Karşılama mesajı

Temsilci ile kullanıcı arasındaki görüşmedeki ilk mesaj, temsilcinin karşılama mesajı. Hoş geldiniz mesajı, kullanıcı bir yeni ileti dizisi oluşturabilirsiniz. İyi bir karşılama mesajı Kullanıcının temsilciyle etkileşim kurma beklentilerini belirler. Bir karşılamayı düzenlemek için Sohbet ayarlarını güncelleme başlıklı makaleyi inceleyin.

Gemini konusunu açarken söylenebilecekler

İyi bir karşılama mesajı bir temsilcinin işlevlerini genel hatlarıyla açık uçlu, iletişim kurmanın iyi bir yoludur Kullanıcıları sık sorulan sorulara veya bilinen işlevlere yönlendirme.

Görüşme başlatıcılar dikey olarak yığılmış önerilenler olarak görünüyor ve karşılama mesajını doğrudan takip etmelidir. Kullanıcı bir görüşmeye dokunduğunda başlatıcı, ayarladığınız önceden tanımlanmış içeriği ve geri gönderme verilerini alır unutmayın.

Bir aracı, belirli istekler için otomatik işlevselliği destekliyorsa Bu isteklere karşılık gelen görüşme başlatıcılar, olası satış yaratma ve bunları kullanmaya hazır canlı temsilcilere serbest biçimli kullanıcı soruları ver.

Bir temsilcinin en fazla 5 görüşme başlatıcısı olabilir ve her başlatıcı en fazla 35 karakterden oluşmalıdır.

Görüşme başlatıcılar eklemek veya mevcut görüşmeleri düzenlemek için Görüşmeleri güncelleme" başlıklı makaleyi inceleyin. Ayarlar'da bulabilirsiniz.

Çevrimdışı mesajlar

Bir kullanıcı, temsilcinin çalışmadığı bir temsilciyle görüşme başlattığında saat ( MessagingAvailability), Kullanıcı, temsilcinin çevrimdışı mesajını alır. Yalnızca gerçek kişi olan temsilci kullanılabilirlik durumu dikkate alınır. Temsilcilerle yalnızca bot temsilcilerinin her zaman karşılama mesajı göndermesini sağlayabilirsiniz. İyi bir çevrimdışı mesaj

  • Temsilcinin neden uygun olmadığını belirtir
  • Kullanıcıya sonraki uygun adımlar veya alternatif iletişim kanalları hakkında bilgi verir
  • Karşılama mesajının ve görüşme başlatıcıların üslubuna uygundur.

Hatalı çevrimdışı mesaj

"Maalesef kapalıyız."

İyi çevrimdışı mesaj

"Şu anda kapalıyız ancak yarın saat 08:00'de tekrar müsait olacağız. Eğer acil yardıma ihtiyacınız varsa +12223334444 veya support@gtb.com numaralı telefondan Destek ekibiyle iletişime geçin."

Çevrimdışı mesajları düzenlemek için Görüşme ayarlarını güncelleme başlıklı makaleyi inceleyin.

Sohbet ayarlarını güncelleme

Karşılama mesajını veya görüşme başlatıcılarını yönetmek için YAMA isteğinde bulunursunuz Business Communication API bir temsilcinin veya konumun conversationalSettings alanını güncelleyin.

conversationalSettings alanını güncellediğinizde, şunlar için değerler eklemeniz gerekir: tüm alanları ConversationalSetting nesnesini tanımlayın. Güncelleme istekleri, şunlar da dahil olmak üzere düzenlediğiniz tüm alanların içeriklerinin üzerine yazılır alt alanlara sahip olmanız gerekir. Örneğin, bir karşılama mesajının değiştirilmesini ancak ileti dizisi başlatıcıları eklemeyin, istek önceki tüm eski konuşmaya başlayabilirsiniz.

Ön koşullar

Sohbet ayarlarını güncellemeden önce aşağıdaki öğelere ihtiyacınız vardır:

  • Geliştirme makinenizdeki GCP projenizin hizmet hesabı anahtarına giden yol
  • Ayarlarını güncellemek istediğiniz yerel ayar
  • Temsilci düzeyindeki ayarlar için aracı name (örneğin, "brands/12345/agents/67890")

    Temsilcinin name numarasını bilmiyorsanız brand [marka] özelliğini gönderin.

  • Konum düzeyindeki ayarlar için konum name (örneğin, "brands/12345/locations/67890")

    Konumun name konumunu bilmiyorsanız brand [marka] özelliğini gönderin.

  • İki karakterlik ISO 639-1 diliyle güncellenecek yerel ayar kod

  • Yeni karşılama mesajı

  • Gizlilik politikası URL'si

  • (İsteğe bağlı) Görüşme başlatıcılar için metin

  • (İsteğe bağlı) Görüşme başlatıcılar için geri gönderme verileri

  • (İsteğe bağlı) Yeni çevrimdışı mesaj

Geçerli conversationalSettings değerlerini bilmiyorsanız Aracı alma konusunu inceleyin. bilgi ve Konum al girin.

Güncelleme isteğini gönderin

Aracıyı veya konumu güncellemek için aşağıdaki komutu çalıştırın. Değişkenleri değiştir Ön koşullar bölümünde tanımladığınız değerlerle uyumlu olmalıdır.

Görüşme başlatıcılar istemiyorsanız conversationStarters ve diğer tüm ifadeleri çıkarın. alt alanları.

Temsilci düzeyindeki ayarlar

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();
    }
  }
}
Bu kod, Java İşletmesi İletişim istemci kitaplığı.

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)

Konum düzeyindeki ayarlar

# 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"
            }
          }
        }
      ]
    }
  }
}'

Biçimlendirme ve değer bilgileri için bkz. brands.agents.patch brands.locations.patch, ve ConversationalSetting.

Örnekler

Temsilci düzeyindeki ayarlar

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',
                            },
                        },
                    },
                ],
            },
        },
    },
}"

Konum düzeyindeki ayarlar

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',
                            },
                        },
                    },
                },
            ],
        },
    },
}"