Versione API Graph

Whats App Business Account Conversation Analytics

Lettura

Enables one to retrieve the conversation based pricing analytics data for this WhatsApp Business Account

Example

Requirements

  • whatsapp_business_management permission

  • whatsapp_business_messaging permission

  • public_profile permission

  • WHATSAPP BUSINESS ACCOUNT ID

  • USER ACCESS TOKEN

Request

Formatted for readability.

curl -i -X GET \ 
"https://graph.facebook.com/LATEST-VERSION/WHATSAPP-BUSINESS-ACCOUNT-ID?fields=conversation_analytics.start(1651698000).end(1652302800).granularity(DAILY).phone_numbers(PHONE-NUMBER).country_codes().metric_types().conversation_types().conversation_directions().dimensions(CONVERSATION_DIRECTIONCONVERSATION_TYPECOUNTRYPHONE)&
access_token=USER-ACCESS-TOKEN"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/WHATSAPP-BUSINESS-ACCOUNT-ID",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("fields", "conversation_analytics.start(1651698000).end(1652302800).granularity(DAILY).phone_numbers(["PHONE-NUMBER "]).country_codes([]).metric_types([]).conversation_types([]).conversation_directions([]).dimensions(["CONVERSATION_DIRECTION","CONVERSATION_TYPE","COUNTRY","PHONE"])");
request.setParameters(parameters);
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/WHATSAPP-BUSINESS-ACCOUNT-ID"
           parameters:@{ @"fields": @"conversation_analytics.start(1651698000).end(1652302800).granularity(DAILY).phone_numbers(["PHONE-NUMBER"]).country_codes([]).metric_types([]).conversation_types([]).conversation_directions([]).dimensions(["CONVERSATION_DIRECTION","CONVERSATION_TYPE","COUNTRY","PHONE"])",}
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];

Response

{
  "conversation_analytics": {
    "data": [
      {
        "data_points": [
          {
            "start": 1651698000,
            "end": 1651784400,
            "conversation": 281,
            "phone_number": "PHONE-NUMBER",
            "country": "US",
            "conversation_type": "FREE_TIER",
            "conversation_direction": "BUSINESS_INITIATED",
            "cost": 0
          },
          {
            "start": 1652130000,
            "end": 1652216400,
            "conversation": 631,
            "phone_number": "PHONE-NUMBER",
            "country": "US",
            "conversation_type": "FREE_TIER",
            "conversation_direction": "BUSINESS_INITIATED",
            "cost": 0
          }
        ]
      }
    ]
  },
  "id": "WHATSAPP-BUSINESS-ACCOUNT-ID"
}

Parametri

ParametroDescrizione
conversation_categories
array<enum {MARKETING, UTILITY, AUTHENTICATION, SERVICE, AUTHENTICATION_INTERNATIONAL, MARKETING_LITE}>
Valore predefinito: []

list of conversation categories

conversation_directions
array<enum {UNKNOWN, BUSINESS_INITIATED, USER_INITIATED}>
Valore predefinito: []

list of conversation directions

conversation_types
array<enum {UNKNOWN, REGULAR, FREE_ENTRY_POINT, FREE_TIER}>
Valore predefinito: []

list of conversation types

country_codes
array<string>
Valore predefinito: []

list of country codes

dimensions
array<enum {UNKNOWN, PHONE, COUNTRY, CONVERSATION_TYPE, CONVERSATION_DIRECTION, CONVERSATION_CATEGORY}>
Valore predefinito: []

list of breakdown dimensions

end
int64

end time

Obbligatorio
granularity
enum {HALF_HOUR, DAILY, MONTHLY}

data granularity

Obbligatorio
metric_types
array<enum {UNKNOWN, CONVERSATION, COST}>
Valore predefinito: []

list of metric types

phone_numbers
array<string>
Valore predefinito: []

list of phone numbers

start
int64

start time

Obbligatorio

Campi

La lettura da questo segmento fornirà un risultato formattato JSON:

{ "data": [], "paging": {} }

data

Una lista di nodi WABAConversationAnalytics.

paging

Per ulteriori dettagli sulla paginazione, consulta la Guida su API Graph.

Error Codes

ErroreDescrizione
200008WhatsApp Business Account has no linked phone numbers.
100Invalid parameter

Creazione

Non puoi eseguire questa operazione in questo endpoint.

Aggiornamento

Non puoi eseguire questa operazione in questo endpoint.

Eliminazione

Non puoi eseguire questa operazione in questo endpoint.