How to pass phone verification in DocuSign? - vb.net

Here i use DocuSign SDK code for send envelope, so in this how to pass phone verification ?
In this code I pass signer and signing location with the help of co-ordinates and send to envelope. I get access token without fail.
Private Function DoWork(ByVal signerEmail As String, ByVal signerName As String, ByVal ccEmail As String, ByVal ccName As String, ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal templateId As String) As String
Dim config = New Configuration(New ApiClient(basePath))
config.AddDefaultHeader("Authorization", "Bearer " & accessToken)
Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config)
Dim envelope As EnvelopeDefinition = MakeEnvelope(signerEmail, signerName, ccEmail, ccName, templateId)
Dim result As EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, envelope)
Return result.EnvelopeId
End Function
Private Function MakeEnvelope(ByVal signerEmail As String, ByVal signerName As String) As EnvelopeDefinition
Dim buffer As Byte() = System.IO.File.ReadAllBytes(Config.docPdf)
Dim envelopeDefinition As EnvelopeDefinition = New EnvelopeDefinition()
envelopeDefinition.EmailSubject = "Please sign this document"
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "3"
envelopeDefinition.Documents = New List(Of Document) From {
doc1
}
Dim signer1 As Signer = New Signer With {
.Email = signerEmail,
.Name = signerName,
.ClientUserId = signerClientId,
.RecipientId = "1"
}
Dim signHere1 As SignHere = New SignHere With {
.AnchorString = "/sn1/",
.AnchorUnits = "pixels",
.AnchorXOffset = "10",
.AnchorYOffset = "20"
}
Dim signer1Tabs As Tabs = New Tabs With {
.SignHereTabs = New List(Of SignHere) From {
signHere1
}
}
signer1.Tabs = signer1Tabs
Dim recipients As Recipients = New Recipients With {
.Signers = New List(Of Signer) From {
signer1
}
}
envelopeDefinition.Recipients = recipients
envelopeDefinition.Status = "sent"
Return envelopeDefinition
End Function
I want to pass phone number to verify once open document from email. Anybody help in this feature will appreciated.
Thanks and Regards
Aravind

https://developers.docusign.com/docs/esign-rest-api/how-to/phone-auth/
Dim workflow As RecipientIdentityVerification = New RecipientIdentityVerification() With {
.WorkflowId = workflowId,
.InputOptions = New List(Of RecipientIdentityInputOption) From {
New RecipientIdentityInputOption With {
.Name = "phone_number_list",
.ValueType = "PhoneNumberList",
.PhoneNumberList = New List(Of RecipientIdentityPhoneNumber) From {
New RecipientIdentityPhoneNumber With {
.Number = phoneNumber,
.CountryCode = countryAreaCode
}
}
}
}
Since we don't have VB.NET examples, I used this site to convert C# code.
}

Related

How to pass DocuSign email EmailBlurb for each signer?

I have create envelope and pass signer,document, position to sign.So in that i need to pass EmailBlurb for each signer separately.Form Docusing web ui can set using following option and each signer get different message.
So how to pass this message from Docusing code, here the piece of code which i pass 2 signers
Private Function MakeEnvelope(ByVal signerEmail As String, ByVal signerName As String) As EnvelopeDefinition
Dim buffer As Byte() = System.IO.File.ReadAllBytes(Config.docPdf)
Dim envelopeDefinition As EnvelopeDefinition = New EnvelopeDefinition()
envelopeDefinition.EmailSubject = "Please sign this document"
envelopeDefinition.EmailBlurb ="Dear. A Thanks and regards" ' this will appear for both signer
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "1"
envelopeDefinition.Documents = New List(Of Document) From {
doc1
}
Dim signer1 As Signer = New Signer With {
.Email = signerEmail,
.Name = signerName,
.ClientUserId = signerClientId,
.RecipientId = "1"
}
Dim signer2 As Signer = New Signer With {
.Email = signerEmail2,
.Name = signerName2,
.ClientUserId = signerClientId2,
.RecipientId = "2"
}
This will appear for both signer as same message, i need to make each signer name need to show there.
envelopeDefinition.EmailBlurb ="Dear. A Thanks and regards"
This article shows how to do that in six langs, including C#. I have converted the C# to VB.NET for you and here it is:
Dim signer1 As Signer = New Signer With {
.Email = "inbar#example.com",
.Name = "Inbar Gazit",
.RecipientId = "1",
.RoutingOrder = "1",
.EmailNotification = New RecipientEmailNotification With {
.EmailSubject = "Custom email subject for signer 1",
.EmailBody = "Custom email body for signer 1"
}
}Z

