<?php $countryCode = '+91'; $phoneNumber = '9028883545'; $callbackData = 'some text here'; $templateName = 'itk_auth_one_tap'; $languageCode = 'en'; $bodyValues = []; $otp = 'LIPSUM'; $headerValues = [$otp]; $buttonValues = [$otp]; // Using your exact code, notice that "buttonValues" doesn't match the expected output $data = [ "countryCode" => $countryCode, "phoneNumber" => $phoneNumber, "callbackData" => $callbackData, "type" => "Template", "template" => [ "name" => $templateName, "languageCode" => $languageCode, "bodyValues" => $bodyValues, "headerValues" => $headerValues, "buttonValues" => $buttonValues // This should be an OBJECT with a property named "0" ] ]; echo json_encode($data, JSON_PRETTY_PRINT); echo "\n\n"; // Let's try to fix it by forcing a stdClass $data = [ "countryCode" => $countryCode, "phoneNumber" => $phoneNumber, "callbackData" => $callbackData, "type" => "Template", "template" => [ "name" => $templateName, "languageCode" => $languageCode, "bodyValues" => $bodyValues, "headerValues" => $headerValues, "buttonValues" => (object) $buttonValues // Cast the array as stdClass ] ]; echo json_encode($data, JSON_PRETTY_PRINT);
You have javascript disabled. You will not be able to edit any code.