Looking for whether or not there is a synchronous Loop.loopMessage.send method? Or whether there is a callback mechanism afforded to us from Apex in order to know when the document has finished generating and is attached to the Salesforce record in question?
Our end goal is to send our API users a list of DocuSign token URLs for them to create their own embedded signing experience in their app using a single API call to our system.
We must start with generating the document via Nintex and attaching it to the record in question. We know how to do this, but it is not a synchronous process when using Apex, so its forcing us to make a second and third endpoint for our API users so they can poll our system for when the document is ready.
Our flow is:
Our problem is of course that this document in step #1 is not generated from our UI, or any UI for that matter, (so we use Apex) and we need to know when the document is "ready" and attached to the record in Salesforce. As mentioned, we know a solution, but it doesn’t allow our partners to make a single API call to our system and get back the DocuSign token URLs in one call. We are forced to break it up into multiple API calls since step #1 above is always asynchronous.
All I’m really looking for is whether or not calling “Loop.loopMessage.send” is always going to be asynchronous or if there’s a way to “know” when the process is done before responding to the API caller? Since the generation of the DDP document can take up to a minute in some cases, I’m afraid polling within the same Apex transaction is feasible without hitting a governor limit.
Is there a callback mechanism available when using that method in Salesforce Apex so that we know the pdf was generated and attached to the Salesforce record? as it stands, once we are done calling “Loop.loopMessage.send”, our process must exit and return to the caller, so we have no choice but to rely on the third-party app to make another API call to tell us to check on whether the attachment exists. Once it does exist, we can finish steps #2 through #5 above. This is a less than optimal experience for our API users.
We could fire the document generation process in an earlier Salesforce record event without the API users knowedge (prior to them wanting to generate a document), but we'd be eating up our Nintex API calls and creating documents that are never used in our case. We currently rely on them telling us which records to generate documents for [signing] and we'd prefer to keep it that way.
Everything shown in the sample Nintex for Salesforce documentation presupposes that we are using our own UI to implement embedded signing. See https://github.com/sdknintex. In our case here, we are looking for a way to either generate the document synchronsouly within Apex or pass an available callback mechanism off to our partner, so they know exatly when the document is ready for signing, so they can call our second endpoint to get the token URLs. We'd hate to make them poll for the data.