Agent oder Standort bestätigen

Nachdem Sie einen Business Messages-Agent für eine von Ihnen verwaltete und erstellte Agent-Informationen erstellt haben, können Sie den Agent und alle zugehörigen Standorte bestätigen. Sie müssen Agents und Standorte bestätigen, bevor sie starten können.

Agent-Verifizierung

Wenn Sie einen Agent bestätigen, bestätigt Business Messages die Informationen des Agents mit einem Kontakt der Marke, die der Agent repräsentiert. Sobald der Markenkontakt bestätigt, dass Sie die Marke mit dem Agent repräsentieren können und dass die Agent-Informationen korrekt sind, wird der Agent bestätigt.

Checkliste vor der Überprüfung

Bevor Sie den Agent bestätigen, können Sie anhand der folgenden Checkliste alle Probleme ermitteln, die während der Überprüfung auftreten können.

Informationen zum Agent
Agent-Name

Erforderlich. Der Name des Agents, so wie er Nutzern angezeigt wird. Weitere Informationen finden Sie unter Agent erstellen.

Agent-Logo

Erforderlich. Das Logo des Agents, wie es Nutzern angezeigt wird. Weitere Informationen finden Sie unter Agent erstellen.

Verfügbarkeit von Nachrichten

Erforderlich. Die Tage und Uhrzeiten, zu denen Kundenservicemitarbeiter auf Anfragen antworten können. Weitere Informationen finden Sie unter Nachrichtenverfügbarkeit festlegen.

Nicht-lokale Informationen

Erforderlich für nicht lokale Einstiegspunkte. Zugehörige Domains, Telefonnummern und verfügbare Einführungsregionen des Agents. Weitere Informationen finden Sie unter Nicht lokale Informationen festlegen.

Standardsprache

Erforderlich. Die Sprache, in der der Agent normalerweise kommuniziert. Weitere Informationen findest du unter Lokalisierung und Sprachen.

OAuth-Konfiguration

Optional. Details zur OAuth-Integration des Agents in andere Produkte. Weitere Informationen finden Sie unter Mit OAuth authentifizieren.

Zulässige Einstiegspunkte

Erforderlich. Nur erforderlich, um zu prüfen, ob Sie den Agent mit der Business Communications API erstellt haben. Weitere Informationen finden Sie unter Agent erstellen.

Nachdem Sie den Agent bestätigt haben, können Sie nur noch die folgenden Elemente aktualisieren:

  • conversationalSettings
  • customAgentId
  • defaultLocale
  • primaryAgentInteraction
  • additionalAgentInteractions
  • phone

Wenn Sie schreibgeschützte Felder aktualisieren möchten, nachdem Sie den Agent überprüft haben, wenden Sie sich an uns. Du musst dich zuerst mit einem Business Messages Google-Konto anmelden. Informationen zur Registrierung für ein Konto finden Sie unter Mit Business Messages registrieren.

Voraussetzungen

Bevor Sie den Agent bestätigen können, benötigen Sie einige Informationen:

  • Kundenservicemitarbeiter name

    Wenn Sie den Namen eines Agents nicht kennen, lesen Sie den Abschnitt Alle Agents für eine Marke auflisten.

  • Pfad zum Dienstkontoschlüssel Ihres GCP-Projekts auf Ihrem Entwicklungscomputer

  • Partnername (Name Ihrer Organisation)
  • E-Mail-Adresse des Partners (Ihre E-Mail-Adresse)
  • Website der Marke, die der Agent repräsentiert, als öffentlich verfügbare URL, die mit „https://“ beginnt
  • Name und E-Mail-Adresse des Ansprechpartners (normalerweise eine Domain mit der Markenwebsite teilen) der Marke, die der Agent repräsentiert, die Ihre Geschäftsbeziehung mit der Marke bestätigen können und Ihre Befugnis, die Marke zu vertreten

Agent überprüfen

Wenn Sie die Bestätigung für einen Agent anfordern, sendet Business Messages eine E-Mail an die von Ihnen angegebene Kontaktperson, um die Informationen des Agents zu bestätigen.

Wenn der Markenkontakt Ihre Agent-Informationen und Business Messages den Agent bestätigt, erhalten Sie eine E-Mail.

Führen Sie den folgenden Befehl aus, um einen Agent zu überprüfen. Ersetzen Sie Variablen durch Werte, die unter Voraussetzungen angegeben sind.

cURL


