/**
* Sends a notification to the specified users.
*
+ * @param mixed $to_ids Either an array of uids or a string
+ * delimited list of uids.
+ * @param string $notification A FBML string for the notification.
+ * @param string $type Either 'user_to_user' or 'app_to_user'
+ *
* @throws Horde_Service_Facebook_Exception
* @return A comma separated list of successful recipients
- * @error API_EC_PARAM_USER_ID_LIST
*/
public function &send($to_ids, $notification, $type)
{
Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
}
- return $this->callMethod('facebook.notifications.send',
+ return $this->_facebook->callMethod('facebook.notifications.send',
array('to_ids' => $to_ids,
'notification' => $notification,
'type' => $type,
throw new Horde_Service_Facebook_Exception('session_key is required',
Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
}
- return $this->callMethod('facebook.notifications.sendEmail',
+ return $this->_facebook->callMethod('facebook.notifications.sendEmail',
array('recipients' => $recipients,
'subject' => $subject,
'text' => $text,
*/
protected function _finalizeParams($method, &$params)
{
+ // Run through the params and see if any of them are arrays. If so,
+ // json encode them, as per the new Facebook API guidlines.
+ // http://www.facebook.com/developers/message.php#msg_351
+ foreach ($params as &$param) {
+ if (is_array($parm)) {
+ $param = json_endcode($param);
+ }
+ }
+
$this->_addStandardParams($method, $params);
// we need to do this before signing the params
$this->_convertToCsv($params);