Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Chatter Development
- :
- sending private message using chatter API
turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
0
sending private message using chatter API
[ Edited ]Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-04-2012 11:15 PM - edited 10-04-2012 11:18 PM
Hi,
i am using chatter REST API to send private messages to users, but i am getting error saying:
Array
(
[0] => Array
(
[message] => Text parameter is missing or empty.
[errorCode] => MISSING_ARGUMENT
)
)
i am using the following code:
$response = json_decode($json_response, true);
$recepients = array();
$recepients['text'] = "sample text messge";
foreach ((array) $response['members'] as $members) {
$recepients['recipients'][] = $members['id'];
}
$params = json_encode($recepients);
$token_url = 'https://ap1.salesforce.com/services/data/v23.0/cha tter/users/me/messages';
$curl = curl_init($token_url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($params))
);
curl_setopt($curl, CURLOPT_HTTPHEADER,array("Authorization: OAuth $access_token"));

