Skip to content

Instantly share code, notes, and snippets.

@Mistat
Created March 15, 2013 00:59
Show Gist options
  • Save Mistat/5166693 to your computer and use it in GitHub Desktop.
Save Mistat/5166693 to your computer and use it in GitHub Desktop.
// Get AccessToken and AccessTokenSecret
app.get('/call', function(req, res) {
var accessToken = req.session.passport.user.token;
var accessTokenSecret = req.session.passport.user.tokenSecret;
// any code ....
}
// Example request
deskcom = new DeskcomStrategy(......);
deskcom._oauth.post(
'https://domain-name.desk.com/api/v1/interactions.json',
accessToken,
accessTokenSecret,
{interaction_channel:'phone', interaction_subject: 'call from tel:' + tel , customer_id:customer_id},
"application/x-www-form-urlencoded",
function (err, body, response) {
if (err) {
return;
}
var data = JSON.parse(body);
var case_id = data.results.case.id;
// any code....
}
);
deskcom._oauth.get(
'https://domain-name.desk.com/api/v1/customers.json?phone='+tel,
accessToken,
accessTokenSecret,
function (err, body, res) {
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment