Question

Connecting to an external API

  • 28 May 2021
  • 7 replies
  • 2628 views

I am in the process of seeing what my best option will be for a form on my website that will connect to an API and then put that information into an application. I have all of the API documentation. The problem is I am not seeing where I can create a “custom” webhook so when the prospect clicks on the “submit” button on the form it triggers the API and puts that data into my application. 


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

7 replies

Userlevel 7
Badge +14

Hi @smitty68521 

Check out the Webhooks app: https://zapier.com/apps/webhook/integrations

Your form will need to send data to the webhook generated from the Zap trigger step.

Then your Zap will need a webhook action step to send data to the desired API endpoint.

Thanks Troy. But the API I use submits a “Meta Data” and then below that is “data” something like this: 

 

{
"ID": "1234",
"date": "05-21/2021",
"data": {
"Type": "7.0",
"Customer": {
"Business": false,
"FirstName": "Groucho",
"LastName": "Marx",
"DateOfBirth": "1980-03-07"
}
}
}

When I use the “data” part to refer to what is in the JSON it seems to successfully send everything above “data” and then after that it stops with an error message from my api vendor “data” is missing. is there a way something like this is referred to in “Data” field when mapping it to the input value? I hope I’m making sense. 

Thank you for your help

Userlevel 7
Badge +14

Hi @smitty68521 

We’d need more information about the API and how that’s configured in order to further evaluate and advise.

Are you able to share more details?

TIP: Screenshots are helpful to convey context.

Thanks Troy. It’s an API that is “REST API” compatible. It uses the standard endpoint and api key to connect. The part above the “data” is the Meta Data that helps with the function of the interface that the form sends information to. So the work flow is: A form is filled out that will trigger an API POST request and send that information to the application I connect to and display it in an “Inbox”. The part above the Data is the Meta Data. when I used the tradtional key data mapping on Zapier I am able to get the meta data to go through just fine. However, when it hits the “data” part it does not recognize that as an “array” it seems and then gives an error message in the response “missing data” 

Here is a more clear snapshot of the JSON file I use. It seems like doing it the easy way where you map these fields to the form tags doesn’t recognize arrays. Is that the case? I am somewhat familiar with Python so if I need to use the “Zapier Code” how would I “map” those fields in the code? Does that make more sense? Thank You

 

{
"clientid": "123456789456",
"first_name": "John",
"middle_initial": "L",
"last_name": "Smith",
"phone_numbers": [{
"number": "813-456-7890",
"type": "mobile"
}],
"email": "user@gmail.com",
"state": "TX",
"postcode": "12345",
"origin": "website",
"country_code": "US",
"data": {
"Type": "1.0",
"Proposer": {
"Business": true,
"Forename": "John",
"Surname": "Smith",
"DateOfBirth": "1980-10-23",
"Phone": {
"CountryCode": "1",
"Number": "813-456-7890",
"CallPermission": "Obtained"
},
"FaxNumber": "(1)234-567-8901",
"EmailAddress": "user@gmail.com",
"Address": {
"AddressLine1": "123 Cool Street",
"AddressLine2": "Apartment 666",
"City": "Tampa Bay",
"State": "FL",
"Country": "USA",
"Postcode": "33602"
},
"Marketing": {
"Phone": true,
"Email": true,
"Sms": true,
"Fax": true,
"Post": true,
"ThirdParty": true
}
}
}
}

 

Userlevel 7
Badge +14

@smitty68521 

Are you able to show screenshots of the error and how you have the Zap steps configured?

Userlevel 3
Badge +6

Hey @smitty68521, hope you’re well, I just wanted to check in here!

Were you able to get things working or can we still help out?

Thank you for checking up William. The issues I am encountering are authenticating the API. It uses an API Key along with an additional “ID”. But you actually have to send them some data to get a 200 response. The way I am going to go about it is to go through the CLI and have the user put in their API Key and their ID as well. Then it will send through a JSON file that will actually send data and get a response. If it gives any other response then it will list it in the error console. 

With that being said, using the CLI will allow me to use the nested JSON objects more easily. I have been looking through the documentation to see how to accomplish this.  I am somewhat familiar with node.js so it will be  challenging but in a fun way.