Question

send webhooks error

  • 10 June 2022
  • 8 replies
  • 519 views

Our first time using Zapier, we have used two other products with the JSON payload below and it has worked fine but fails in Zapier.  With zapier using the same json we get invalid request.  Any reason why the json below would be an issue in zapier?

 

{ "planId": 1, "primaryEntityAttributes": { "_ZipCode": "12345", "_EmailAddress": "2@2.com", "_FirstName": "tim", "_LastName" : "jag", "_PhoneNumber" : "123456789", "_LiquidCapital" : "100K", "_City":"Tampa", "_StateLeadForm":"florida" } }


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

8 replies

Userlevel 7
Badge +14

Hi @ApolloTim 

Good question.

Check the notes below...

{
    "planId": 1,
    "primaryEntityAttributes": {
        "_ZipCode": "12345",
        "_EmailAddress": "2@2.com", // could be considered an invalid email address
        "_FirstName": "tim",
        "_LastName": "jag",
        "_PhoneNumber": "123456789", // only 9 digits
        "_LiquidCapital": "100K", // could be expecting a number (e.g. 100000)
        "_City": "Tampa",
        "_StateLeadForm": "florida" // could be expecting a proper state (e.g. Florida) or the state abbreviation (e.g. FL)
    }
}

Thanks Troy,

no issue the data validation, the side receiving has no validation and the exact same json payload was first tested in swagger and mailparser.io to the call.  Good news is the Zapier support sent me the log file, bad news is I’m not sure what changes I need to make so the receiving end is happy.  I have to assume given the exact same json, zapier interrupts it and formats it differently than swagger and mailparser.io, not saying one is right over the other just different.  

Api-Key: :censored:54:780012aeee:Content-Type: application/json; charset=utf-8Content-Length: 311X-Datadog-Trace-Id: 122663937423834957X-Datadog-Parent-Id: 53445189422819463X-Datadog-Sampling-Priority: 1{  "": "{\n  \"planId\": 1,\n    \"primaryEntityAttributes\": {\n    \"_ZipCode\": \"12345\",\n    \"_EmailAddress\": \"2@2.com\",\n\"_FirstName\": \"tim\",\n\"_LastName\" : \"jag\",\n\"_PhoneNumber\" : \"123456789\",\n\"_LiquidCapital\" : \"100K\",\n\"_City\":\"Tampa\",\n\"_StateLeadForm\":\"florida\"\n  }\n}"}--------------------------------------------------------------------------------RESPONSE--------------------------------------------------------------------------------404Cache-Control: privatePragma: no-cacheContent-Type: application/json; charset=utf-8Set-Cookie: ASP.NET_SessionId=za0thh4eja4rcaocs2yces1t; path=/; HttpOnlyX-Ua-Compatible: IE=edgeX-Content-Type-Options: nosniffX-Xss-Protection: 1;mode=blockDate: Fri, 10 Jun 2022 13:30:08 GMTContent-Length: 252{  "Message": "The request is invalid.",  "ModelState": {    "startModel": [      "Required property 'planId' not found in JSON. Path '', line 1, position 311."    ],    "planId": [      "Plan not found or access is denied"    ]  }}
Userlevel 7
Badge +14

@ApolloTim 

Can you post screenshots with how your Zap steps are configured along with the encountered error?

Troy,

 

the issue is the receiving sides does not like the start of the the json “”:  that zapier said is from the empty filed not used.  

 

Userlevel 7
Badge +14

@ApolloTim 

Try instead to use a Webhook - Custom Request

 

Userlevel 7
Badge +14

@ApolloTim 

Were you able to get the API request working using a Custom request?

no, it was much easier, just needed to enter it correctly and learning Zapier syntax, the double __ after the data name and then the child name I missed, once I got that it worked.  Thanks.  

 

I do have another issue when using a form payload and sending a file.  The api I’m calling is expecting a mutipart form with the data name for the file sent to be fileContent.  At the bottom is how Zapier is setup, and what zapier is sending 

 

 

Zapier setup

 

 

This is what zapier is sending 

 

