• samyak jain 45
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
Can someone explain/share code snippet for creating a connected app programatically. Is there any library for using metadata api in javascript ?
Is it necessary to write apex code on the force.com platform or it apex can be injected using API or any other method ?
I want to use chatter REST API but for many API's support is not available for API version 39.0 . Please can somebody let me know when will the support be there.
Is it necessary to write apex code on the force.com platform or it apex can be injected using API or any other method ?
Hello Team,

Could anyone please help me to resolve the below issue :
We are planning to integrate Gupshup wtih Salesforce platform and trying to get access_token using the bellow code snippet.
--------------------------------------------------------------------------------------------------------------------------------
Code Snippet :
/** This is a sample code for your bot**/
function MessageHandler(context, event) {
    context.console.log("test")
    var grant_type;
    var client_id;
    var client_secret;
    var redirect_uri;
    var username;
    var password;
   
    if(event.message.toLowerCase() == "post") {
    var contextParam = {
        "grant_type":"password",
        "client_id":"3MVG9Y6d_Btp4xp5fHfBCvTWgHlfBKxrEf0lFIt9p71zfTmei0q9P8QxoaRowTIefchOoNdY8syyWOriUKYlV",
        "client_secret":"7975635620731036814",
        "redirect_uri":"https://localhost:8443/_callback",
        "username":"apex_integration@sfdc.com",
        "password":"Mardal786*k7Q58cu1ffXZEm0NOEgWi8vIv"
    };
    var url = "https://login.salesforce.com/services/oauth2/token";
    var param = JSON.stringify(contextParam);
    var header = {"Content-Type":"application/x-www-form-urlencoded"};
    context.console.log("contextparm")
    context.simplehttp.makePost(url,param,header);
    }
}
/** Functions declared below are required **/
function EventHandler(context, event) {
    if(! context.simpledb.botleveldata.numinstance)
        context.simpledb.botleveldata.numinstance = 0;
    numinstances = parseInt(context.simpledb.botleveldata.numinstance) + 1;
    context.simpledb.botleveldata.numinstance = numinstances;
    context.sendResponse("Thanks for adding me. You are:" + numinstances);
}
function HttpResponseHandler(context, event) {
    context.console.log(event.getresp)
    var result= JSON.parse(event.getresp);
    if(result=="success"){
        context.console.log("success")
       context.sendResponse("We have successfully stored your data");
       }
    context.sendResponse(event.getresp);
    context.console.log("final")
}
function DbGetHandler(context, event) {
    context.sendResponse("testdbput keyword was last get by:" + event.dbval);
}
 
function DbPutHandler(context, event) {
    context.sendResponse("testdbput keyword was last put by:" + event.dbval);
}

--------------------------------------------------------------------------------------------------------------------------------

Error Dexcription :

{"error":"unsupported_grant_type","error_description":"grant type not supported"}

Any help would be greatly appriciated.

Thanks,
Fazur