0

I've run into an issue when trying to create an envelope from a template. I can't add auth options to a template role, and I can't use recipients (where I could add the auth options) if I'm creating from a template.

{
"status": "sent",
"emailBlurb": "testing creation from template",
"emailSubject": "Please sign this template",
"templateId": "3f35473e-884a-4jf2-a9b5-19eahc4a9b8f",
"templateRoles": [{
        "name": "Lllll",
        "email": "l@someplace.com",
        "roleName": "Signer 1",
        "clientUserId": "1000",
        "inPersonSignerName": "John Jay",
        "routingOrder": "1",
        "requireIdLookUp": "true",
        "idCheckConfigurationName": "SMS Auth $",
        "smsAuthentication": {
            "senderProvidedNumbers": ["+376636355"]
        }}, {
            "name": "Jjj",
            "email": "j@someplace.com",
            "roleName": "Signer 2",
            "clientUserId": "2000",
            "routingOrder": "2"
        }, {
            "name": "Zzzzzz",
            "email": "z@someplace.com",
            "roleName": "Signer 3",
            "clientUserId": "3000",
            "routingOrder": "3"
        }
        ],
        "customFields": {
            "textCustomFields": [{
                    "value": "3489y333n",
                    "required": "false",
                    "show": "false",
                    "name": "##SFContract"
                }
            ]
        },
        "eventNotification": {
            "RecipientEvents": [{
                    "recipientEventStatusCode": "Completed"
                }, {
                    "recipientEventStatusCode": "sent"
                }, {
                    "recipientEventStatusCode": "delivered"
                }, {
                    "recipientEventStatusCode": "declined"
                }
            ],
            "EnvelopeEvents": [{
                    "envelopeEventStatusCode": "Delivered"
                }, {
                    "envelopeEventStatusCode": "completed"
                }, {
                    "envelopeEventStatusCode": "sent"
                }, {
                    "envelopeEventStatusCode": "Declined"
                }
            ]
        },
    }
    '

This creates the envelope, but is not showing the auth screen.

Is there a way around this? Have you been able to create an Envelope from a template and add authentication? I've been thinking that composite templates might be able to help, but documentation and examples are sparse.

Thanks!

Larry K
  • 47,808
  • 15
  • 87
  • 140
lvelasco
  • 46
  • 1
  • 7

2 Answers2

1

You will have to use CompositeTemplates which gives more flexibility when creating envelopes from templates.

The following example should work. Link to documentation

POST /v2/accounts/{accountId}/envelopes

{
    "status": "sent",
    "emailBlurb": "testing creation from template",
    "emailSubject": "Please sign this template",
    "compositeTemplates": [
        {
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "3f35473e-884a-4jf2-a9b5-19eahc4a9b8f"
                }
            ],
            "inlineTemplates": [
                {
                    "sequence": "1",
                    "recipients": {
                        "signers": [
                            {
                                "name": "Lllll",
                                "email": "l@someplace.com",
                                "roleName": "Signer 1",
                                "recipientId": "1",
                                "clientUserId": "1000",
                                "inPersonSignerName": "John Jay",
                                "requireIdLookUp": "true",
                                "idCheckConfigurationName": "SMS Auth $",
                                "smsAuthentication": {
                                    "senderProvidedNumbers": [ "+376636355" ]
                                }
                            },
                            {
                                "name": "Jjj",
                                "email": "j@someplace.com",
                                "roleName": "Signer 2",
                                "clientUserId": "2000",
                                "routingOrder": "2",
                                "recipientId": "2"
                            },
                            {
                                "name": "Zzzzzz",
                                "email": "z@someplace.com",
                                "roleName": "Signer 3",
                                "clientUserId": "3000",
                                "routingOrder": "3",
                                "recipientId": "3"
                            }
                        ]
                    },
                    "customFields": {
                        "textCustomFields": [
                            {
                                "value": "3489y333n",
                                "required": "false",
                                "show": "false",
                                "name": "##SFContract"
                            }
                        ]
                    },
                }
            ]
        }
    ],
    "eventNotification": {
        "RecipientEvents": [
            { "recipientEventStatusCode": "Completed" },
            { "recipientEventStatusCode": "sent" },
            { "recipientEventStatusCode": "delivered" },
            { "recipientEventStatusCode": "declined" }
        ],
        "EnvelopeEvents": [
            { "envelopeEventStatusCode": "Delivered" },
            { "envelopeEventStatusCode": "completed" },
            { "envelopeEventStatusCode": "sent" },
            { "envelopeEventStatusCode": "Declined" }
        ]
    }
}
Praveen Reddy
  • 7,295
  • 2
  • 21
  • 43
  • Make sure you remove the `+` sign from the phone number as it does not accept special characters. – Praveen Reddy Jun 27 '17 at 18:03
  • are you sure about the `+` ? It is a pretty standard part of phone numbers indicating that the number includes the country code. – Larry K Jun 28 '17 at 04:58
  • I'm pretty sure about the + working with international codes, it's used in other API calls in our application.@CodingDawg I'll give this a try and let you know the results. – lvelasco Jun 28 '17 at 07:38
  • @CodingDawg There were some issues with your JSON, I managed to get it working with another one. It has brought another issue to light. – lvelasco Jun 28 '17 at 09:27
  • @ivelasco I dont think my answer has an issue. It addressed your question about including auth options when creating an envelope from a template. Looking at the Json you posted it seems like you need one of the signers to be InPerson signer rather than an remote signer. Thats something specific to your usecase and not relevant to this question. – Praveen Reddy Jun 28 '17 at 13:22