{
resource: '/test',
  path: '/tools/test',
  httpMethod: 'POST',
  headers: {
    accept: '*/*',
    'accept-encoding': 'gzip, deflate',
    'api-key': '',
    'content-type': 'multipart/form-data; boundary=85bf59ffbbe44e44a1b120ddedc3567b',
    Host: 'data.gobull.com',
    'sentry-trace': '',
    'User-Agent': 'Zapier',
    'X-Amzn-Trace-Id': 'Root=2',
    'x-datadog-parent-id': '',
    'x-datadog-sampling-priority': '1',
    'x-datadog-trace-id': '',
    'X-Forwarded-For': '',
    'X-Forwarded-Port': '443',
    'X-Forwarded-Proto': 'https'
  },
  multiValueHeaders: {
    accept: [ '*/*' ],
    'accept-encoding': [ 'gzip, deflate' ],
    'api-key':  ],
    'content-type': [
      'multipart/form-data; boundary=85bf59ffbbe44e44a1b120ddedc3567b'
    ],
    Host: [ 'data.gobull.com' ],
    'sentry-trace': [ '' ],
    'User-Agent': [ 'Zapier' ],
    'X-Amzn-Trace-Id': [ 'Root=' ],
    'x-datadog-parent-id': [ '' ],
    'x-datadog-sampling-priority': [ '1' ],
    'x-datadog-trace-id': [ '' ],
    'X-Forwarded-For': [ '' ],
    'X-Forwarded-Port': [ '443' ],
    'X-Forwarded-Proto': [ 'https' ]
  },
  queryStringParameters: null,
  multiValueQueryStringParameters: null,
  pathParameters: null,
  stageVariables: null,
  requestContext: {
    resourceId: '6alm5u',
    resourcePath: '/test',
    httpMethod: 'POST',
    extendedRequestId: 'TrqpDGHbCYc',
    requestTime: '13/Jun/2022:22:46:17 +0000',
    path: '/tools/test',
    accountId: '',
    protocol: 'HTTP/1.1',
    stage: 'prod',
    domainPrefix: 'data',
    requestTimeEpoch: 1655160377775,
    requestId: '817b0581-6',
    identity: {
      cognitoIdentityPoolId: null,
      accountId: null,
      cognitoIdentityId: null,
      caller: null,
      sourceIp: ',
      principalOrgId: null,
      accessKey: null,
      cognitoAuthenticationType: null,
      cognitoAuthenticationProvider: null,
      userArn: null,
      userAgent: 'Zapier',
      user: null
    },
    domainName: ',
    apiId: ''
  },
  body: '--85bf59ffbbe44e44a1b120ddedc3567b\r\n' +
    'Content-Disposition: form-data; name="data"\r\n' +
    'Content-Type: application/x-www-form-urlencoded\r\n' +
    '\r\n' +
    'applicationId=1&documentTypeId=3\r\n' +
    '--85bf59ffbbe44e44a1b120ddedc3567b\r\n' +
    'Content-Disposition: form-data; name="file"; filename="color_bar.png"\r\n' +
    'Content-Type: image/png\r\n' +
    '\r\n' +
    '�PNG\r\n' +
    '\x1A\n' +
    '\x00\x00\x00\rIHDR\x00\x00\x04\x10\x00\x00\x00\x18\b\x02\x00\x00\x00�\x1B��\x00\x00\x00\x01sRGB\x00��\x1C�\x00\x00\x00\x04gAMA\x00\x00��\x0B�a\x05\x00\x00\x00\tpHYs\x00\x00\x12t\x00\x00\x12t\x01�f\x1Fx\x00\x00\x00\x12tEXtSoftware\x00Greenshot^U\b\x05\x00\x00\x01XIDATx^�١N�\x01\x18�a�L�2�j�F4X�\x16�F��f!�d07\b��\t�ME\x05\x1B�\n' +
    's�@�OxΞ�x���(\x16����l�4�R<O��\x1F/��go2��\x00\x00HP\x14Ee��ߎ����͇=(����q���\x1Dջc\x00\x00B�\x06�u\x7F��Sm�7�$\x1Bg�탻�ZkPk\r\x01\x00\b�\x17\f;��O0@i\x04\x03\x00@�U0\x14�\x0F��ʻ\x05%��\n' +
    '\x06\x00�<��\x10�\x01\x00 �` �`\x00\x00H$\x18\b!\x18\x00\x00\x12\t\x06B\b\x06\x00�D��\x10�\x01\x00 �` �`\x00\x00H$\x18\b!\x18\x00\x00\x12\t\x06B\b\x06\x00�D��\x10�\x01\x00 �` �`\x00\x00H$\x18\b!\x18\x00\x00\x12\t\x06B\b\x06\x00�D��\x10�\x01\x00 �` �`\x00\x00H$\x18\b!\x18\x00\x00\x12\t\x06B\b\x06\x00�D����j\x06(�`\x00\x00H�\f�\x1333333�u[\x06Õ�����ٺ\x15E�\r\x02�\x15 ���3\x00\x00\x00\x00IEND�B`�\r\n' +
    '--85bf59ffbbe44e44a1b120ddedc3567b--\r\n',
  isBase64Encoded: false
}

 

 

 

 

Userlevel 7
Badge +14

@ApolloTim 

The screenshot doesn’t show your Method URL or headers.