[SalesForce] call conga composer from APEX

Does any one know how to call conga composer from APEX?

Tried to follow [http://knowledge.congasphere.com/congakb/ext/kb69-how-to-call-conga-composer-from-apex?mode=searchresults]

but I get "Your Salesforce session has expired or the Salesforce API Servers are offline. INVALID SESSION ID or SERVER URL"

Any help is greatly appreciated.

Thank you,
Manohar

Best Answer

Make sure you're passing the appropriate parameters:

Map<String, String> parameters = new Map<String, String> {
    'sessionid' => UserInfo.getSessionId(),
    'serverUrl' => Url.getSalesforceBaseUrl().toExternalForm()+'/services/Soap/u/13.0/'+UserInfo.getOrganizationId()
};

Include other parameters as appropriate.