Sms.send

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

This method sends a given text message (SMS) to the user. Does NOT require an active session, can be sent asynchronously.

Parameters

RequiredNameTypeDescription
required api_key string The application key associated with the calling application. If you specify the API key in your client, you don't need to pass it with every call.
call_id float The request's sequence number. Each successive call for any session must use a sequence number greater than the last. We suggest using the current time in milliseconds, such as PHP's microtime(true) function. If you specify the call ID in your client, you don't need to pass it with every call.
sig string An MD5 hash of the current request and your secret key, as described in the How Facebook Authenticates Your Application. Facebook computes the signature for you automatically.
v string This must be set to 1.0 to use this version of the API. If you specify the version in your client, you don't need to pass it with every call.
session_key string The session key of the user who may have added the application.
optional format string The desired response format, which can be either XML or JSON. (Default value is XML.)
callback string Name of a function to call. This is primarily to enable cross-domain JavaScript requests using the <script> tag, also known as JSONP, and works with both the XML and JSON formats. The function will be called with the response passed as the parameter.
uid uid The user ID of the user who may have enabled SMS for the application. If this parameter is not specified, then it defaults to the session user.
message string The content of the text message to send.
session_id int The session ID that identifies whether the application is responding to a user generated message.
req_session bool Indicates whether to request a session if the application has an expectation that a user may reply to this SMS directly. In this case a session id is generated and passed back to the application for its book keeping. If a session id is not requested, the message is sent to the user through a generic number and any replies to that message will be forwarded along with no guarantee of corresponding to a specific outbound message.

Response

This method returns 0 on success and req_session is false, or the session_id that was created.

Error Codes

CodeDescription
1 Unknown exception.
270 Permissions disallow SMS to the user.
850 Invalid session_id expired session (response message).
851 Invalid SMS length.
852 User has met the quota (unsolicited message).
854 Over application daily SMS quota/rate limit.
855 User is not registered for Facebook Mobile Texts.
856 User has SMS notifications turned off.
857 SMS application disallowed by mobile operator.

See Also

reference