बातचीत शुरू करें

Business Messages के एजेंट से बातचीत करते समय, वेलकम मैसेज बातचीत के लिए टोन. इससे उपयोगकर्ताओं को यह भी पता चलता है कि एजेंट क्या-क्या कर सकता है. उपयोगकर्ता के सवालों और उम्मीदों को तय करता है.

जब भी उपयोगकर्ता बातचीत खोलता है, तब एजेंट एक वेलकम मैसेज भेजता है. कॉन्टेंट बनाने एजेंट बातचीत स्टार्टर भी दिखा सकता है. के बारे में ज़्यादा जानकारी मिलेगी.

अगर कोई उपयोगकर्ता, एजेंट के खुले होने के समय के बाहर बातचीत शुरू करने की कोशिश करता है, तो एजेंट एक ऑफ़लाइन मैसेज दिखाता है इसकी मदद से, अन्य चैनल शेयर किए जा सकते हैं या अगले चरणों के सुझाव दिए जा सकते हैं. लंबे समय तक टिके रहने के लिए, तो आपको अपने एजेंट की विश्वसनीयता और उपयोगिता बढ़ानी होगी.

बातचीत शुरू करने के लिए पॉइंट लिखें

एजेंट- और जगह-लेवल की सेटिंग

एजेंट या जगह की जानकारी के हिसाब से, बातचीत की सेटिंग तय की जा सकती है.

  • एजेंट लेवल: बातचीत वाली ये सेटिंग, एजेंट मौजूद है.

    एजेंट-लेवल पर वेलकम मैसेज, "संपर्क करने के लिए धन्यवाद" से शुरू हो सकता है ब्रिजपॉइंट रनर..." बातचीत शुरू करने के लिए, फ़ोकस करने के विकल्प पर कार्रवाई या जानकारी.

  • जगह की जानकारी: ये सेटिंग, एजेंट-लेवल की सेटिंग को बदल देती हैं और यह सिर्फ़ PLACESHEET और MAPS एंट्री पॉइंट.

    जगह के हिसाब से वेलकम मैसेज, "संपर्क करने के लिए धन्यवाद" से शुरू हो सकता है Amphitheatre Pkwy पर ब्रिजपॉइंट रनर..." बातचीत शुरू करने के विकल्प से फ़ोकस किया जा सकता है लोगों से जुड़ी जानकारी इकट्ठा या शेयर करने के लिए किया जा सकता है. एक ऑफ़लाइन मैसेज में इसका ज़िक्र हो सकता है जब स्थान अगली बार खुला होगा.

स्थान-भाषा

एजेंट और जगह की जानकारी वाली सेटिंग, किसी भी स्थान-भाषा के लिए अलग-अलग सेटिंग तय कर सकती है सहायता. उदाहरण के लिए, कोई एजेंट "hi" और स्पैनिश में "es" के लिए एक ही स्वागत संदेश है स्थान-भाषा. Business Messages, उपयोगकर्ता के डिवाइस की रिपोर्ट की गई स्थान-भाषा को मैच करता है और वे स्थान-भाषाएँ जिनके लिए एजेंट या जगह की बातचीत वाली सेटिंग है.

इस स्थान-भाषा का मिलान हर मैसेज में किया जाता है resolvedLocale फ़ील्ड. आपने लोगों तक पहुंचाया मुफ़्त में एजेंट या जगह के defaultLocale के बारे में बता सकता है, जिसका वेट तय किया गया है स्थान-भाषा के हिसाब से खोज. देखें स्थानीय भाषा में लिखना और स्थान-भाषाएँ.

Business Messages, बातचीत करने के लिए चुनी गई स्थान-भाषा का इस्तेमाल करता है लागू करने के लिए सेटिंग.

स्वागत मैसेज

एजेंट और उपयोगकर्ता के बीच बातचीत का पहला मैसेज, एजेंट का होता है वेलकम मैसेज. उपयोगकर्ता के नई बातचीत शुरू करें. अच्छा वेलकम मैसेज एजेंट के साथ बातचीत करने के लिए उपयोगकर्ता की उम्मीदें सेट करता है. वेलकम में बदलाव करने के लिए मैसेज है, तो बातचीत की सेटिंग अपडेट करें देखें.

बातचीत शुरू करने के लिए पॉइंट लिखें

एक अच्छे वेलकम मैसेज में, एजेंट के काम करने के तरीके को बड़े स्तर पर कवर किया जाता है और विस्तार से जवाब दिया जाता है, बेहतर बातचीत शुरू करने के लिए अक्सर पूछे जाने वाले सवालों या पहले से मालूम सुविधाओं के बारे में उपयोगकर्ताओं को गाइड करें.

बातचीत शुरू करने के विकल्प, सुझाए गए वर्टिकल स्टैक के तौर पर दिखते हैं पर क्लिक करें और वेलकम मैसेज को फ़ॉलो करें. जब कोई उपयोगकर्ता किसी बातचीत पर टैप करता है शुरुआत में, एजेंट को पहले से तय कॉन्टेंट और पोस्टबैक डेटा मिलता है, जिसे आपने सेट किया है जब आपको स्टार्टर के तौर पर सेट करना होगा.

