التحقُّق من صحة معلومات الوكيل أو الموقع الجغرافي

بعد إنشاء وكيل رسائل تجارية لعلامة تجارية تُديرها وتنهي معلومات الوكيل، يمكنك التحقُّق من الوكيل وأي مواقع مرتبطة به. عليك التحقّق من الوكلاء والمواقع الجغرافية قبل أن يتمكّنوا من إطلاقها.

تأكيد معلومات الوكيل

عند التحقّق من صحة معلومات أحد الوكلاء، تؤكّد ميزة "الرسائل التجارية" معلومات الوكيل مع جهة اتصال من العلامة التجارية التي يمثّلها. بعد أن تؤكّد جهة الاتصال الخاصة بالعلامة التجارية أنّه يمكنك تمثيل العلامة التجارية مع الوكيل ومن صحة معلومات الوكيل، يتم إثبات هوية الوكيل.

قائمة تحقّق ما قبل التحقّق

قبل التحقّق من صحة معلومات الوكيل، استخدِم قائمة التحقق التالية لرصد أي مشاكل قد تظهر أثناء عملية إثبات الهوية.

معلومات الوكيل
اسم الوكيل

إنّ هذه السمة مطلوبة. اسم الوكيل كما يظهر للمستخدمين. يمكنك الاطّلاع على إنشاء وكيل.

شعار الوكيل

إنّ هذه السمة مطلوبة. شعار الوكيل، كما يظهر للمستخدمين يمكنك الاطّلاع على إنشاء وكيل.

مدى توفُّر المراسلة

إنّ هذه السمة مطلوبة. الأيام والأوقات التي يكون فيها موظّفو الدعم متاحين للردّ على المستخدمين. يمكنك الاطّلاع على تحديد مدى توفّر المراسلة.

معلومات غير محلية

سمة مطلوبة لنقاط الدخول غير المحلية. النطاقات الخاصة بوكيل المستخدم وأرقام الهواتف ومناطق الإطلاق المتاحة راجِع إعداد المعلومات غير المحلية.

اللغة التلقائية

إنّ هذه السمة مطلوبة. اللغة التي يتواصل فيها الوكيل عادةً. راجِع الأقلمة واللغات.

ضبط OAuth

اختياري: تفاصيل حول تكامل بروتوكول OAuth مع الوكيل مع المنتجات الأخرى راجِع المصادقة باستخدام OAuth.

نقاط الدخول المسموح بها

إنّ هذه السمة مطلوبة. يجب التحقق مما إذا كنت قد أنشأت الوكيل باستخدام Business Communications API فقط. يمكنك الاطّلاع على إنشاء وكيل.

بعد إثبات هوية الوكيل، يمكنك تعديل العناصر التالية فقط:

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

إذا كنت بحاجة إلى تعديل الحقول المخصّصة للقراءة فقط بعد التحقّق من صحة معلومات الوكيل، يمكنك التواصل معنا (يجب أولاً تسجيل الدخول باستخدام حساب Google للرسائل التجارية. للتسجيل للحصول على حساب، راجِع التسجيل باستخدام رسائل الأنشطة التجارية.)

المتطلبات الأساسية

قبل أن تتمكّن من التحقّق من صحة معلومات الوكيل، عليك جمع بعض المعلومات:

  • موظّف الدعم name

    إذا لم تكن تعرف اسم الوكيل، يمكنك الاطّلاع على إدراج كل الوكلاء لعلامة تجارية.

  • المسار إلى مفتاح حساب خدمة مشروع Google Cloud Platform على جهاز التطوير

  • اسم الشريك (اسم مؤسستك)
  • عنوان البريد الإلكتروني للشريك (عنوان بريدك الإلكتروني)
  • الموقع الإلكتروني للعلامة التجارية التي يمثّلها الوكيل، كعنوان URL متاح للجميع يبدأ بـ "https:// "
  • اسم جهة الاتصال وعنوان بريدها الإلكتروني (عادةً ما يشاركان نطاقًا مع الموقع الإلكتروني للعلامة التجارية) لالعلامة التجارية التي يمثّلها الوكيل الذي يمكنه إثبات علاقتك التجارية مع العلامة التجارية وعلايتك لتمثيل العلامة التجارية

التحقُّق من صحة معلومات الوكيل

عند طلب إثبات هوية الوكيل، ترسل ميزة "الرسائل التجارية" رسالة إلكترونية إلى العلامة التجارية التي تحدّدها لتأكيد معلومات وكيلك.

عندما تتحقق جهة اتصال العلامة التجارية من معلومات وكيلك وتتحقّق ميزة "الرسائل التجارية" من الوكيل، ستتلقى رسالة إلكترونية.

للتحقُّق من صحة أحد الوكلاء، شغِّل الأمر التالي. استبدِل المتغيّرات بالقيم المحدّدة في المتطلبات الأساسية.

عنوان 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();
    }
  }
}
يستند هذا الرمز إلى مكتبة برامج Java Business اتصالات.

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)

لمعرفة خيارات التنسيق والقيمة، يُرجى الاطّلاع على 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 \
"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();
    }
  }
}
يستند هذا الرمز إلى مكتبة برامج Java Business اتصالات.

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)

لمعرفة خيارات التنسيق والقيمة، يُرجى الاطّلاع على brands.agents.getVerification.

