Drafting, Approving and Sending documents in PandaDoc via Make

Hi all!

I work for an org where we send at least 170 contracts a week, we need to draft these contracts, have them approved and then send them off. Managed to get the drafting and approving working a treat.

Wondering how I could send the documents after they’ve been drafted and approved though :confused:

Followed these instructions here Send Document
and was able to get Make to send the documents but adding the subject and message into the email line isn’t working.

Any help appreciated!

_SadGoldfish

can you paste the input and output of that module here. then we can help

1 Like

[
{
“url”: “/public/v1/documents/HHbhLX4eEqVjEW64Rxw3aE/send”,
“body”: “{"Data":{"Silent":true,"Message":"This is a test","Subject":"Your Auspicious Arts Project Contract"}}”,
“method”: “POST”,
“headers”: [
{
“key”: “Content-Type”,
“value”: “application/json”
}
]
}
]

[
{
“body”: {
“id”: “HHbhLX4eEqVjEW64Rxw3aE”,
“name”: “Martha Test 100”,
“status”: “document.sent”,
“date_created”: “2022-09-01T00:37:13.859926Z”,
“date_modified”: “2022-09-01T06:45:42.888177Z”,
“date_completed”: null,
“expiration_date”: “2032-08-29T06:45:42.629477Z”,
“version”: “2”,
“uuid”: “HHbhLX4eEqVjEW64Rxw3aE”,
“recipients”: [
{
“id”: 165444471,
“first_name”: “wrong”,
“last_name”: “Latham”,
“email”: “martha@auspicious.com.au”,
“recipient_type”: “CC”,
“signing_order”: null,
“shared_link”: “PandaDoc
}
]
},

1 Like

Hi,

I don’t know the specifics of PandaDoc but in the Documentation is says " You can send a document only for documents with a document.draft status.".

It seems to me that your document has the status “document.sent”. May that be the issue?

Best,
Richard

Hey Richard,

Thank you for your input but I’ve tried many times with the document in the sent and draft and in either case it does seem to read the “Data” section :confused:

MJ

Hi, there something weird about your data section, where does it come from? Who generated it?

Quotes don’t seem properly generated.
Instead of
“{"Data":{"Silent":true,"Message":"This is a test","Subject":"Your Auspicious Arts Project Contract"}}”,
I’d try with
{"Data":{"Silent":true,"Message":"This is a test","Subject":"Your Auspicious Arts Project Contract"}},
or
“{\"Data\":{\"Silent\":true,\"Message\":\"This is a test\",\"Subject\":\"Your Auspicious Arts Project Contract\"}}”,

If the later works, you should use a json escape function to encode it properly.

1 Like

Hi Beaver!

Thanks so much. Sadly I’m not sure why it’s generating that way :confused:

I managed to use a “Parse JSON” module to make it with the forward slash as suggested. However it still continued to not send properly :frowning:

[
    {
        "qs": [
            {
                "Silent": true,
                "Message": "This is a test",
                "Subject": "Your Auspicious Arts Project Contract"
            }
        ],
        "url": "/public/v1/documents/HHbhLX4eEqVjEW64Rxw3aE/send",
        "body": "{\"Data\":{\"Silent\":true,\"Message\":\"This is a test\",\"Subject\":\"Your Auspicious Arts Project Contract\"}}",
        "method": "POST",
        "headers": [
            {
                "key": "Content-Type",
                "value": "application/json"
            }
        ]

I think you’re absolutely right. The issue is that it sees the whole body as text rather than code.

The issue seems to be in the PandaDocs “Make an API Call”. After some digging in Panda’s API info I found this:

const settings = {
  async: true,
  crossDomain: true,
  url: 'https://api.pandadoc.com/public/v1/documents/id/send',
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json'
  },
  processData: false,
  data: '{"subject":"This is my subject","message":"Hello! This document was sent from the PandaDoc API.","silent":false}'
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Do you think the ProcessDate:false has anything to do with this? how do i make that ProcessData:true in Make?

Give us the error and response message, that’ll help to find the problem.

But indeed, if the recipient is expecting an exact structure, you can try these 2 things:

  1. Add processData
{"processData": false,
"data": ...}
  1. I see that you’ve added “data” to your structure which wasn’t in the first payload. Try no to add it. in the http request, it’s similar to body, it’s not part of the structure, it’s just to tell the request that this is the content to send. So just do:
{
"Subject": "eve",
"Message": "her", ...
}
1 Like