# This code requests a verification of a Business Messages agent.
# Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/verify?method=api#verify_an_agent

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

curl -X POST \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__:requestVerification" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "agentVerificationContact": {
    "partnerName": "Partner name",
    "partnerEmailAddress": "partner@email.com",
    "brandContactName": "Brand contact name",
    "brandContactEmailAddress": "brand-contact@email.com",
    "brandWebsiteUrl": "https://www.your-company-website.com"
  }
}'

Node.js


/**
 * This code snippet requests an agent verification.
 * Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/verify?method=api#verify_an_agent
 *
 * 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 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) {
    const agentVerificationContact = {
      agentVerificationContact: {
        partnerName: 'Partner name',
        partnerEmailAddress: 'partner@email.com',
        brandContactName: 'Brand contact name',
        brandContactEmailAddress: 'brand-contact@email.com',
        brandWebsiteUrl: 'https://www.your-company-website.com',
      },
    };

    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: agentName,
      resource: agentVerificationContact,
    };

    bcApi.brands.agents.requestVerification(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.Agent;
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";

      BusinessCommunications.Brands.Agents.RequestVerification request
          = builder.build().brands().agents().requestVerification(agentName,
          new RequestAgentVerificationRequest().setAgentVerificationContact(
              new AgentVerificationContact()
                  .setPartnerName("PARTNER_NAME")
                  .setPartnerEmailAddress("PARTNER_EMAIL")
                  .setBrandContactName("BRAND_CONTACT_NAME")
                  .setBrandContactEmailAddress("BRAND_CONTACT_EMAIL")
                  .setBrandWebsiteUrl("BRAND_WEBSITE_URL")));

      System.out.println(request.execute().toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
Dieser Code basiert auf der Clientbibliothek von Java Business Communications.

Python


"""This code requests a verification of a Business Messages agent.

Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/verify?method=api#verify_an_agent

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 (
    BusinesscommunicationsBrandsAgentsRequestVerificationRequest,
    RequestAgentVerificationRequest,
    AgentVerificationContact
)

# 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

verification_request = agents_service.RequestVerification(BusinesscommunicationsBrandsAgentsRequestVerificationRequest(
        name=agent_name,
        requestAgentVerificationRequest=RequestAgentVerificationRequest(
            agentVerificationContact=AgentVerificationContact(
                partnerName='Partner name',
                partnerEmailAddress='partner@email.com',
                brandContactName='Brand contact name',
                brandContactEmailAddress='brand-contact@email.com',
                brandWebsiteUrl='https://www.your-company-website.com'
           ))
    ))

print(verification_request)

Formatierungs- und Wertoptionen finden Sie unter brands.agents.requestVerification.

Bestätigungsstatus eines Agents abrufen

Nachdem Sie eine Anfrage zur Agent-Überprüfung gestellt haben, können Sie den Bestätigungsstatus des Agents prüfen.

Führen Sie den folgenden Befehl aus, um den Bestätigungsstatus eines Agents abzurufen. Ersetzen Sie Variablen durch Werte, die unter Voraussetzungen aufgeführt sind.

cURL


# This code gets the agent verification state.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.locations/getVerification

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

curl -X GET \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/verification" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)"

Node.js


/**
 * This code snippet gets an agent verification state.
 * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.locations/getVerification
 *
 * 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 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 + '/verification',
    };

    bcApi.brands.agents.getVerification(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.Agent;
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/verification";

      BusinessCommunications.Brands.Agents.GetVerification request
          = builder.build().brands().agents().getVerification(agentName);

      System.out.println(request.execute().toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
Dieser Code basiert auf der Clientbibliothek von Java Business Communications.

Python


"""This code gets the agent verification state.

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

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 (
    BusinesscommunicationsBrandsAgentsGetVerificationRequest,
)

# 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 + '/verification'

verification_state = agents_service.GetVerification(BusinesscommunicationsBrandsAgentsGetVerificationRequest(
        name=agent_name
    ))

print(verification_state)

Formatierungs- und Wertoptionen finden Sie unter brands.agents.getVerification.

Anfrage zur Agent-Bestätigung zurückziehen

Wenn Sie feststellen, dass die Agent-Informationen falsch sind oder der Agent anderweitig nicht zur Bestätigung bereit ist, können Sie ausstehende Bestätigungsanfragen abbrechen. Wenn Sie eine Anfrage stornieren, wird Ihr Markenkontakt von Business Messages benachrichtigt und Sie müssen eine neue Anfrage stellen, um den Bestätigungsprozess neu zu starten.

Führen Sie den folgenden Befehl aus, um eine Agent-Überprüfungsanfrage abzubrechen. Ersetzen Sie Variablen durch Werte, die unter Voraussetzungen aufgeführt sind.

cURL


# This code updates the verification state of an agent.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/updateVerification

# Replace the __BRAND_ID__ and __AGENT_ID__
# 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__/verification" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
-d '{
  "verificationState": "VERIFICATION_STATE_UNVERIFIED"
}'

Node.js


/**
 * This code snippet updates the state of an agent verification.
 * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/updateVerification
 *
 * 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 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 + '/verification',
      updateMask: 'verificationState',
      resource: {
        name: agentName,
        verificationState: 'VERIFICATION_STATE_UNVERIFIED',
      }
    };

    bcApi.brands.agents.updateVerification(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.Agent;
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/verification";

      BusinessCommunications.Brands.Agents.UpdateVerification request
          = builder.build().brands().agents().updateVerification(agentName,
              new AgentVerification().setVerificationState("VERIFICATION_STATE_UNVERIFIED"));

      System.out.println(request.execute().toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
Dieser Code basiert auf der Clientbibliothek von Java Business Communications.

Python


"""This code updates the verification state of an agent.

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

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 (
    AgentVerification,
    BusinesscommunicationsBrandsAgentsUpdateVerificationRequest,
)

# 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 + '/verification'

update_request = agents_service.UpdateVerification(
        BusinesscommunicationsBrandsAgentsUpdateVerificationRequest(
            name=agent_name,
            updateMask='verificationState',
            agentVerification=AgentVerification(verificationState=AgentVerification.VerificationStateValueValuesEnum.VERIFICATION_STATE_UNVERIFIED)
        )
    )

print(update_request)

Formatierungs- und Wertoptionen finden Sie unter brands.agents.updateVerification.

Standortbestätigung

Nachdem Sie einen Agent bestätigt haben, können Sie die mit diesem Agent verknüpften Standorte bestätigen. Sobald ein Standort bestätigt und der zugehörige Agent gestartet wurde, können Sie ihn zur Verwendung mit dem Agent starten.

Wenn die Marke Teil einer Kette ist, müssen Sie alle Standorte für diese Kette hinzufügen, an denen Sie die Berechtigung zum Aktivieren von Messaging haben. Wenn Sie alle hinzugefügten Standorte bestätigen möchten, beantragen Sie die Bestätigung für nur einen Standort. Sobald wir diesen Standort bestätigen, bestätigen wir automatisch auch die anderen verknüpften Standorte, die Sie hinzugefügt haben.

Wenn Sie nach der Bestätigung zusätzliche Standorte hinzufügen, müssen Sie die Standortüberprüfung noch einmal anfordern. Sollte ein Standort nicht automatisch bestätigt werden, kontaktieren Sie uns und geben Sie Details zum Unternehmen und zu den Standorten an.

Checkliste vor der Überprüfung

Bevor Sie Ihren Standort bestätigen, können Sie anhand der folgenden Checkliste alle Probleme ermitteln, die bei der Bestätigung auftreten können.

Informationen zum Agent
Agent-Bestätigung

Erforderlich. Überprüfung, ob die Informationen des Agents korrekt sind und der Agent die zugehörige Marke repräsentieren kann Weitere Informationen finden Sie unter Agents und Standorte überprüfen.

Standortinformationen
Orts-ID

Erforderlich. Die eindeutige Kennung für einen Standort in der Google Places-Datenbank und in Google Maps. Weitere Informationen finden Sie unter Standorte verwalten.

Zulässige Einstiegspunkte

Erforderlich. Nur erforderlich, um zu prüfen, ob Sie den Agent mit der Business Communications API erstellt haben. Weitere Informationen finden Sie unter Standorte verwalten.

Voraussetzungen

Bevor Sie den Agent bestätigen können, benötigen Sie einige Informationen:

  • Standort name

    Wenn Sie den Namen eines Agents nicht kennen, finden Sie weitere Informationen unter Alle Standorte für eine Marke auflisten.

  • Pfad zum Dienstkontoschlüssel Ihres GCP-Projekts auf Ihrem Entwicklungscomputer

Standort bestätigen

Wenn Sie die Bestätigung für einen Standort anfordern, wird in Business Messages bestätigt, dass der Standort mit der Marke übereinstimmt, die der entsprechende Vertreter repräsentiert. Sie erhalten eine E-Mail, wenn die Standortbestätigung abgeschlossen ist.

Nachdem Sie einen Standort bestätigt haben, können Sie keine Änderungen mehr daran vornehmen. Wenn Sie einen bestätigten Standort aktualisieren möchten, wenden Sie sich an uns. Du musst dich zuerst mit einem Business Messages Google-Konto anmelden. Informationen zur Registrierung für ein Konto finden Sie unter Mit Business Messages registrieren.

Führen Sie den folgenden Befehl aus, um einen Standort zu bestätigen. Ersetzen Sie Variablen durch Werte, die unter Voraussetzungen angegeben sind.

cURL


# This code requests a verification of a location.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.locations/requestVerification

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

curl -X POST \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/locations/__LOCATION_ID__:requestVerification" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)"

Node.js


/**
 * This code snippet requests a verification for a location.
 * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.locations/requestVerification
 *
 * 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 LOCATION_ID = 'EDIT_HERE';
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 locationName = 'brands/' + BRAND_ID + '/locations/' + LOCATION_ID;

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: locationName,
    };

    bcApi.brands.locations.requestVerification(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.Agent;
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 locationName = "brands/BRAND_ID/locations/LOCATION_ID/verification";

      BusinessCommunications.Brands.Locations.RequestVerification request
          = builder.build().brands().locations().requestVerification(locationName,
                new RequestLocationVerificationRequest());

      System.out.println(request.execute().toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
Dieser Code basiert auf der Clientbibliothek von Java Business Communications.

Python


"""This code requests a verification of a location.

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

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 (
    BusinesscommunicationsBrandsLocationsRequestVerificationRequest,
    RequestLocationVerificationRequest
)

# Edit the values below:
BRAND_ID = 'EDIT_HERE'
LOCATION_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)

locations_service = BusinesscommunicationsV1.BrandsLocationsService(client)

location_name = 'brands/' + BRAND_ID + '/locations/' + LOCATION_ID

verification_request = locations_service.RequestVerification(BusinesscommunicationsBrandsLocationsRequestVerificationRequest(
        name=location_name,
        requestLocationVerificationRequest=RequestLocationVerificationRequest()
    ))

print(verification_request)

Formatierungs- und Wertoptionen finden Sie unter brands.locations.requestVerification.

Bestätigungsstatus eines Standorts abrufen

Nachdem Sie eine Anfrage zur Standortbestätigung gestellt haben, können Sie den Bestätigungsstatus des Standorts prüfen.

Führen Sie den folgenden Befehl aus, um den Bestätigungsstatus eines Standorts abzurufen. Ersetzen Sie Variablen durch Werte, die unter Voraussetzungen aufgeführt sind.

cURL


# This code gets the verification state of a location.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.locations/getVerification

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

curl -X GET \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/locations/__LOCATION_ID__/verification" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)"

Node.js


/**
 * This code snippet gets the verification state of a location.
 * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.locations/getVerification?hl=en
 *
 * 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 LOCATION_ID = 'EDIT_HERE';
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 locationName = 'brands/' + BRAND_ID + '/locations/' + LOCATION_ID;

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: locationName + '/verification',
    };

    bcApi.brands.locations.getVerification(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.Agent;
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 locationName = "brands/BRAND_ID/locations/LOCATION_ID/verification";

      BusinessCommunications.Brands.Locations.GetVerification request
          = builder.build().brands().locations().getVerification(locationName);

      System.out.println(request.execute().toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
Dieser Code basiert auf der Clientbibliothek von Java Business Communications.

Python


"""This code gets the verification state of a location.

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

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 (
    BusinesscommunicationsBrandsLocationsGetVerificationRequest,
)

# Edit the values below:
BRAND_ID = 'EDIT_HERE'
LOCATION_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)

locations_service = BusinesscommunicationsV1.BrandsLocationsService(client)

location_name = 'brands/' + BRAND_ID + '/locations/' + LOCATION_ID + '/verification'

verification_state = locations_service.GetVerification(BusinesscommunicationsBrandsLocationsGetVerificationRequest(
        name=location_name
    ))

print(verification_state)

Formatierungs- und Wertoptionen finden Sie unter brands.locations.getVerification.

Nächste Schritte

Sobald der Agent und alle zugehörigen Standorte bestätigt wurden, können Sie sie starten, damit sie mit Nutzern kommunizieren können.