إلغاء طلب إثبات هوية موظّف الدعم

إذا تبيّن لك أنّ معلومات الوكيل غير صحيحة أو أنّ الوكيل ليس جاهزًا لإثبات الهوية، يمكنك إلغاء طلبات إثبات الهوية المعلّقة. إذا ألغيت طلبًا ما، تُرسِل ميزة "الرسائل التجارية" إشعارًا إلى جهة الاتصال الخاصة بعلامتك التجارية، وعليك تقديم طلب جديد لإثبات الملكية حتى تتمكّن من إعادة إجراء عملية إثبات الملكية.

لإلغاء طلب إثبات هوية موظّف الدعم، شغِّل الأمر التالي. استبدِل المتغيّرات بالقيم المحدّدة في المتطلبات الأساسية.

عنوان 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();
    }
  }
}
يستند هذا الرمز إلى مكتبة برامج Java Business اتصالات.

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)

لمعرفة خيارات التنسيق والقيمة، يُرجى الاطّلاع على brands.agents.updateVerification.

إثبات ملكية الموقع الجغرافي

بعد التحقّق من صحة معلومات أحد الوكلاء، يمكنك التحقّق من المواقع الجغرافية المرتبطة بهذا الوكيل. بعد إثبات ملكية موقع جغرافي وإطلاق الوكيل المرتبط، يمكنك إطلاق الموقع الجغرافي لاستخدامه مع الوكيل.

إذا كانت العلامة التجارية جزءًا من سلسلة، يجب إضافة جميع المواقع الجغرافية لهذه السلسلة التي تملك الإذن لتفعيل المراسلة فيها. لإثبات ملكية جميع المواقع الجغرافية التي أضفتها، يمكنك طلب إثبات الملكية لموقع جغرافي واحد فقط. بعد أن نثبت ملكية هذا الموقع الجغرافي، سنتحقق تلقائيًا من المواقع الجغرافية المرتبطة الأخرى التي أضفتها.

وبعد إثبات الملكية، إذا أضفت مواقع جغرافية إضافية، ستحتاج إلى طلب إثبات ملكية الموقع الجغرافي مرة أخرى. وإذا لم يتم إثبات ملكية أي مواقع جغرافية تلقائيًا، يُرجى التواصل معنا مع تقديم تفاصيل النشاط التجاري والمواقع الجغرافية.

قائمة تحقّق ما قبل التحقّق

قبل إثبات ملكية موقعك الجغرافي، استخدِم قائمة التحقق التالية لرصد أي مشاكل قد تظهر أثناء عملية إثبات الملكية.

معلومات الوكيل
التحقُّق من صحة معلومات الوكيل

إنّ هذه السمة مطلوبة. التحقّق من أنّ معلومات الوكيل دقيقة وأنّ الوكيل يمكن أن يمثّل العلامة التجارية المرتبطة راجِع التحقُّق من الوكلاء والمواقع الجغرافية.

معلومات الموقع الجغرافي
رقم تعريف المكان

إنّ هذه السمة مطلوبة. المعرّف الفريد لموقع جغرافي في قاعدة بيانات "أماكن Google" وعلى "خرائط Google". يُرجى الاطّلاع على إدارة المواقع الجغرافية.

نقاط الدخول المسموح بها

إنّ هذه السمة مطلوبة. ويكون هذا ضروريًا فقط للتحقق مما إذا كنت قد أنشأت الوكيل باستخدام Business Communications API. يُرجى الاطّلاع على إدارة المواقع الجغرافية.

المتطلبات الأساسية

قبل أن تتمكّن من التحقّق من صحة معلومات الوكيل، عليك جمع بعض المعلومات:

إثبات ملكية موقع جغرافي

عندما تطلب إثبات ملكية موقع جغرافي، تؤكّد ميزة "الرسائل التجارية" أنّ الموقع الجغرافي يتطابق مع العلامة التجارية التي يمثّلها الوكيل المرتبط بها. ستصلك رسالة إلكترونية عند اكتمال عملية إثبات ملكية الموقع الجغرافي.

وبعد إثبات ملكية موقع جغرافي، لا يمكنك إجراء أي تعديلات عليه. لإجراء تعديلات على موقع جغرافي بعد إثبات ملكيته، التواصل معنا (يجب أولاً تسجيل الدخول باستخدام حساب Google للرسائل التجارية. للتسجيل للحصول على حساب، راجِع التسجيل باستخدام رسائل الأنشطة التجارية.)

لإثبات ملكية موقع جغرافي، شغِّل الأمر التالي. استبدِل المتغيّرات بالقيم المحدّدة في المتطلبات الأساسية.

عنوان 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();
    }
  }
}
يستند هذا الرمز إلى مكتبة برامج Java Business اتصالات.

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)

لمعرفة خيارات التنسيق والقيمة، يُرجى الاطّلاع على 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 \
"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();
    }
  }
}
يستند هذا الرمز إلى مكتبة برامج Java Business اتصالات.

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)

لمعرفة خيارات التنسيق والقيمة، يُرجى الاطّلاع على brands.locations.getVerification.

الخطوات اللاحقة

بعد التحقُّق من الوكيل الذي تتعامل معه وأي مواقع جغرافية مرتبطة به، يمكنك إطلاقها حتى يتمكّن المستخدمون من التواصل.