[SalesForce] Run Conga Composer (release 8) in background mode via HTTP Callout

I'm trying to use Conga from mobile devices (SF1 in particular and I DO know that it is not officially supported yet) and running Conga in Background Mode satisfies my needs. However in order to run it from SF1, I have to create child browser window to navigate to https://composer.congamerge.com and pass the parameters.

Problem with above approach is that after request is completed, Conga redirects to master object page which in turn redirects to SF login page (due to missing session in mobile browser). I find this behaviour far from user friendly and would like to streamline the process. My obvious thought was that since we are passing to Conga server URL and session ID Conga should be able to do all the processing on their servers and they don't need a loaded page in the client browser. So I tried to trigger merge process using HTTP GET call to the same URL however I keep getting 400 Bad Request response.

@RemoteAction
public static String testCongaBackgroundMode(String sessionId, String serverUrl) {

    String sessId = UserInfo.getSessionId();
    String servUrl = Url.getSalesforceBaseUrl().toExternalForm()+'/services/Soap/u/29.0/'+UserInfo.getOrganizationId();

    String url2 = 'https://composer.congamerge.com'+
                          '?sessionId='+sessId+
                          '&serverUrl='+EncodingUtil.urlEncode(servUrl, 'UTF-8')+
                          '&id=006g0000004b6cB'+
                          '&TemplateId=a04g0000009NYx3'+
                          '&SC0=1'+
                          '&SC1=Attachments'+
                          '&EmailToID=003g000000IGi32'+
                          '&CETID=a02g0000006yCtA'+
                          '&FP0=1'+
                          '&DS7=12'+
                          '&BML=Test+message';

    System.debug(url2);

    Http http = new Http();
    HttpRequest req = new HttpRequest();
    req.setEndpoint(url2);
    req.setMethod('GET');
    req.setTimeout(60000);

// Send the request, and return a response
    HttpResponse res = http.send(req);

    System.debug(res);

    return res.getStatus() + ' => ' + res.getBody();
}

As you can see above I tried to get sessionID and server URL both on the server side and by passing values form VF page – neither options worked…

My question is – does anyone know if it is possible to run Conga Merge in background mode via HTTP Callout? If so, can anyone point out what I'm doing wrong?

Best Answer

Composer 8 does not currently support HTTP callout, but it can be accomplished with Composer 7 using https://www.appextremes.com/apps/conga/pm.aspx for the initial line URL.

But wait there's more... since background mode is desirable, Conga's recommended method for calling Composer via Salesforce1 is through our Workflow service which can execute a merge completely in the background based on an Outbound Message. So you simply need to create a Publisher Action that will initiate a Workflow trigger which will subsequently send the document(s) via email.

Our full support for Salesforce1 is on the very near horizon. We're in the final stages of internal testing.

Thanks for your patience.

Cheers!

CongaPete