अगर कोई एजेंट किसी खास तरह के अनुरोधों के लिए, अपने-आप काम करने वाले फ़ंक्शन की सुविधा देता है, तो बातचीत शुरू करने के लिए सुझाव, उन अनुरोधों को मैप कर सकते हैं जिनसे आपको ऑटोमेशन के लिए इनपुट शामिल करें. साथ ही, फ़्रीफ़ॉर्म उपयोगकर्ता के सवाल उन लाइव एजेंट को भेजें जो इसके लिए तैयार हैं जवाब.

एक एजेंट में ज़्यादा से ज़्यादा पांच बातचीत स्टार्टर हो सकते हैं. साथ ही, हर स्टार्टर ज़्यादा से ज़्यादा 35 वर्ण होने चाहिए.

बातचीत शुरू करने के लिए, नई जानकारी जोड़ने या उसमें बदलाव करने के लिए, बातचीत वाले लेबल अपडेट करें सेटिंग पर टैप करें.

ऑफ़लाइन मैसेज

जब कोई उपयोगकर्ता, एजेंट के काम से बाहर के एजेंट से बातचीत शुरू करता है घंटे (जैसा कि MessagingAvailability), तब उपयोगकर्ता को एजेंट का ऑफ़लाइन मैसेज मिलता है. सिर्फ़ व्यक्ति का प्रतिनिधि ऑफ़लाइन मैसेज को ट्रिगर करते समय खरीदारी के लिए उपलब्धता को ध्यान में रखा जाता है. सिर्फ़ एजेंट बॉट के प्रतिनिधि हमेशा वेलकम मैसेज भेजते हैं. एक अच्छा ऑफ़लाइन मैसेज

  • एजेंट के उपलब्ध न होने की वजह बताएं
  • यह नीति, उपयोगकर्ता को अगले सही चरणों या संपर्क के अन्य तरीकों के बारे में बताती है
  • वेलकम मैसेज और बातचीत शुरू करने वालों की टोन से मेल खाती हो

खराब ऑफ़लाइन मैसेज

"माफ़ करें, हमारा कारोबार बंद है."

अच्छा ऑफ़लाइन मैसेज

"हम अभी बंद हैं, लेकिन कल सुबह 8 बजे से दोबारा उपलब्ध होंगे. अगर आपने आपको तुरंत सहायता चाहिए, तो +12223334444 या support@gtb.com पर सहायता टीम से संपर्क करें."

किसी ऑफ़लाइन मैसेज में बदलाव करने के लिए, बातचीत की सेटिंग अपडेट करें देखें.

बातचीत की सेटिंग अपडेट करें

वेलकम मैसेज या बातचीत शुरू करने के पॉइंट को मैनेज करने के लिए, पैच का अनुरोध किया जाता है Business Communications के ज़रिए एपीआई किसी एजेंट या जगह का conversationalSettings फ़ील्ड अपडेट करने के लिए.

conversationalSettings फ़ील्ड को अपडेट करते समय, आपको सभी फ़ील्ड में ConversationalSetting ऑब्जेक्ट है. अपडेट के अनुरोध, उन सभी फ़ील्ड के कॉन्टेंट को ओवरराइट कर देते हैं जिनमें आप बदलाव करते हैं. इनमें ये भी शामिल हैं सभी चाइल्ड फ़ील्ड शामिल करें. उदाहरण के लिए, अगर आपने वेलकम मैसेज में बदलाव करने का अनुरोध किया है हालाँकि, बातचीत शुरू करने के लिए इस्तेमाल किए जाने वाले चिह्नों को शामिल न करें. अनुरोध करने पर, पहले के बातचीत शुरू करने के लिए इस्तेमाल करें.

ज़रूरी शर्तें

बातचीत वाली सेटिंग अपडेट करने से पहले, आपको इन आइटम की ज़रूरत होगी:

  • आपकी डेवलपमेंट मशीन पर, अपने GCP प्रोजेक्ट की सेवा खाता कुंजी का पाथ
  • वह स्थान-भाषा जिसके लिए आपको सेटिंग अपडेट करनी हैं
  • एजेंट-लेवल की सेटिंग के लिए, एजेंट name (उदाहरण के लिए, "brands/12345/agents/67890")

    अगर आपको एजेंट के name के बारे में पता नहीं है, तो यह देखें कि ब्रैंड के बारे में ज़्यादा जानें.

  • जगह की जानकारी की सेटिंग के लिए, जगह की जानकारी name (उदाहरण के लिए, "brands/12345/locations/67890")

    अगर आपको स्थान के name के बारे में नहीं पता है, तो किसी स्थान के लिए सभी स्थानों को सूचीबद्ध करें ब्रैंड के बारे में ज़्यादा जानें.

  • अपडेट की जाने वाली स्थान-भाषा, दो वर्णों वाली ISO 639-1 भाषा के तौर पर कोड

  • नया वेलकम मैसेज

  • निजता नीति यूआरएल

  • (ज़रूरी नहीं) बातचीत शुरू करने के लिए टेक्स्ट

  • (ज़रूरी नहीं) बातचीत शुरू करने के लिए पोस्टबैक डेटा

  • (ज़रूरी नहीं) नया ऑफ़लाइन मैसेज

अगर आपको 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 बिज़नेस कम्यूनिकेशन क्लाइंट लाइब्रेरी.

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