0

Using @CodingDawg 's answer as a base (thanks), I got the JSON to work like this:

{
"status": "sent",
"emailBlurb": "testing creation from template",
"emailSubject": "Please sign this template",
"compositeTemplates": [{
        "serverTemplates": [{
                "sequence": "1",
                "templateId": "3f35423e-884a-4bf2-a9b5-19eaac4a5b8f"
            }
        ],
        "inlineTemplates": [{
                "sequence": "1",
                "recipients": {
                    "inPersonSigners": [{
                            "name": "LLLLL",
                            "email": "LLLL@some.com",
                            "hostemail": "LLLLL@some.com",
                            "hostname": "LLLLLL",
                            "roleName": "Signer 1",
                            "recipientId": "1",
                            "clientUserId": "1000",
                            "signerName": "John Signer",
                            "signerEmail": "jsigner@ds.com",
                            "requireIdLookUp": "true",
                            "idCheckConfigurationName": "SMS Auth $",
                            "smsAuthentication": {
                                "senderProvidedNumbers": ["+34676363577"]
                            }
                        }
                    ],
                    "signers": [{
                            "name": "VVVVVVV",
                            "email": "v@onecompany.com",
                            "roleName": "Signer 2",
                            "clientUserId": "2000",
                            "routingOrder": "2",
                            "recipientId": "2"
                        }, {
                            "name": "ZZZZZ",
                            "email": "z@onecompany.com",
                            "roleName": "Signer 3",
                            "clientUserId": "3000",
                            "routingOrder": "3",
                            "recipientId": "3"
                        }
                    ]
                },
                "customFields": {
                    "textCustomFields": [{
                            "value": "8009E0000006Qu5QAJ",
                            "required": "false",
                            "show": "false",
                            "name": "##SFContract"
                        }
                    ]
                },
            }
        ]
    }
],
"eventNotification": {
    "RecipientEvents": [{
            "recipientEventStatusCode": "Completed"
        }, {
            "recipientEventStatusCode": "sent"
        }, {
            "recipientEventStatusCode": "delivered"
        }, {
            "recipientEventStatusCode": "declined"
        }
    ],
    "EnvelopeEvents": [{
            "envelopeEventStatusCode": "Delivered"
        }, {
            "envelopeEventStatusCode": "completed"
        }, {
            "envelopeEventStatusCode": "sent"
        }, {
            "envelopeEventStatusCode": "Declined"
        }
    ]
}

}

This will get you an envelope form a template and SMS Auth.

The problem with this JSON is that after completing the first part of the routing order the second and third signer are not getting their e-mails. I've asked another question about that.

Thanks

lvelasco
  • 46
  • 1
  • 7
  • @ivelasco .. My [answer](https://stackoverflow.com/a/44787002/1219543) should also create an envelope with SMS auth activated for the first recipient. – Praveen Reddy Jun 28 '17 at 13:30
  • If I use your JSON I get an incorrect signer type error, because it's using a inPersonSignerName inside a normal signer. – lvelasco Jun 28 '17 at 13:41
  • That depends on how your template is defined. My answer should work if the template has a regular signer. Looks like your template has an inPerson signer. – Praveen Reddy Jun 28 '17 at 13:44