$attachment->setFileName(filename_from_url($url)); $attachment->setData(file_get_contents($url)); $client->createAttachment($attachment); $attachments[] = $attachment; } } // Create the customer $customer = new \HelpScout\model\ref\CustomerRef(); $customer->setId(null); $customer->setEmail($row['email']); $customer->setFirstName($row['f_name']); $customer->setLastName($row['l_name']); // Create the conversation $conversation = new \HelpScout\model\Conversation(); $conversation->setSubject($row['reason'] . ': ' . $row['subject']); $conversation->setCreatedAt(format_api_date($row['date'])); $conversation->setMailbox($mailbox); $conversation->setCustomer($customer); $conversation->setType('email'); $tags = array('backlog', strtolower($row['reason'])); if ($row['extension'] == 'Yes') { $tags[] = strtolower($row['extension_name']); } $conversation->setTags($tags); // A conversation must have at least one thread $thread = new \HelpScout\model\thread\Customer(); $thread->setCreatedAt(format_api_date($row['date'])); $body = '<strong>Website: </strong>' . $row['website'] . "\r\n"; if ($row['extension'] == 'Yes') { $body .= '<strong>Extension: </strong>' . $row['extension_name'] . "\r\n"; }