Graph API Version

    Request Phone Verification Code

    Use this edge to request a code to verify a phone number.

    Use the WhatsApp Business Account > Phone Numbers endpoint to get a phone number's ID. See Retrieve Phone Numbers for usage details.

    Reading

    You can't perform this operation on this endpoint.

    Creating

    Example

    Requirements

    • whats_app_business_account_to_number_current_status_id. This is retrieved by getting the id from this call
    • whatsapp_business_management permission

    • whatsapp_business_messaging permission

    • public_profile permission

    • USER ACCESS TOKEN

    Request

    Formatted for readability.

    curl -i -X POST \
    "https://graph.facebook.com/LATEST-VERSION/WHATS-APP-BUSINESS-ACCOUNT-TO-NUMBER-CURRENT-STATUS-ID/request_code?
    code_method=SMS&
    language=en_US&
    access_token=USER-ACCESS-TOKEN"
    GraphRequest request = GraphRequest.newPostRequest(
      accessToken,
      "/WHATS-APP-BUSINESS-ACCOUNT-TO-NUMBER-CURRENT-STATUS-ID/request_code",
      new JSONObject("{\"code_method\":\"SMS\",\"language\":\"en_US\"}"),
      new GraphRequest.Callback() {
        @Override
        public void onCompleted(GraphResponse response) {
          // Insert your code here
        }
    });
    request.executeAsync();
    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
        initWithGraphPath:@"/WHATS-APP-BUSINESS-ACCOUNT-TO-NUMBER-CURRENT-STATUS-ID/request_code"
               parameters:@{ @"code_method": @"SMS",@"language": @"en_US",}
               HTTPMethod:@"POST"];
    [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        // Insert your code here
    }];

    Response

    {
      "success": true
    }
    You can make a POST request to request_code edge from the following paths:
    When posting to this edge, no Graph object will be created.

    Parameters

    ParameterDescription
    code_method
    enum {SMS, VOICE}

    method in which the code should be received, SMS or VOICE.

    Required
    language
    locale string

    locale in which the code should be received in standard format, eg: en_US

    Required

    Return Type

    Struct {
    success: bool,
    }

    Error Codes

    ErrorDescription
    136024Request code error
    100Invalid parameter

    Updating

    You can't perform this operation on this endpoint.

    Deleting

    You can't perform this operation on this endpoint.