یک نماینده یا مکان را تأیید کنید

پس از ایجاد یک نماینده پیام‌های تجاری برای برندی که مدیریت می‌کنید و اطلاعات نماینده را نهایی می‌کنید، می‌توانید نماینده و هر مکان مرتبط را تأیید کنید. باید نمایندگان و مکان‌ها را قبل از راه‌اندازی تأیید کنید.

تأیید نمایندگی

وقتی یک نماینده را تأیید می‌کنید، Business Messages اطلاعات نماینده را با تماسی از برندی که نماینده نمایندگی می‌کند تأیید می‌کند. هنگامی که مخاطب برند تأیید کرد که می توانید برند را با نماینده نمایندگی کنید و اطلاعات نماینده صحیح است، نماینده تأیید می شود.

چک لیست پیش از تأیید

قبل از اینکه نماینده خود را تأیید کنید، از چک لیست زیر استفاده کنید تا مشکلاتی را که ممکن است در طول فرآیند تأیید ظاهر شود، پیدا کنید.

اطلاعات نماینده
نام نماینده

مورد نیاز. نام عامل، همانطور که برای کاربران ظاهر می شود. به ایجاد عامل مراجعه کنید.

لوگوی نماینده

مورد نیاز. لوگوی نماینده، همانطور که برای کاربران ظاهر می شود. به ایجاد عامل مراجعه کنید.

در دسترس بودن پیام

مورد نیاز. روزها و زمان هایی که نمایندگان زنده برای پاسخگویی به کاربران در دسترس هستند. به تنظیم در دسترس بودن پیام‌رسانی مراجعه کنید.

اطلاعات غیر محلی

برای نقاط ورودی غیر محلی مورد نیاز است. دامنه های مرتبط، شماره تلفن و مناطق راه اندازی موجود با عامل. به تنظیم اطلاعات غیر محلی مراجعه کنید.

محلی پیش فرض

مورد نیاز. محلی که عامل معمولاً با آن ارتباط برقرار می کند. به محلی سازی و مکان ها مراجعه کنید.

پیکربندی OAuth

اختیاری. جزئیات مربوط به ادغام OAuth نماینده با سایر محصولات. به تأیید اعتبار با OAuth مراجعه کنید.

نقاط ورود مجاز

مورد نیاز. فقط برای بررسی اینکه آیا عامل را با Business Communications API ایجاد کرده اید، لازم است. به ایجاد عامل مراجعه کنید.

پس از تأیید نماینده خود، فقط می توانید موارد زیر را به روز کنید:

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

اگر بعد از تأیید نماینده خود نیاز به به روز رسانی فیلدهای فقط خواندنی دارید،با ما تماس بگیرید (ابتدا باید با حساب Google Business Messages وارد شوید . برای ثبت نام برای یک حساب، به ثبت نام با Business Messages مراجعه کنید.)

پیش نیازها

قبل از اینکه بتوانید نماینده خود را تأیید کنید، باید برخی از اطلاعات را جمع آوری کنید:

  • name نماینده

    اگر نام یک نماینده را نمی‌دانید، فهرست همه نمایندگی‌های یک برند را ببینید.

  • مسیر کلید حساب سرویس پروژه GCP شما در دستگاه توسعه شما

  • نام شریک (نام سازمان شما)
  • ایمیل شریک (ایمیل شما)
  • وب‌سایت برندی که نماینده آن را نشان می‌دهد، به‌عنوان یک URL در دسترس عموم که با «https://» شروع می‌شود.
  • نام تماس و ایمیل (معمولاً یک دامنه را با وب‌سایت برند به اشتراک می‌گذارد) برای برندی که نماینده نمایندگی می‌کند و می‌تواند ارتباط تجاری شما با نام تجاری و اختیار شما برای نمایندگی برند را تأیید کند.

یک نماینده را تأیید کنید

وقتی برای یک نماینده درخواست تأیید می‌کنید، Business Messages به مخاطب برندی که مشخص کرده‌اید ایمیل می‌زند تا اطلاعات نماینده شما را تأیید کند.

وقتی مخاطب برند اطلاعات نماینده شما را تأیید می کند و Business Messages نماینده شما را تأیید می کند، ایمیلی دریافت می کنید.

