Retrieving the senders name and email from an envelope? - docusignapi

I have a service account that is using DocuSign's polling to retrieve a list of envelopes that had a status change. These envelopes were sent by various internal users. When I go to retrieve the envelopes, I'd like to retrieve who the sender of the envelope is (sender's name and email).
I initially excepted this information to be part of the Envelope object, but it's not:
Envelope envInfo = envelopesApi.GetEnvelope(AccountId, envelopeId);
I've tried various other API calls and reviewed documentation, but none of them seem to provide a way to get the sender's name and email.
Can this information be retrieved?

There actually is a way that you can get Sender Name and Email for an Envelope via the API. First, issue a Get Envelope Audit Events request to identify the UserId of the Sender. Then, use that UserId to issue a Get User request to obtain the sender's name and email address. Here are the steps, with sample requests/responses (irrelevant info omitted, for brevity):
1) Get Envelope Audit Events
Request:
GET /accounts/{accountId}/envelopes/{envelopeId}/audit_events
Response:
{
"auditEvents": [
{
"eventFields": [
...
{
"name": "UserName",
"value": "John Doe"
},
{
"name": "UserId",
"value": "af465e97-83a6-472c-a25b-ebad10e4cc6a"
},
{
"name": "Action",
"value": "Registered"
},
{
"name": "Message",
"value": "The envelope was created by John Doe"
},
{
"name": "EnvelopeStatus",
"value": "created"
},
...
]
},
...
]
}
2) Get User (specifying the UserId from the previous response)
Request:
GET /accounts/{accountId}/users/af465e97-83a6-472c-a25b-ebad10e4cc6a
Response:
{
"userName": "John Doe",
"userId": "af465e97-83a6-472c-a25b-ebad10e4cc6a",
"email": "john.doe#test.com",
"firstName": "John",
"lastName": "Doe",
...
}
Another option (if you're creating the Envelopes with the API to begin with) would be to always specify "Custom Envelope Fields" for each Envelope at creation-time that contain the sender's name and email address. Doing it this way would let you retrieve this info with the same request you're already issuing to retrieve the envelope info (provided that you include the extra querystring parameter (include=custom_fields):
GET accounts/{accountId}/envelopes/{envelopeId}?include=custom_fields

DocuSign does not work in this way, as envelopes are linked to a user and its user's documents so no one can access the document until and unless user shares the envelopes with anyone. So there are no APIs which will inform you the sender email/name by querying DS on envelopeId. You have two ways to achieve this requirement:
Use DS Connect (recommended way), configure Connect in your DS
Account and DocuSign will push the connect messages with the sender
details in that XML message when a subscribed trigger event occurs
Another way is you need to get OAUTH access token of all your users and
then call DS APIs to know the envelopes for each user
Connect message will look like below:
<UserName>Sender Name</UserName>
<Email>SenderEmail#email.com</Email>

Related

Send email thru Azure AD Graph API as email alias

In the Graph API explorer, you can send an email with the endpoint
https://graph.microsoft.com/v1.0/me/sendMail
and a basic json payload of
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "user#domain.com"
}
}
],
"from":{
"emailAddress": {
"address": "smtp:my_alias#domain.com"
}
}
}
When I send this request, it still sends the email as user#domain.com instead of my email alias.
I can still see the email alias there when i run the endpoint
https://graph.microsoft.com/beta/me/
Under proxyAddresses
I've looked over the documentation and don't see any clear example of option to send the email as alias.
We can only set from and sender properties to a different value when sending a message from a shared mailbox, for a shared calendar, or as a delegate. See details here (see form and sender) and Setting the from and sender properties. Sending email as alias is not mentioned and cannot work based on the test.
So it's not supported to send the email as alias via Microsoft Graph API.
The value of from and sender must correspond to the actual mailbox used. So the only way to send email as alias is to change alias to primary email in O365 admin center and then send email.
As a workaround, if you just want recipients to think that you are sending from alias, you can configure a delegated mailbox for your mailbox (assign sendAs rights of the mailbox to a delegated user). Delegated mailbox is actually another mailbox and needs to be assigned an Exchange Online license. Then set the from property to the delegated user who have sendAs rights for your mailbox in Microsoft Graph API. See details here. After that, when you send an email, the recipient will see it's from the delegated email.
About how to assign sendAs rights in Exchange Admin Center, please refer to Use the EAC to assign permissions to individual mailboxes. It may take several hours to take effect.
POST https://graph.microsoft.com/beta/me/sendMail
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [{
"emailAddress": {
"address": "user#domain.com"
}
}
],
"from": {
"emailAddress": {
"address": "{delegated mailbox}"
}
}
}
}
Just tested the API and verified working as of now.
https://developer.microsoft.com/en-us/graph/graph-explorer
POST https://graph.microsoft.com/beta/me/sendMail
{
"message": {
"subject": "Meet for lunch test?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "somemail#gmail.com"
}
}
],
"from": {
"emailAddress": {
"address": "myalias#contoso.com"
}
}
}
}
"from" address must be from one of your proxy/alias email addresses.
If you're using AzureAD Tenant/Client IDs to send emails, you can use the sample code below:
var msg = new Message();
msg.Subject = "test";
//... other setup
msg.From = new Recipient {
EmailAddress = new EmailAddress
{ Address = "myalias#contoso.com" }
};
await graphClient.Users["mydefault#contoso.com"].SendMail(msg).Request().PostAsync();
I tried setting msg.Sender and it doesn't work.

Embedded Signing - Signing from My App

I'm working on get the signing process on an iFrame to Embedded docusign on my app.
I have trying to work on this based on this tutorials:
Docusign Embedded Signing using template
https://developers.docusign.com/esign-rest-api/guides/features/embedding
Based on what I understood, if you want to embedded you have to create the "create the envelope on the fly". So you don't specify the templateId correct?
So what I don't fully get is, how I get the documentBase64 string value? I have to get it manually? Or docusing api has an endpoint that will return that?
Also I want to know, what happen to the custom fields I added to the template? I can't use them?
Right now this is the json I'm sending:
{{baseUrl}}/envelopes
{
"emailSubject":"This is a custom email subjet, look at the doc.",
"status":"sent",
"templateId":"a0847413-35ac-48ed-9ed6-9b7f96019eda",
"templateRoles":[
{
"email":"mauriciotaranto#email.com",
"name":"Mauricio T",
"clientUserId": "1234",
"roleName":"Test",
"routingOrder":"1",
"tabs": {
"textTabs": [
{
"tabLabel": "Custom",
"value": "This is a custom value"
},
{
"tabLabel": "NewCustom",
"value": "Another custom value added using API"
},
{
"tabLabel": "NewCustom1",
"value": "Last custom value added using API"
}
]
}
}
],
}
And then I go to the recipient view to get the URL:
{{baseUrl}}/envelopes/{{envelopeId}}/views/recipient
{
"returnUrl": "https://www.google.com.uy",
"authenticationMethod": "None",
"email": "mauriciotaranto#email.com",
"userName": "Mauricio T",
"clientUserId": "1234"
}
As far as I understood this way will not allow the user to sing the document.
Need to do it with the document instead.
Can you explain to me how this should work?
Thanks!
UPDATE:
Im manually parsing the bytes of the document to base64. and send this json:
"status":"sent",
"emailSubject":"Envelope with Embedded Signer",
"documents":[
{
"documentId":"1",
"name":"contract.pdf",
"documentBase64":bytes
}
],
"recipients":{
"signers":[
{
"email":"mauriciotaranto#hotmail.com",
"name":"Mauricio T",
"recipientId":"1",
"clientUserId":"1234"
}
]
}
}
I change the headers, add the accept: application/json and content-type: multipart/from-data
And this is the response I get:
{
"errorCode": "ENVELOPE_IS_INCOMPLETE",
"message": "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Content-Type does not contain boundary parameter."
}
You can create envelopes in any way, either by using Templates or by passing base64 of document or both as well using Composite Template. When you send templates, then you already have added signers tabs on the document in the templates so you just need to populate the signer details like name and email in creating an envelope and/or pre-populate the DS Tabs value. But when you send document as base64, then you need to tell DocuSign how to add DS Tabs on the document, either by using
X and Y position of the tabs
AnchorString
PDF Field Transformation
Embedded Signing is a type of signing, to implement that you need to just add clientUserId in the signers details. This can be done in both ways either by using template or by passing document as base64 or both as well using Composite Template. Once you have an embedded signer by adding clientUserId then you need to generate signing URL as explained in your qs, by using Recipient View URL, as soon as URL is generated then you will open this URL in IFrame or on new tab.
In the link which you shared is having very small code snippet and it does not have complete example, check Complete Example, and you will see that they are adding DS Tabs on the document using X/Y position.

Sending Copy of signed Documents to a non-signer

I am using C# for DocuSign.
I want to send the signed documents to a list of recipients after the documents are signed. Is there a possible way to do this?
Thanks
Amulya Dutta
You can add those recipients (last in routing order) as CC recipients in the workflow, once all signers have completed the signing then DocuSign will send the completed envelope email to the CC recipients. Other way of doing is using API by forwarding the completed envelope ("765295a6-4b0c-4df9-b4a3-00e5c311bc8e") to a any one, in doing this way it will consume one more envelope for you.
POST /restapi/v2/accounts/<accountId>/envelopes?completed_documents_only=true
{
"status":"sent",
"emailSubject": "Forwarded Envelope",
"envelopeId":"765295a6-4b0c-4df9-b4a3-00e5c311bc8e",
"recipients": {
"carbonCopies": [{
"name": "1",
"email": "signerEmail#gmail.com",
"routingOrder": 1,
"recipientId": "1"
}]
}
}

Create room reservations using Domino data services REST API

I've been attempting to create room bookings using the Domino data services REST API but I seem to be missing a trick.
Sending a POST request to the document endpoint I am able to submit and create a reservation document which appears in the Rooms and resource view but the underlying room still shows as available in the notes client.
Here is a sample of the request body:
{
"#authors": [
"CN=Andrew Jones/O=MyCorp",
""
],
"#form": "Reservation",
"From": "CN=Andrew Jones/O=MyCorp",
"Chair": "CN=Andrew Jones/O=MyCorp",
"AltChair": "CN=Andrew Jones/O=MyCorp",
"Principal": "CN=Andrew Jones/O=MyCorp",
"SequenceNum": 1,
"OrgState": "5",
"ResourceType": "1",
"ResourceName": "Room/Office",
"ROOM": "Room/Office#MyCorp",
"Capacity": 1,
"AppointmentType": "3",
"StartTimeZone": "Z=0$DO=1$DL=3 -1 1 10 -1 1$ZX=47$ZN=GMT",
"EndTimeZone": "Z=0$DO=1$DL=3 -1 1 10 -1 1$ZX=47$ZN=GMT",
"TOPIC": "Test",
"SendTo": "CN=Room/O=Office",
"SelectedRR": "CN=Room/O=Office",
"$BusyName":"CN=Room/O=Office",
"Encrypt": "0",
"Categories": "",
"RouteServers": "CN=dominonode/O=MyCorp",
"DeliveredDate": { "data":"2017-03-09T12:38:34Z","type":"datetime"},
"StartDate": {"data":"2017-03-09T20:00:00Z","type":"datetime"},
"StartTime": {"data":"2017-03-09T20:00:00Z","type":"datetime"},
"StartDateTime": {"data":"2017-03-09T20:00:00Z","type":"datetime"},
"EndDate": {"data":"2017-03-09T21:00:00Z","type":"datetime"},
"EndTime": {"data":"2017-09-03T21:00:00Z","type":"datetime"},
"EndDateTime": {"data":"2017-03-09T21:00:00Z","type":"datetime"},
"CalendarDateTime": {"data":"2017-03-09T20:00:00Z","type":"datetime"},
"UpdateSeq": 1,
"Author": "CN=Andrew Jones/O=MyCorp",
"ResourceOwner": "",
"ReservedFor": "CN=Andrew Jones/O=MyCorp",
"ReservedBy": "CN=Andrew Jones/O=MyCorp",
"RQStatus": "A",
"Purpose": "API Test",
"NoticeType": "A",
"Step": 3,
"Site": "Office",
"ReserveDate": {"data":"2017-03-09T20:00:00Z","type":"datetime"}
}
This question suggests I should instead be trying to create a Calendar event but everything I send seems to get rejected with bad request, including the sample
I've also looked at another question which suggests I need to create an appointment and then a notice document for the room, but whilst I can create these documents, it doesn't seem to create a reservation.
Has anyone tried this and got it to work or am I just joining the elephant's graveyard?
I recommend registering a special "user" to act as the booking agent. Then you can use the calendar API to book any room. I think this approach will work better than the data API.
Details:
Register a new "user" to act as the booking agent. Let's call the user "Room Agent/MyCorp". The user's mail file is "mail/ragent.nsf".
Make sure the calendar API is enabled on a mail server with a replica of "mail/ragent.nsf".
When someone uses your tablet app to book a room, the app sends a request to create an event on the room agent's calendar (POST /mail/ragent.nsf/api/calendar/events). The new event should include the room in the list of attendees.
The calendar API sends an invitation to the room (actually the resource database). As long as the room is not already booked, the resource database accepts the invitation and the room becomes busy for that time slot.
This saves you from having to deal with the data API and the intricacies of the resource database. Your tablet app just needs to know the mail server host name, the name of the mail file, and the room agent's credentials. I also like the idea of being able to "audit" all bookings originating from your tablet app. You'll be able to find all the events and notices (accept or decline) in the room agent's mail file.
One disadvantage is booking will not be instantaneous, but the resource database should be able to accept an invitation in a matter of seconds.
By the way, here is some sample JSON input for your POST request:
{
"events":[
{
"summary":"Calendar API test",
"location":"test",
"description":"test",
"start":{"date":"2018-01-01","time":"13:00:00","utc":true},
"end":{"date":"2018-01-01","time":"14:00:00","utc":true},
"organizer":{"email":"ragent#mycorp.com"},
"attendees":[
{
"role":"req-participant",
"userType":"room",
"status":"needs-action",
"rsvp":true,
"email":"room#mycorp.com"
}
]
}
]
}
It's important to specify "userType":"room" for the attendee. Otherwise, the resource database won't accept the invitation.

