|
OAuth method
|
|
|
|
Friends Inviter
|
- Add reference to the script file "StesCodes.js" file on your project, which helps to create formatted signature key
- Configure APP for Gmail, Yahoo and Windows Live to get API keys
- If you don't have signature key then use the trial signature key
- You can get the trial signature from here
-
Include the below in your project if you have analytics enabled.
<!-- analytics code starts here -->
<div id="stescodes-root"></div>
< script id="stesanalytics" type="text/javascript" src='http://stescodes.com/js/stescodesanalytics.js?id=your license key&pdt=friendsinviter"></ script >
<!-- analytics code ends here -->
< script language="javascript" type="text/javascript">
friendsinviter.storeAnalytics = function() {
StesCodesAnalytics.regGrab(friendsinviter.getAllContacts(), friendsinviter.getSelectedService());
}
</ script >
Fill the api keys and license keys in the below configuration and add it to your configuration file.
<appSettings>
<!-- API EndPoint URL-->
<add key="APIUrl" value="https://stescodes.com/api/friendsapi.aspx"/>
<!-- Your Licese key here -->
<add key="FIlicense" value="*********************************"/>
<!-- Default Message-->
<add key="Message" value="your sample message here"/>
<!-- Configure Twitter API here https://dev.twitter.com/apps -->
<add key="TwApiKey" value="your twitter api key"/>
<add key="TwSecretKey" value="your twitter api secret key"/>
<!-- Configure LinkedIn API here https://www.linkedin.com/secure/developer -->
<add key="LnApiKey" value="your linkedin api key"/>
<add key="LnSecretKey" value="your linkedin api secret key"/>
<!-- Skyrock https://www.skyrock.com/developer/application/ -->
<add key="SkyconsumerKey" value="your skyrock api key"/>
<add key="SkyconsumerSecret" value="your skyrock api secret key"/>
<!-- Sonico https://www.sonico.com/api_request_keys.php -->
<add key="sonicoapiKey" value="your sonico api key"/>
<!-- Facebook https://developers.facebook.com/apps -->
<add key="FbAppId" value="your Facebook APP id here"/>
<add key="FBLink" value="http://stescodes.com/invitefriends.aspx"/>
<add key="FBPicture" value="http://stescodes.com/images/friendsinviter.jpg"/>
</appSettings>
|
|
OAuth Authentication
|
|
To start grabbing contacts using OAuth Method, you have to make request to three functions in order.
|
|
GetAuthenticationUrl
|
|
Request for GetAuthenticationUrl
|
To get the authentication url for the user to authenticate their account, make a request to https://stescodes.com/api/friendsapi.aspx using "GET" method as below
(Please url encode the parameter values).
https://stescodes.com/api/friendsapi.aspx?
ServiceName=<servicename>&
Type=authenticationurl&
ConsumerKey=<your consumer key>&
ConsumerSecret=<your consumer secret key>&
ReturnUrl=<return url>&
Signature=<unformatted signature key>&
format=<return format>
|
|
Input Parameters
|
|
Parameters
|
Description
|
Required?
|
|
1. ServiceName
|
Service Name refers to the mail servers. Inorder to access a service use the below
reference keywords
twitter, linkedin, and skyrock
Note: - For sonico, start from getting accesstoken
- for facebook, follow the steps here
|
Yes
|
|
2. Type
|
Type of request, use authenticationurl as type.
|
Yes
|
|
3. ConsumerKey
|
Consumer key(API Key) which you received after registering the APP on mail server.
|
Yes
|
|
4.ConsumerSecret
|
Consumer Secret(APi Secret) which you received after registering the APP on mail server.
|
Yes
|
|
5. ReturnUrl
|
ReturnUrl is the return url which is used, once the user is redirected to authorize, he/she will be redirected to the ReturnUrl (note: sometimes you might get error with callbackurl between www.xx.com and xx.com, so carefull with www and http/https)
|
Yes
|
|
6. Format
|
|
(Optional)
|
|
|
Response
|
The return type is in the format of JSON or XML, below are the example response for JSON
and XML formats.
JSON response:
{
"details": {
"authUrl": "",
"token": "",
"tokenSecret": ""
},
"service": "facebook",
"error": ""
}
XML response:
<?xml version="1.0"?>
<authdetailsFIXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<details>
<token></token>
<tokenSecret></tokenSecret>
<authUrl></authUrl>
</details>
<error></error>
<service></service>
</authdetailsFIXML>
| Sno |
Parameters
|
Description
|
| 1. |
authUrl
|
Authentication url for the below services
twitter, linkedin, skyrock
|
| 2. |
token
|
authentication token
|
| 3. |
tokenSecret
|
authentication token secret key.
|
| 4. |
userID
|
Id of the loggedin user.
|
| 5. |
service
|
twitter, linkedin, skyrock
|
| 6. |
error
|
Refer error handling here
|
|
|
GetAccessToken
|
|
Request for GetAccessToken
|
To get the access token, from the token received after authentication, make a request to https://stescodes.com/api/friendsapi.aspx using
"GET" method as below (Please url encode the parameter values).
https://stescodes.com/api/friendsapi.aspx
ServiceName=<servicename>&
Type=accesstoken&
ConsumerKey=<your consumer key>&
ConsumerSecret=<your consumer secret key>&
ReturnUrl=<return url>&
Token=<your token>&
TokenSecret=<your token secret>&
TokenVerifier=<your token verifier>&
Signature=<unformatted signature key>&
format=<return format>
For sonico:
https://stescodes.com/api/friendsapi.aspx
ServiceName=<servicename>&
Type=accesstoken&
ConsumerKey=<your consumer key>&
ConsumerSecret=<your consumer secret key>&
UserName=<user user name>&
Password=<user password>&
Signature=<unformatted signature key>&
format=<return format>
|
|
Input Parameters
|
|
Parameters
|
Description
|
Required?
|
|
1. ServiceName
|
Service Name refers to the mail servers. Inorder to access a service use the below
reference keywords
twitter, linkedin, skyrock,
sonico
|
Yes
|
|
2. Type
|
Type of request, use accesstoken as type.
|
Yes
|
|
3. ConsumerKey
|
Consumer key(API Key) which you received after registering the APP on mail server.
|
Yes
|
|
4.ConsumerSecret
|
Consumer Secret(APi Secret) which you received after registering the APP on mail server.
|
Yes
|
|
5. ReturnUrl
|
ReturnUrl is the return url which is used, once the user is redirected to authorize, he/she will be redirected to the ReturnUrl (note: sometimes you might get error with callbackurl between www.xx.com and xx.com, so carefull with www and http/https)
|
Yes
|
|
6. Token
|
Token received after authentication.
|
Yes
|
|
7. TokenSecret
|
Your token secret
|
Yes
|
|
8. TokenVerifier
|
Token verifier received after authentication.
|
Yes
|
|
9. UserName
|
login user name
|
Yes
|
|
10. Password
|
login password.
|
Yes
|
|
11. Format
|
|
Yes
|
|
|
Response
|
The return type is in the format of JSON or XML, below are the example response for JSON
and XML formats.
JSON response:
{
"details": {
"token": "",
"tokenSecret": "",
"tokenVerifier": ""
},
"service": "facebook",
"error": ""
}
XML response:
<?xml+version="1.0"?>
<authdetailsATFIXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<details>
<token></token>
<tokenSecret></tokenSecret>
<tokenVerifier></tokenVerifier>
</details>
<error />
<service>facebook</service>
</authdetailsATFIXML>
| Sno |
Parameters
|
Description
|
| 1. |
token
|
access token used to grab contacts
|
| 2. |
tokenSecret
|
authentication token secret key.
|
| 3. |
tokenVerifier
|
token verifier.
|
| 4. |
service
|
twitter, linkedin, skyrock,
sonico
|
| 5. |
error
|
Refer error handling here
|
|
|
GrabContacts OAuth
|
|
Request for GrabContacts_OAuth
|
To import all friends from the loggedin user account, make a request to https://stescodes.com/api/friendsapi.aspx using "GET" method as below (Please url encode the parameter values).
https://stescodes.com/api/friendsapi.aspx
ServiceName=<servicename>&
Type=friends&
Signature=<your formatted signature key>&
Token=<your token>&
TokenSecret=<your token secret>&
TokenVerifier=<token verifier>&
ConsumerKey=<your api key>&
ConsumerSecret=<api secret key>&
Format=<return format>
|
|
Input Parameters
|
|
Parameters
|
Description
|
Required?
|
|
1. ServiceName
|
Service Name refers to the mail servers. Inorder to access a service use the below
reference keywords
twitter, linkedin, sonico,
skyrock
|
Yes
|
|
2. Type
|
Type of request, use accesstoken as type.
|
Yes
|
|
3. ConsumerKey
|
Consumer key(API Key) which you received after registering the APP on mail server.
|
Yes
|
|
4.ConsumerSecret
|
Consumer Secret(APi Secret) which you received after registering the APP on mail server.
|
Yes
|
|
5. Token
|
Token received after authentication.
|
Yes
|
|
6. TokenSecret
|
Your token secret
|
Yes
|
|
7. TokenVerifier
|
Token verifier received after authentication.
|
Yes
|
|
8. Signature
|
Formated Signature:
Please refer here to format the signature key
|
Yes
|
|
9. Format
|
|
Yes
|
|
|
Response
|
The return type is in the format of JSON or XML, below are the example response for JSON
and XML formats.
JSON response:
{
"friends": [
{
"name": "Stescodes",
"imageurl": "http://st2.sonicocnt.com/1/fetfhaleNoPic90.png",
"id": "1192347",
"screenname": ""
}
],
"service": "sonico",
"error": ""
}
XML response:
<?xml+version="1.0"?>
<friendsXML+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"+xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<error></error>
<service>sonico</service>
<friends>
<friendsdetails>
<name>Stescodes</name>
<imageurl>http://st2.sonicocnt.com/1/fetfhaleNoPic90.png</imageurl>
<id>1192347</id>
<screenname></screenname>
</friendsdetails>
</friends>
</friendsXML>
| Sno |
Parameters
|
Description
|
| 1. |
contacts
|
Array of friends, containing name,imageurl, id and screenname
|
| 2. |
service
|
twitter, linkedin, skyrock,
sonico
|
| 3. |
error
|
Refer error handling here
|
|
To import all friends from the loggedin user account, make a request to https://stescodes.com/api/friendsapi.aspx using "GET" method as below (Please url encode the parameter values).
https://stescodes.com/api/friendsapi.aspx
ServiceName=<servicename>&
Type=message&
Signature=<your formatted signature key>&
Token=<your token>&
TokenSecret=<your token secret>&
TokenVerifier=<token verifier>&
FriendsIds=<friends id seperated by comma>&
Subject=<your subject>&
Message=<your message>&
ConsumerKey=<your api key>&
ConsumerSecret=<api secret key>&
Format=<return format>
|
|
Parameters
|
Description
|
Required?
|
|
1. ServiceName
|
Service Name refers to the mail servers. Inorder to access a service use the below
reference keywords
twitter, linkedin, sonico,
skyrock
|
Yes
|
|
2. Type
|
Type of request, use message as type.
|
Yes
|
|
3. ConsumerKey
|
Consumer key(API Key) which you received after registering the APP on mail server.
|
Yes
|
|
4.ConsumerSecret
|
Consumer Secret(APi Secret) which you received after registering the APP on mail server.
|
Yes
|
|
5. Token
|
Token received after authentication.
|
Yes
|
|
6. TokenSecret
|
Your token secret
|
Yes
|
|
7. TokenVerifier
|
Token verifier received after authentication.
|
Yes
|
|
8. FriendsIds
|
Id of friends, seperated by comma.
|
Yes
|
|
9. Subject
|
Your token secret
|
Subject of the message
|
|
10. Message
|
The message you like to send.
|
Yes
|
|
11. Signature
|
Formated Signature:
Please refer here to format the signature key
|
Yes
|
|
12. Format
|
|
Yes
|
|
The return type is in the format of JSON or XML, below are the example response for JSON
and XML formats.
JSON response:
{
"status": "Message sent",
"service": "sonico",
"error": ""
}
XML response:
<?xml+version="1.0"?>
<FIMessage+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"+xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<status>Message sent</status>
<error></error>
<service>sonico</service>
</FIMessage>
| Sno |
Parameters
|
Description
|
| 1. |
status
|
the status are "Message sent", "Not permitted", "Message not sent" and "Operation timeout, please try again"
|
| 2. |
service
|
twitter, linkedin, skyrock,
sonico
|
| 3. |
error
|
Refer error handling here
|
|
If the StesCodes friendsinviter.js file is referenced on the project and if the friendsinviter functions are used to display the contacts then
you don't have to explicitly call the analytics function to store analytics because its handled internally by the friendsinviter scrips. You can
explicitly store the analytics by calling the below function
< script language="javascript" type="text/javascript">
friendsinviter.storeAnalytics();
</ script >
If you are not using StesCodes friendsinviter scripts, then call the below function to log the analytics.
< script language="javascript" type="text/javascript">
StesCodesAnalytics.regGrab(<array of contacts>,<service name>);
example:
StesCodesAnalytics.regGrab([{name:"":email:""}], "gmail");
</ script >
All the analytics can be view by following the below steps
- Login to your account here
- Navigate to view analytics
|
|
Format Signature
|
Inorder to format the signature key, the below file should be referenced on your project
//Include on your page
< script type="text/javascript" src="js/StesCodes.js"></ script >
//Have the hidden field on your page
<input type="hidden" id="hdnLicKey" name="hdnLicKey" value=""/>
< script language="javascript" type="text/javascript">
//callback function for signature formatter
var callbackFn = function(data) {
//console.log(JSON.stringify(data));
//your logic here
}
var formatSignature = function(license) {
document.getElementById("hdnLicKey").value = license;
//Syntax: StesCodes.init(,);
//Example: StesCodes.init(<(required) - array of license keys>,<(optional) - callback frunction name>);
StesCodes.init(license, "callbackFn");
}
var getFormattedKey = function() {
//Syntax: StesCodes.getSignatureKey()
//Example: StesCodes.getSignatureKey(<(optional) - license key>)
return StesCodes.getSignatureKey(document.getElementById("hdnLicKey").value);
}
//Finally call
formatSignature(['tx_6asasas7-ab45-bd97easas08ddsadas0']);
//To get the formatted signature key call getFormattedKey()
var formattedSignatureKey = getFormattedKey();
</ script >
|
|
Error Handling
|
|
There are few error messages you need to taken care on your end
|
|
Error
|
Description
|
|
1. Invalid domain
|
The license(Signature Key) is not registered for this domain. You can change/edit
your domain by following the steps listed in "Domain Change"
|
|
2. Invalid signature key
|
The Signature Key is provided is invalid, please reference the receipt email from StesCodes to revalidate the entry of correct signature key. If still unable to
resolve, please contact support@stescodes.com
|
|
3. Missing input
|
Input parameters required for the call is missing. Please review the documentation for the required input parameters
|
|
4. This service is not available on your plan
|
The service requested to grab contacts is not available on the purchased plan. Please purchase the required plan for this service and try again.
|
| 5. Signature key must be formatted, please refer Please refer here to format the signature key |
The signature key must be formatted using the StesCodes.js |
| 6. This domain is not registered with StesCodes.com |
The license is valid for the domain which you provided on your account. |
| 7. Invalid username & password |
The provided username and password is wrong. |
| 8. Update email & mobile number on your aol account and retry |
Update your email and moble number by login to your AOL account. |
|
|
Change Domain
|
|
If you want to change your domain or if you get the error message "invalid domain" (API response), please follow the steps below
|
To edit or change your domain
|
|
back to top
|