Discussions

Ask a Question
Back to All

How can I catch the exact time that the avatar group creation is completed?

Hello,

I am using Flutter and try to create avatar group.

final url = Uri.parse('https://api.heygen.com/v2/photo_avatar/avatar_group/create');

final headers = {
'accept': 'application/json',
'Content-Type': 'application/json',
'X-Api-Key': _apiKey,
};

final body = json.encode({
"name": 'TestGroup',
"image_key": imageKey,
"generation_id": generationId,
});

final response = await http.post(url, headers: headers, body: body);
// {
// "error": null,
// "data": {
// "id": "8e673a2c992a46a3889eb2054c3b3fec", // avatar_id, group_id, AvatarGroupId(Dashboard)
// "image_url": "https://files2.heygen.ai/image/$imageKey/original?...",
// "created_at": 1737662355.643309,
// "name": "TestGroup",
// "status": "pending",
// "group_id": "8e673a2c992a46a3889eb2054c3b3fec",
// "is_motion": false,
// "motion_preview_url": null,
// "business_type": "generated", // "user_upload",
// "upscale_availability": {
// "available": false,
// "reason": "Photo avatar look upload not completed"
// },
// "upscaled": false,
// "background_sound_effect": null
// }
// }
if (kDebugMode) debugPrint('체크 > heygen_api_service > createAvatarGroup > response.body: ${response.body}');

However I always get the "pending" status.

So after calling the upper, when I call 'https://api.heygen.com/v2/video/generate', I always get {"data":null,"error":{"code":"photar_not_found","message":"Talking photo e6607ebd0ed14a56b0b53cf6d5380da0 not found"}} error.


final url = Uri.parse('https://api.heygen.com/v2/video/generate');

final headers = {
'X-Api-Key': _apiKey,
'Content-Type': 'application/json',
};

final body = json.encode({
"video_inputs": [
{
"character": {
"type": "talking_photo",
"talking_photo_id": cleanTalkingPhotoId,
},
"voice": {
"type": "text",
"input_text": text,
"voice_id": voiceId,
"speed": 1.1,
}
}
],
"dimension": {"width": 720, "height": 1280}
});

final response = await http.post(url, headers: headers, body: body);

{"data":null,"error":{"code":"photar_not_found","message":"Talking photo e6607ebd0ed14a56b0b53cf6d5380da0 not found"}}