카카오톡채널 관리자 api 문의

카카오톡 채널관리자 API문서를 보고 유저 파일을 생성하였습니다.
그리고 조회했을때로 정상적으로 제가 생성한 file_id 를 리턴 받습니다.

문제는 해당 file_id 로 유저를 추가하는 코드를 보냈을때는 아무런 반응이 없습니다.
API 문서에는 원래 리턴값은 없다 써있기는 하지만 아래의 이미지에는 등록 성공수나 친구수가 떠야 하지 않나요?
이미지 20

등록 시도수 조차도 변동이 없기에 왜 이런 것인지 궁금합니다.

제가 작성한 코드들을 아래 표기해 드립니다.

※고객파일 조회 소스코드
// 기록을 할 고객 파일을 조회합니다.
$hostUrl = “https://kapi.kakao.com”;
$requestUrl= “/v1/talkchannel/target_user_file”;
$KakaoAK = “9c452c30fc280cf2696b4864ecf103e9”;
$channel_public_id = “_xbxfyxeT”;
$url = $hostUrl.$requestUrl."?channel_public_id=".$channel_public_id;

//$schema = array(‘rType’=>‘string’,‘managerId’=>‘string’,‘cName’=>‘string’,‘cHp’=>‘string’,‘cOpen’=>‘string’,‘cLocal’=>‘string’);
//$schema_json = json_encode($schema);
//$data = array(‘channel_public_id’=>’_xbxfyxeT’,‘file_name’=>‘랜딩DB연동’,‘schema’=>$schema_json);
//$data_json = json_encode($data, JSON_UNESCAPED_UNICODE);

try {
$is_post = false;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers[] = "Authorization: KakaoAK " .$KakaoAK;
$headers[] = “Content-Type: application/json”;

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec ($ch);

$response = json_decode($response, true);

print_r($response);

} catch(Exception $E) {
echo "Response: ". $E->lastResponse . “\n”;
}

#유저정보 입력용 소스코스
// 고객 파일에 유저정보를 입력합니다.
$hostUrl = “https://kapi.kakao.com”;
$requestUrl= “/v1/talkchannel/update/target_users”;
$KakaoAK = “9c452c30fc280cf2696b4864ecf103e9”;
$channel_public_id = “_xbxfyxeT”;
$url = $hostUrl.$requestUrl;

$insertData = array(‘cTel’=>‘01074453305’, ‘cBrand’=>‘zero100’, ‘cDate’=>‘2019-10-31T16:08:34’, ‘cName’=>‘김테스트’, ‘cManager’=>‘홍길동’, ‘cStatus’=>‘배정’, ‘cLocal’=>‘서울’, ‘cOpen’=>‘6개월’, ‘cCate’=>‘pcQ’);

$fieldData = array();
$fieldData[] = array(‘id’=>‘01074453305’,‘field’=>$insertData);

$data = array(‘file_id’=>‘6401’,‘channel_public_id’=>$channel_public_id,‘user_type’=>‘app’,‘users’=>$fieldData);
$data_json = json_encode($data, JSON_UNESCAPED_UNICODE);

try {
$is_post = true;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers[] = "Authorization: KakaoAK " .$KakaoAK;
$headers[] = “Content-Type: application/json”;

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec ($ch);
$response = json_decode($response, true);

print_r($response);

} catch(Exception $E) {
echo "Response: ". $E->lastResponse . “\n”;
}

자세한 부분은 담당부서에 확인 요청해두었습니다.
올바른 userId가 아니거나 친구 상태가 아니면 update 되지 않을 수 있습니다.
update/delete 요청에 대한 응답이 현재는 void인데, api 하는 입장에선 불편함이 있을 것 같네요.
이 부분은 개선할 수 있을지 논의해보겠습니다.

안녕하세요?
‘user_type’=>‘app’ 이 앱으로 되어 있는데 유저 아이디가
01074453305 전번이라 사용자 전환이 제대로 되지 않아 등록성공수랑
친구수가 증가 하지 않은 것으로 보입니다.

의견 감사합니다. 해당 부분도 개선될 수 있으면 좋겠네요

1개의 좋아요

감사합니다. 덕분에 해결되었습니다 :slight_smile: