Docusign after Signed how to get response in php? - docusignapi

in my MVC framework in codeignitor I have to working on docusign the electronic sign using api after sign document how to get response of that is if sign completed or process or cancel etc..
$response = $service->views->getRecipientView(
$returnUrl, $envelopeId, $contact_name,
$contact_email, $client_id, $authMethod
);

You can determine what action the recipient took during the embedded signing flow by parsing the re-direct URL. Once they are done signing in the iFrame or webview they will be re-directed to the URL you specified in your $returnUrl parameter.
For instance, if your return URL is https://www.docusign.com/developer-center and the user successfully signed the document the return URL would look like:
https://www.docusign.com/developer-center?event=signing_complete
Or if the recipient declined to sign then the return URL would look like:
https://www.docusign.com/developer-center?event=decline
All of this info (including code samples) is available through the QuickStart section of the DocuSign Developer Center and in the API Documentation.

Related

How to download signed document using DocuSign API

Please share docusign API to download signed document. Request body.
https://developers.docusign.com/docs/esign-rest-api/how-to/download-envelope-documents/ has this in 8 different coding languages.
the request is a GET call, so the request body is not needed (empty).
You make a GET call to this endpoint:
{base_path}/v2.1/accounts/${account_id}/envelopes/${envelope_id}/documents/${doc_choice}
You will need your:
base_path - in the developer account it would be https://demo.docusign.net/restapi/
account_id - your accountId for the account that was used to create the envelope
envelope_id - your envelopeId for the envelope sent for signing.
doc_choice - your documentId or if you want to get a ZIP file, combined or PDF portfolio.

Facebook : URL blocked This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings

Recently I have used Facebook Login option in my website. I have wrote all the APIs needed and tested them thoroughly in using "localhost" as domain. While configuring settings in my APP in Facebook developers account, I have setup all the necessary settings like giving Oauth redirect URL, adding domain name in basic settings and other things. Everything worked fine then. So, I have requested required app permissions like pages_manage_posts, pages_read_enagagment, pages_show_list and applied for them. Facebook approved them in the app review.
the Redirect URL ("https://execute.app/#/socialmedia/management/") that I used in Facebook is correctly put in the Facebook Oauth redirect URL path as shown in the pic below.
I have used server side APIs for Facebook login and graph APIs. I have used Oauth2 for Facebook login. You can see the code below
var OAuth2 = require('oauth').OAuth2;
var oauth2 = new OAuth2(CONSTANTS.FB_APP_Key,
CONSTANTS.FB_APP_Secret,
"", "https://www.facebook.com/dialog/oauth",
"https://graph.facebook.com/oauth/access_token",
null);
app.get('/api/document/facebook/auth', function (req, res) {
var redirect_uri = "https://execute.app/#/socialmedia/management/";
console.log("redirect_uri ", redirect_uri);
var params = { 'redirect_uri': redirect_uri, 'scope': 'email,public_profile,pages_manage_posts,pages_show_list,pages_read_engagement' };
var authUrl = oauth2.getAuthorizeUrl(params);
res.send({
"status": true,
"message": "login url generated successfully",
"url": authUrl
});
});
I will explain the problem in two scenarios below.
Scenario-1: When there is and existing active Facebook session in browser i.e, when some user is already logged into Facebook in facebook.com or developers.facebook.com and when we try to login into Facebook from our website, Oauth Authentication API gets called and returns Facebook login URL with status code 200 and the url gets opened in a new tab, its works fine, we don't need to enter Facebook login credentials again, we can just click on "**Continue as USER**" button and then we get the login code, with which we can get user access token. After getting token everything works as planned.
Scenario-2: But if no user is already logged into Facebook in browser and when I click on **login to Facebook** button, API call is made and it returns login URL, but the response status code sent by Oauth login API is 304. A new Facebook login tab is opened, but there is a warning displaying a message saying "URL blocked.
This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings. Make sure that the client and web OAuth logins are on and add all your app domains as valid OAuth redirect URIs."
But you can see that I have added correct Redirect URL in Facebook already. It works in scenario-1 and does not work in another as I mentioned above.
Note: the Facebook login URL returned by Oauth Authentication API is same regardless the status code 200 or 304 . It goes as " https://www.facebook.com/dialog/oauth?redirect_uri=https%3A%2F%2Fexecute.app%2F%23%2Fsocialmedia%2Fmanagement%2F&scope=email%2Cpublic_profile%2Cpages_manage_posts%2Cpages_show_list%2Cpages_read_engagement&client_id=88XXXXXXX663"
Please help me in solving this issue ,thanks in advance
The OAuth RFC states for the redirect URI that:
The endpoint URI MUST NOT include a fragment component.
It might be a bug in Facebook that it works for some scenarios and does not work for others, but in fact it's best to avoid a URI with a fragment component. If Facebook's documentation states that you can use redirect URIs with fragments I would try to contact them ask why this doesn't work in some scenarios.