How to add Name field in Docusing envelope?

Currently i can create envelope with signers dynamically, now i want to add Name field above the signer, i using below code to set Auto search Text.
' Document
Dim doc1 As Document = New Document With {
.DocumentBase64 = doc1DocxBytes,
.Name = ext1(0),
.FileExtension = ext1(1),
.DocumentId = "1"
}
env.Documents = New List(Of Document) From {
doc1
}
'Signer1
Dim signer1 As Signer = New Signer With {
.Email = signerEmail,
.Name = signerName,
.RecipientId = "1",
.RoutingOrder = "1"
}
Dim signHere212 As SignHere = New SignHere With {
.AnchorString = "For and on behalf of the vendor",
.AnchorUnits = "pixels",
.AnchorYOffset = "70",
.AnchorXOffset = "20"
}
Dim fullName212 As FullName = New FullName With {
.AnchorString = "For and on behalf of the vendor",
.AnchorUnits = "pixels",
.AnchorYOffset = "100",
.AnchorXOffset = "20"
}
Dim signer1Tabs As Tabs = New Tabs With {
.SignHereTabs = New List(Of SignHere) From {
signHere212
},
.FullNameTabs = New List(Of FullName) From {
fullName212
}
}
signer1.Tabs = signer1Tabs
Dim recipients As Recipients = New Recipients With {
.Signers = New List(Of Signer) From {
signer1
}
}
env.Recipients = recipients
env.Status = "sent"
Dim envelopeEvents = New List(Of EnvelopeEvent)()
envelopeEvents.Add(New EnvelopeEvent With {
.EnvelopeEventStatusCode = "completed",
.IncludeDocuments = "true"
})
eventNotification.EnvelopeEvents = envelope
From above code i placed sign on the top of "For and on behalf of the vendor", now i want Name field to add Name when signer sign the document.Please provide piece of code.
Dim fullName212 As FullName = New FullName With {
.AnchorString = "For and on behalf of the vendor",
.AnchorUnits = "pixels",
.AnchorYOffset = "70",
.AnchorXOffset = "20"
}
Dim signer1Tabs As Tabs = New Tabs With {
.SignHereTabs = New List(Of SignHere) From {
signHere1
},
.FullNameTabs = New List(Of FullName) From {
fullName212
}
signer1.Tabs = signer1Tabs
Dim recipients As Recipients = New Recipients With {
.Signers = New List(Of Signer) From {
signer1
}
}

Docusing i want to send additional file in same envelope id using vb.net

i am using following code to send file with create envelope and signer and where to sign.
Imports System
Imports System.Collections.Generic
Imports DocuSign.eSign.Api
Imports DocuSign.eSign.Client
Imports DocuSign.eSign.Model
Imports Microsoft.AspNetCore.Mvc
Private Function DoWork(ByVal signerEmail As String, ByVal signerName As String, ByVal ccEmail As String, ByVal ccName As String, ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal templateId As String) As String
Dim config = New Configuration(New ApiClient(basePath))
config.AddDefaultHeader("Authorization", "Bearer " & accessToken)
Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config)
Dim envelope As EnvelopeDefinition = MakeEnvelope(signerEmail, signerName, ccEmail, ccName, templateId)
Dim result As EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, envelope)
Return result.EnvelopeId
End Function
Private Function MakeEnvelope(ByVal signerEmail As String, ByVal signerName As String) As EnvelopeDefinition
Dim buffer As Byte() = System.IO.File.ReadAllBytes(Config.docPdf)
Dim envelopeDefinition As EnvelopeDefinition = New EnvelopeDefinition()
envelopeDefinition.EmailSubject = "Please sign this document"
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "3"
envelopeDefinition.Documents = New List(Of Document) From {
doc1
}
Dim signer1 As Signer = New Signer With {
.Email = signerEmail,
.Name = signerName,
.ClientUserId = signerClientId,
.RecipientId = "1"
}
Dim signHere1 As SignHere = New SignHere With {
.AnchorString = "/sn1/",
.AnchorUnits = "pixels",
.AnchorXOffset = "10",
.AnchorYOffset = "20"
}
Dim signer1Tabs As Tabs = New Tabs With {
.SignHereTabs = New List(Of SignHere) From {
signHere1
}
}
signer1.Tabs = signer1Tabs
Dim recipients As Recipients = New Recipients With {
.Signers = New List(Of Signer) From {
signer1
}
}
envelopeDefinition.Recipients = recipients
envelopeDefinition.Status = "sent"
Return envelopeDefinition
End Function
i take working solution from this link In Docusign using with Chilkat dll , how to pass templateRoles in json? by Inbar Gazit. i can send and get envelope id as return summary.
Now i want to add additional file which first file is signed by all signer. Same like again need to add 3rd file which 2nd file is signed by all signer in same envelope id. We use docusign connect to trigger event when signed by all signer.So we know document is singed by all signer or not.
In what way we can add additional document in same envelope id and send it again using Docusing dll. i have working c# project which download from docusign quickstart in that got 31 examples.
Note i am not use docusing rest or soap api.
Eg: We have machinery product company, First we send agreement related to product and prices to the signer, once get back agreement file signed by all, then we deploy and setup machinery in customer place once done ,then we send second acknowledge document to singer, once signed by all , filly we send finishing contract document. So we send all 3 files in same envelopeid in one by one.
Regards and Thanks
Aravind
I think you just want one more document, then it's simple, add/change this code:
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "3"
Dim doc2 As Document = New Document()
Dim doc2b64 As String = Convert.ToBase64String(buffer2)
doc2.DocumentBase64 = doc2b64
doc2.Name = "Second doc"
doc2.FileExtension = "pdf"
doc2.DocumentId = "4"
envelopeDefinition.Documents = New List(Of Document) From {
doc1, docs2
}

DocuSign using Chilkat dll, how do I pass templateRoles in json?

I am creating demo application which Docusing pass file and signer dynamically, for that i need to use docusign templateid and pass details, i can pass file using templateid which signer already defined in template itself, now i want to pass multiple signer as dynamically.For that need to use templateRoles.
Dim json As New Chilkat.JsonObject
json.UpdateString("documents[0].name", "Testing.pdf")
json.UpdateString("documents[0].documentBase64", base64String)
json.UpdateString("documents[0].documentId", "2")
json.UpdateString("emailSubject", "DocuSign REST API Testing Sample")
json.UpdateString("emailBlurb", "Create and send an envelope from a document.")
json.UpdateString("templateId", "xxxxx-xxxxx-xxxxx-xxxx-xxxx")
json.UpdateString("templateRoles", "{roleName: Signer 1, name: Aravind, email: aravind#gmail.com, recipientId: 1}") ' Here i pass template role for signer 1, and also need to pass multiple signer.
json.UpdateString("status", "sent")
rest.AddHeader("X-DocuSign-Authentication", "{ ""Username"": ""DocuSign#example.com"", ""Password"":""DocuSign_password"", ""IntegratorKey"":""DocuSign_Integrator_Key"" }")
rest.AddHeader("Content-Type", "application/json")
rest.AddHeader("Accept", "application/json")
Dim sbRequestBody As New Chilkat.StringBuilder
json.EmitSb(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST", "/restapi/v2.1/accounts/xxxxxx/envelopes", sbRequestBody, sbResponseBody)
Dim respStatusCode As Integer = rest.ResponseStatusCode
Here i paste code for ur reference, in that email,password,key everything i chanage,bcz it releted to security purpose.
When i pass templateroles with values i get error.For above code i get following error return from api.
"errorCode":"INVALID_REQUEST_PARAMETER","message":"The request
contained at least one invalid parameter. 'recipientId' not set for
recipient."
Pls help me to solve this error.
Regards,
Aravind
Here is code using the SDK:
Imports System
Imports System.Collections.Generic
Imports DocuSign.eSign.Api
Imports DocuSign.eSign.Client
Imports DocuSign.eSign.Model
Imports Microsoft.AspNetCore.Mvc
Private Function DoWork(ByVal signerEmail As String, ByVal signerName As String, ByVal ccEmail As String, ByVal ccName As String, ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal templateId As String) As String
Dim config = New Configuration(New ApiClient(basePath))
config.AddDefaultHeader("Authorization", "Bearer " & accessToken)
Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config)
Dim envelope As EnvelopeDefinition = MakeEnvelope(signerEmail, signerName, ccEmail, ccName, templateId)
Dim result As EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, envelope)
Return result.EnvelopeId
End Function
Private Function MakeEnvelope(ByVal signerEmail As String, ByVal signerName As String) As EnvelopeDefinition
Dim buffer As Byte() = System.IO.File.ReadAllBytes(Config.docPdf)
Dim envelopeDefinition As EnvelopeDefinition = New EnvelopeDefinition()
envelopeDefinition.EmailSubject = "Please sign this document"
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "3"
envelopeDefinition.Documents = New List(Of Document) From {
doc1
}
Dim signer1 As Signer = New Signer With {
.Email = signerEmail,
.Name = signerName,
.ClientUserId = signerClientId,
.RecipientId = "1"
}
Dim signHere1 As SignHere = New SignHere With {
.AnchorString = "/sn1/",
.AnchorUnits = "pixels",
.AnchorXOffset = "10",
.AnchorYOffset = "20"
}
Dim signer1Tabs As Tabs = New Tabs With {
.SignHereTabs = New List(Of SignHere) From {
signHere1
}
}
signer1.Tabs = signer1Tabs
Dim recipients As Recipients = New Recipients With {
.Signers = New List(Of Signer) From {
signer1
}
}
envelopeDefinition.Recipients = recipients
envelopeDefinition.Status = "sent"
Return envelopeDefinition
End Function
Try to remove recipientId: 1 from the JSON in line 8.
But I strongly suggest you reconsider your architecture choices.
You are using legacy authentication which is not very secure.
You could use the C# SDK, which is a Nuget package and works just as well with VB.NET and that would help you make these calls without using JSON and also using modern OAuth that is much more secure.

