hello all,
I would like to check if people here on the forum can help us, we are trying to use the API to send Rich_text as bold, mention, italic… but we are not succeeding, below is the code we are using. We check several postings but none were so specific.
below code we are using
<?php
require_once('asana_task/asana.php');
$taskName = "XXXXX";
$tagName = "XXXXX";
$dueDate = "XXXXX";
$file = "XXXXX";
$imgName = "XXXX";
$wMsg = '<body>this is <b><i>testing</i></b></body>';
$asanaToken = "XXXXXXXXXXXXX";
$workspaceId = 'XXXXXXX'; // The workspace where we want to create our task
$projectId = 'XXXXXXXX'; // The project where we want to save our task
$assigneeID = 'XXXXXXXXXXX'; // [Carlos Eduardo]
$result = $asana->createTask(array(
'workspace' => $workspaceId, // Workspace ID
'name' => $taskName, // Name of task
'notes' => $taskName.' Created via Portal', // Notes
'tags' => $tagName,
'due_on' => $dueDate,
'assignee' => $assigneeID,
'followers' => array('XXXXXXXXX','XXXXXXXXX','XXXXXXXXX'),
));
// As Asana API documentation says, when a task is created, 201 response code is sent back so...
if ($asana->hasError()) {
echo 'Error while trying to connect to Asana, response code: ' . $asana->responseCode;
return;
}
$taskId = $asana->getData()->gid; // Here we have the id of the task that have been created
// Now we do another request to add the task to a project
$asana->addProjectToTask($taskId, $projectId);
$file_data = array('file'=>$file,'finalFilename'=>$imgName,'mimeType'=>'image/jpeg');
$asana->addAttachmentToTask($taskId,$file_data);
$asana->commentOnTask($taskId,array('html_text' => $wMsg)); //post message
if ($asana->hasError()) {
echo '<font color="#FF0000">Error occurred: '.$asana->responseCode.'. Error while posting data on ASANA.</font>'; //Error while assigning project to task:
exit;
} else {
echo 'Success';
exit;
}
### END : Post on Asana
?>