DocuSign return URLs

I'm using the DocuSign C# Client Library.
To get the signing URL, I use the Envelopes::createRecipientView function (https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeViews/createRecipient).
When the user has processed the envelope, he is redirected to the URL set up by RecipientViewRequest::ReturnUrl.
As I configured the destination URLs in the Brand/In-session settings, is it possible to redirect the user to those URLs using the Envelopes::createRecipientView function ?
You can , but your code would have to do that. you have to get the url that you configured and assigned it to the returnUrl when you create the recipientView url.

Access the DocuSign API in your Force.com / Salesforce.com account in order to send an object with a single click of a button

DocuSignAPI for Salesforce.
Hello everybody, I'm following this manual to access the DocuSign API in Force.com / Salesforce.com account in order to send an object with a single click of a button to be isgned.
http://developer.force.com/cookbook/recipe/accessing-docusign-api-from-salesforcecom-to-send-contracts-for-esignatures
the problems is when i get the next error:
"The DocuSign EnvelopeId:Exception - System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: The email address for the recipient is invalid. The recipient Id follows. faultcode=soap:Client faultactor=https://demo.docusign.net/api/3.0/dsapi.asmx"
Do anyone know the solution?
Thank you.
Re your specific error, I suggest that you download the API call logging information from DocuSign itself to see exactly what you sent to DocuSign via Salesforce.
In general for Salesforce/DocuSign integration, recommended first step is to use DocuSign for Salesforce, available from the Salesforce app store.
Additional developer information and source code is available from this blog post. It includes info on recipes (including source code) from DocuSign that document how to call the DocuSign API from Salesforce.
One issue to watch out for: you can't send PDFs from Salesforce to DocuSign due to callout limitations enforced by Salesforce.
Solutions:
you can make a call to a gateway (which you write). Your gateway would then pull the doc from Salesforce and then send it to DocuSign
Or use DocuSign for Salesforce which does the above for you.
thank you for your answer.
At the end the solution was that the email of the person that I wanted to send the document to sign didnt exist :P.
But now my problem is How can I update the Docusign status? becouse when I put this in an "execute anonymous windows" that creates me a Status:
dsfs__DocuSign_Status__c status = new dsfs__DocuSign_Status__c();
status.dsfs__Contract__c='0293900000xD';
status.dsfs__Envelope_Status__c='Sent';
upsert status;
but when i use this inside of a controller extension:
try {
DocuSignAPI.EnvelopeStatus es = dsApiSend.CreateAndSendEnvelope(envelope);
envelopeId = es.EnvelopeID;
// this.contract.DocuSign_Status__c=es.Status;
dsfs__DocuSign_Status__c status = new dsfs__DocuSign_Status__c();
status.dsfs__Contract__c=this.contract.Id;
status.dsfs__Envelope_Status__c=es.Status;
upsert status;
} catch ( CalloutException e) {
System.debug('Exception - ' + e );
envelopeId = 'Exception - ' + e;
}
Doesn't work, the Status is never created.
Thank you for your help.

Docusign Custom button throws Invalid email address error for correct email

I have a custom button in Salesforce that has the javascript code to generate the docusign parameter with template id and recipient list CRL. And using demo docusign account for testing purpose. Here, am using docusign Salesforce Connect and not API.
Eventhough my email address is correct, when I click on the docusign custom button, I am getting an error message as follows,
Error: Incorrect email address format. Verify the email address or
contact your administrator for the correct format
But the docusign param generated values are correct for the email address,
https://dsfs.cs62.visual.force.com/apex/DocuSign_CreateEnvelope?
CES=Medical+Release+Form.pdf&
RES=0%2C0%2C0%2C0%2C0%2C0&
DST=E1377257-80EB-4F3D-A046-A1D033CBD4F5&
DSEID=0&
LA=0&
SourceID=5005C000000UNG1&
CEM=Please+sign+the+forms+given&
OCO=Send&
CRL=Email~+kamatchidevi%40mstsolutions.com%3BLastName~+test+doc+%3BRole~Signer1
Thanks & Regards,
Kamatchi Devi
The + signs are causing the issue here, there is also no need to encode it yourself as it's done by the manage package into the URL. However, if you are going to URL encode I would recommend doing the entire string, like so
CRL = encodeURIComponent('Email~kamatchidevi#mstsolutions.com;LastName~test doc;Role~Signer1')

Resources