Docusign API Invalid email address error with signature from document request with inPersonSigner recipient type

I'm currently testing an API call that will ultimately allow for an agent to provide signature and another party to sign in person. In sending the call via API Explorer I continue to receive the following response:
{
"errorCode": "INVALID_EMAIL_ADDRESS_FOR_RECIPIENT",
"message": "The email address for one of the recipients is not valid."
}
I've read in the REST API guide that this needs to be enabled for my account; it may be that my demo dev account does not have this enabled. I just need to verify whether or not that I'm not omitting any essential parameters in this call. I've tried passing in my email (as the account holder) and still receive this error. Here is my request body JSON:
{
"emailBlurb": "test",
"emailSubject": "test",
"documents": [
{
"name": "ChiropractorPlusApplication.pdf",
"documentId": "1"
}
],
"recipients": {
"inPersonSigners": [
{
"hostName": "Joe Host",
"recipientId": "1",
"name": "Name",
"email": "host#gmail.com",
"signerName": "Insured"
}
]
},
"status": "sent"
}
Thanks!
I believe you have found a bug with the REST API Explorer in that it's missing at least one field for In Person Signers. If you look at the REST API documentation you'll see that there's one more required parameter for In Person Signers, which is the hostEmail
Try adding to your JSON
"hostEmail" : "host's email address",
And I have a feeling that will do the trick. See page 275 of REST API v2 PDF for info on In Person Signers recipient type. It first shows a sample request with all the options then below that it lists the required fields for this recipient type:
http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf

Resources