The best way to understand and test this is the following
http://phabricator.yourhost.com/conduit/method/feed.query/
click [call method]
This will return a list of changes that you will be interested in: "objectPHID": "PHID-DREV-xxxxxxx",
...
Now http://phabricator.yourhost.com/conduit/method/differential.query/
set phids => ["PHID-DREV-xxxxxxx"]
...
This will return "authorPHID": "PHID-USER-xxxxx", and "reviewers": ["xxxx","xxxx","xxxx"]
...
I also suggest reviewing /src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php
Now the code
$stories = $this->getConduit()->callMethodSynchronous(
'feed.query',
array(
'limit' => $config_page_size,
'after' => $chrono_key_cursor,
'view' => 'text',
)
);
foreach ($stories as $story) {
$objects = $this->getConduit()->callMethodSynchronous(
'phid.lookup',
array(
'names' => array($story['objectPHID']),
)
);
$diff_query_results = $this->getConduit()->callMethodSynchronous(
'differential.query',
array(
'phids' => array($story['objectPHID']),
));
foreach ($diff_query_results as $diff_query) {
$authorResults = $this->getConduit()->callMethodSynchronous(
'phid.lookup',
array(
'names' => array($diff_query['authorPHID']),
)
);
$message .= ' '.$objects[$story['objectPHID']]['uri'];
foreach ($authorResults as $author) {
$authorName = $author['name'];
print_r ($authorName);
}
$reviewersResults = $this->getConduit()->callMethodSynchronous(
'phid.lookup',
array(
'names' => $diff_query['reviewers'],
)
);
foreach ($reviewersResults as $reviewer) {
$reviewerName = $reviewer['name'];
print_r ($reviewerName );
}
}