Send a notification to a set of users. You can send emails to users that have added the application without any confirmation, or you can direct a user of your application to the URL returned by this function to email users who have not yet added your application. You can also send messages to the users' notification page without needing any confirmation.
| Type | Name | Required | Description |
|---|---|---|---|
string
| api_key | ✔ | The application key associated with the calling application. |
string
| session_key | ✔ | The session key of the logged in user. |
string
| community | ✔ | Community system name. Use up.community.getList method to retrieve available communities. |
string
| sig | ✔ | An MD5 hash of the current request and your secret key, as described in the authentication guide. |
string
| format | Desired response format. Either XML (default) or JSON.
| |
array
| to_ids | ✔ | Comma-separated list of recipient ids. These must be either friends of the logged-in user or people who have added your application. To send a notification to the current logged in user without a name prepended to the message, set to_ids to the empty string. |
string
| content | ✔ | Notification content |
<?xml version="1.0" encoding="UTF-8"?> <notifications_send_response>1</notifications_send_response>
| Code | Description |
|---|---|
| 1 | An unknown error occurred. Please resubmit the request. |
| 2 | The service is not available at this time. |
| 4 | The application has reached the maximum number of requests allowed. More requests are allowed once the time window has completed. |
| 5 | The request came from a remote address not allowed by this application. |
| 100 | Invalid parameter |
| 101 | The api key submitted is not associated with any known application. |
| 102 | The session key was improperly submitted or has reached its timeout. Direct the user to log in again to obtain another key. |
| 103 | The submitted call_id was not greater than the previous call_id for this session. |
| 104 | Incorrect signature. |
Then change this line (256) in notifications_send from -
256: array('to_ids' => $to_ids, 'markup' => $markup, 'no_email' => $no_email));
To -
256: array('to_ids' => $to_ids, 'notification' => $markup, 'email' => $no_email));
This is needed otherwise the script will always return Invalid Paramater, with this change the send will work.
For line breaks use
as the mail is intended for HTML email clients only. See example email source below:
--b1_df52415e91cd869f3947877c5dd0587a Content-Type: text/plain; charset = "UTF-8" Content-Transfer-Encoding: 8bit This message contains a rich-text HTML portion. Consult your mail client's documentation for infomation on how to view it. --b1_df52415e91cd869f3947877c5dd0587a Content-Type: text/html; charset = "UTF-8" Content-Transfer-Encoding: 8bit Fred Bloggs says Hi! --b1_df52415e91cd869f3947877c5dd0587a--