26 $messageFields[
'CONNECTOR'] = Library::ID_EDNA_WHATSAPP_CONNECTOR;
28 $messageFields[
'imSubject'] = $messageFields[
'subjectId'];
29 $messageFields[
'address'] = $messageFields[
'subscriber'][
'identifier'];
30 $messageFields[
'userName'] = $messageFields[
'userInfo'][
'userName'];
31 $messageFields[
'firstName'] = $messageFields[
'userInfo'][
'firstName'];
32 $messageFields[
'lastName'] = $messageFields[
'userInfo'][
'lastName'];
33 $messageFields[
'avatarUrl'] = $messageFields[
'userInfo'][
'avatarUrl'];
34 $messageFields[
'imType'] =
'whatsapp';
36 $messageFields[
'contentType'] = mb_strtolower($messageFields[
'messageContent'][
'type']);
37 if (isset($messageFields[
'messageContent'][
'text']))
39 $messageFields[
'text'] =
Emoji::decode($messageFields[
'messageContent'][
'text']);
42 if (isset($messageFields[
'messageContent'][
'attachment']) && is_array($messageFields[
'messageContent'][
'attachment']))
44 $messageFields[
'attachmentUrl'] = $messageFields[
'messageContent'][
'attachment'][
'url'];
45 $messageFields[
'attachmentName'] = $messageFields[
'messageContent'][
'attachment'][
'name'];
48 if (isset($messageFields[
'messageContent'][
'caption']) && !is_null($messageFields[
'messageContent'][
'caption']))
50 $messageFields[
'caption'] =
Emoji::decode($messageFields[
'messageContent'][
'caption']);
53 return $messageFields;