برای تایید یک عامل، دستور زیر را اجرا کنید. متغیرها را با مقادیر مشخص شده در پیش نیازها جایگزین کنید.

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 \
h"ttps://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__:requestVerification "\
-H C"ontent-Type: application/json "\
-H U"ser-Agent: curl/business-communications "\
-H $"(oauth2l header --json ./service_account_key.json businesscommunications) "\
-d {'
  a"gentVerificationContact:" {
    p"artnerName:" P"artner name,"
    p"artnerEmailAddress:" p"artner@email.com,"
    b"randContactName:" B"rand contact name,"
    b"randContactEmailAddress:" b"rand-contact@email.com,"
    b"randWebsiteUrl:" h"ttps://www.your-company-website.com
"  }
}c'

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 = E'DIT_HERE;'
const AGENT_ID = E'DIT_HERE;'
const PATH_TO_SERVICE_ACCOUNT_KEY = .'/service_account_key.json;'

const businesscommunications = require(b'usinesscommunications)';
const {google} = require(g'oogleapis)';

// 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 = [
  h'ttps://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 = b'rands/ '+ BRAND_ID + /'agents/ '+ AGENT_ID;

  if (authClient) {
    const agentVerificationContact = {
      agentVerificationContact: {
        partnerName: P'artner name,'
        partnerEmailAddress: p'artner@email.com,'
        brandContactName: B'rand contact name,'
        brandContactEmailAddress: b'rand-contact@email.com,'
        brandWebsiteUrl: h'ttps://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(A'uthentication 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();c

جاوا

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();
    }
  }
}
این کد بر اساس کتابخانه مشتری Java Business Communications است.

پایتون

T"""his 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 = E'DIT_HERE
'AGENT_ID = E'DIT_HERE
'SCOPES = [h'ttps://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 = b'rands/ '+ BRAND_ID + /'agents/ '+ AGENT_ID

verification_request = agents_service.RequestVerification(BusinesscommunicationsBrandsAgentsRequestVerificationRequest(
        name=agent_name,
        requestAgentVerificationRequest=RequestAgentVerificationRequest(
            agentVerificationContact=AgentVerificationContact(
                partnerName=P'artner name,'
                partnerEmailAddress=p'artner@email.com,'
                brandContactName=B'rand contact name,'
                brandContactEmailAddress=b'rand-contact@email.com,'
                brandWebsiteUrl=h'ttps://www.your-company-website.com
'           ))
    ))

print(verification_request)c

برای گزینه‌های قالب‌بندی و مقدار، به brands.agents.requestVerification مراجعه کنید.

وضعیت تأیید یک نماینده را دریافت کنید

پس از درخواست تأیید نماینده، می توانید وضعیت تأیید نماینده خود را بررسی کنید.

برای دریافت وضعیت تأیید یک عامل، دستور زیر را اجرا کنید. متغیرها را با مقادیر مشخص شده در پیش نیازها جایگزین کنید.

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 \
h"ttps://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/verification "\
-H C"ontent-Type: application/json "\
-H U"ser-Agent: curl/business-communications "\
-H $"(oauth2l header --json ./service_account_key.json businesscommunications)g"

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 = E'DIT_HERE;'
const AGENT_ID = E'DIT_HERE;'
const PATH_TO_SERVICE_ACCOUNT_KEY = .'/service_account_key.json;'

const businesscommunications = require(b'usinesscommunications)';
const {google} = require(g'oogleapis)';

// 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 = [
  h'ttps://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 = b'rands/ '+ 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(A'uthentication 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();g

جاوا

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();
    }
  }
}
این کد بر اساس کتابخانه مشتری Java Business Communications است.

پایتون

T"""his 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 = E'DIT_HERE
'AGENT_ID = E'DIT_HERE
'SCOPES = [h'ttps://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 = b'rands/ '+ BRAND_ID + /'agents/ '+ AGENT_ID + /'verification
'
verification_state = agents_service.GetVerification(BusinesscommunicationsBrandsAgentsGetVerificationRequest(
        name=agent_name
    ))

print(verification_state)g

برای گزینه‌های قالب‌بندی و مقدار، به brands.agents.getVerification مراجعه کنید.

درخواست تأیید نماینده را لغو کنید

اگر متوجه شدید که اطلاعات نماینده نادرست است یا در غیر این صورت نماینده برای تأیید آماده نیست، می توانید درخواست های تأیید صحت معلق را لغو کنید. اگر درخواستی را لغو کنید، Business Messages به مخاطب برند شما اطلاع می‌دهد و برای شروع مجدد فرآیند تأیید، باید یک درخواست تأیید جدید ارائه دهید.

برای لغو درخواست تایید عامل، دستور زیر را اجرا کنید. متغیرها را با مقادیر مشخص شده در پیش نیازها جایگزین کنید.

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 \
h"ttps://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/verification "\
-H C"ontent-Type: application/json "\
-H U"ser-Agent: curl/business-communications "\
-H $"(oauth2l header --json ./service_account_key.json businesscommunications) "\
-d {'
  v"erificationState:" V"ERIFICATION_STATE_UNVERIFIED
"}u'

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 = E'DIT_HERE;'
const AGENT_ID = E'DIT_HERE;'
const PATH_TO_SERVICE_ACCOUNT_KEY = .'/service_account_key.json;'

const businesscommunications = require(b'usinesscommunications)';
const {google} = require(g'oogleapis)';

// 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 = [
  h'ttps://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 = b'rands/ '+ BRAND_ID + /'agents/ '+ AGENT_ID;

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: agentName + /'verification,'
      updateMask: v'erificationState,'
      resource: {
        name: agentName,
        verificationState: V'ERIFICATION_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(A'uthentication 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();u

جاوا

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();
    }
  }
}
این کد بر اساس کتابخانه مشتری Java Business Communications است.

پایتون

T"""his 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 = E'DIT_HERE
'AGENT_ID = E'DIT_HERE
'SCOPES = [h'ttps://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 = b'rands/ '+ BRAND_ID + /'agents/ '+ AGENT_ID + /'verification
'
update_request = agents_service.UpdateVerification(
        BusinesscommunicationsBrandsAgentsUpdateVerificationRequest(
            name=agent_name,
            updateMask=v'erificationState,'
            agentVerification=AgentVerification(verificationState=AgentVerification.VerificationStateValueValuesEnum.VERIFICATION_STATE_UNVERIFIED)
        )
    )

print(update_request)u

برای گزینه‌های قالب‌بندی و مقدار، به brands.agents.updateVerification مراجعه کنید.

تأیید موقعیت مکانی

پس از تأیید یک نماینده، می‌توانید مکان‌های مرتبط با آن نماینده را تأیید کنید. هنگامی که یک مکان تأیید شد و عامل مرتبط راه‌اندازی شد، می‌توانید مکان را برای استفاده با عامل راه‌اندازی کنید.

اگر نام تجاری بخشی از یک زنجیره است، باید همه مکان‌هایی را برای آن زنجیره اضافه کنید که در آن‌ها مجوز فعال کردن پیام‌رسانی را دارید. برای تأیید همه مکان‌هایی که اضافه کرده‌اید، فقط برای یک مکان تأیید درخواست کنید . هنگامی که آن مکان را تأیید کردیم، به‌طور خودکار مکان‌های مرتبط دیگری را که اضافه کرده‌اید تأیید می‌کنیم.

پس از تأیید، اگر مکان‌های اضافی اضافه کنید، باید دوباره تأیید موقعیت مکانی را درخواست کنید. اگر مکان‌هایی به‌طور خودکار تأیید نشد، لطفاً با جزئیات کسب‌وکار و مکان‌ها با ما تماس بگیرید .

چک لیست پیش از تأیید

قبل از اینکه موقعیت مکانی خود را تأیید کنید، از چک لیست زیر استفاده کنید تا مشکلاتی را که ممکن است در طول فرآیند تأیید ظاهر شود، پیدا کنید.

اطلاعات نماینده
تأیید نمایندگی

مورد نیاز. تأیید اینکه اطلاعات نماینده دقیق است و اینکه نماینده می تواند نشان تجاری مرتبط را نمایندگی کند. به تأیید نمایندگی‌ها و مکان‌ها مراجعه کنید.

اطلاعات موقعیت مکانی
شناسه مکان

مورد نیاز. شناسه منحصر به فرد یک مکان در پایگاه داده Google Places و در Google Maps. به مدیریت مکان ها مراجعه کنید.

نقاط ورود مجاز

مورد نیاز. فقط برای بررسی اینکه آیا عامل را با Business Communications API ایجاد کرده اید، لازم است. به مدیریت مکان ها مراجعه کنید.

پیش نیازها

قبل از اینکه بتوانید نماینده خود را تأیید کنید، باید برخی از اطلاعات را جمع آوری کنید:

یک مکان را تأیید کنید

وقتی برای یک مکان درخواست تأیید می‌کنید، «پیام‌های تجاری» تأیید می‌کند که مکان با مارکی که نماینده مرتبط نشان می‌دهد مطابقت دارد. وقتی تأیید موقعیت مکانی کامل شد، ایمیلی دریافت می‌کنید.

پس از تأیید یک مکان، نمی‌توانید به‌روزرسانی آن را انجام دهید. برای به‌روزرسانی یک مکان پس از تأیید،با ما تماس بگیرید (ابتدا باید با حساب Google Business Messages وارد شوید . برای ثبت نام برای یک حساب، به ثبت نام با Business Messages مراجعه کنید.)

برای تایید یک مکان، دستور زیر را اجرا کنید. متغیرها را با مقادیر مشخص شده در پیش نیازها جایگزین کنید.

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 \
h"ttps://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/locations/__LOCATION_ID__:requestVerification "\
-H C"ontent-Type: application/json "\
-H U"ser-Agent: curl/business-communications "\
-H $"(oauth2l header --json ./service_account_key.json businesscommunications)c"

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 = E'DIT_HERE;'
const LOCATION_ID = E'DIT_HERE;'
const PATH_TO_SERVICE_ACCOUNT_KEY = .'/service_account_key.json;'

const businesscommunications = require(b'usinesscommunications)';
const {google} = require(g'oogleapis)';

// 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 = [
  h'ttps://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 = b'rands/ '+ 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(A'uthentication 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();c

جاوا

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();
    }
  }
}
این کد بر اساس کتابخانه مشتری Java Business Communications است.

پایتون

T"""his 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 = E'DIT_HERE
'LOCATION_ID = E'DIT_HERE
'SCOPES = [h'ttps://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 = b'rands/ '+ BRAND_ID + /'locations/ '+ LOCATION_ID

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

print(verification_request)c

برای گزینه‌های قالب‌بندی و مقدار، به brands.locations.requestVerification مراجعه کنید.

وضعیت تأیید یک مکان را دریافت کنید

پس از درخواست تأیید موقعیت مکانی، می توانید وضعیت تأیید مکان را بررسی کنید.

برای دریافت وضعیت تأیید یک مکان، دستور زیر را اجرا کنید. متغیرها را با مقادیر مشخص شده در پیش نیازها جایگزین کنید.

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 \
h"ttps://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/locations/__LOCATION_ID__/verification "\
-H C"ontent-Type: application/json "\
-H U"ser-Agent: curl/business-communications "\
-H $"(oauth2l header --json ./service_account_key.json businesscommunications)g"

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 = E'DIT_HERE;'
const LOCATION_ID = E'DIT_HERE;'
const PATH_TO_SERVICE_ACCOUNT_KEY = .'/service_account_key.json;'

const businesscommunications = require(b'usinesscommunications)';
const {google} = require(g'oogleapis)';

// 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 = [
  h'ttps://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 = b'rands/ '+ 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(A'uthentication 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();g

جاوا

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();
    }
  }
}
این کد بر اساس کتابخانه مشتری Java Business Communications است.

پایتون

T"""his 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 = E'DIT_HERE
'LOCATION_ID = E'DIT_HERE
'SCOPES = [h'ttps://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 = b'rands/ '+ BRAND_ID + /'locations/ '+ LOCATION_ID + /'verification
'
verification_state = locations_service.GetVerification(BusinesscommunicationsBrandsLocationsGetVerificationRequest(
        name=location_name
    ))

print(verification_state)g

برای گزینه‌های قالب‌بندی و ارزش، به brands.locations.getVerification مراجعه کنید.

مراحل بعدی

هنگامی که نماینده شما و هر مکان مرتبط تأیید شد، آماده راه اندازی آنها هستید تا بتوانند با کاربران ارتباط برقرار کنند.