Asynchronously sending Emails in VB.net?

Public Async Function SendEmail(ByVal EmailToIds As String, ByVal Subject As String, ByVal Message As String, Optional ByVal EmailCcIds As String = "", Optional ByVal MailAttachment As String = "", Optional ByVal FromEmailType As Integer = 0, Optional EmailBccIds As String = "") As Task
Dim EmailPwd() As String
Dim FromEmail, Password As String
'Dim objSmtp As SmtpClient
Dim objMail As MailMessage
Dim objAttachment As Attachment
Try
EmailPwd = GetEmailPassword(FromEmailType).Split("|")
FromEmail = EmailPwd(0)
Password = EmailPwd(1)
objMail = New MailMessage
objMail.From = New MailAddress(FromEmail)
objMail.Subject = Subject
objMail.IsBodyHtml = True
objMail.Body = Message
objMail.To.Add(EmailToIds)
If Len(EmailCcIds) > 0 Then
objMail.CC.Add(EmailCcIds)
End If
If Len(EmailBccIds) > 0 Then
objMail.Bcc.Add(EmailBccIds)
End If
If MailAttachment <> "" Then
objAttachment = New Attachment(MailAttachment)
objMail.Attachments.Add(objAttachment)
End If
Using objSmtp = New SmtpClient()
objSmtp.Host = ConfigurationSettings.AppSettings("SmtpClient")
objSmtp.DeliveryMethod = SmtpDeliveryMethod.Network
objSmtp.UseDefaultCredentials = False
objSmtp.Credentials = New NetworkCredential(FromEmail, Password)
objSmtp.Port = 587
objSmtp.EnableSsl = True
ServicePointManager.ServerCertificateValidationCallback = Function(s As Object, certificate As X509Certificate, chain As X509Chain, sslPolicyErrors As SslPolicyErrors) True
Await objSmtp.SendMailAsync(objMail)
End Using
Catch ex As Exception
Throw Ex
End Try
End Function
Getting Error : Failure sending mail.
Please help me to do this.
Thank You So much in Advance.