Hi,
One of my supplier need to connect and get datas from me with Airtable. He wants to do it with a webhook. I started with a web App but could not get it to work and ended up with a desktop App.
Using postman I can reach my app and my app send back “200 OK” and postman receive it well.
When the supplier send datas with Airtable I can read them but Airtable times out because it never receive a feedback from me. I suppose it’s because “200 OK” is not what it expect to get…
Here is what I get from Airtable through http://MyIpAddress:8081/webhook
**POST /webhook HTTP/1.1Host: 92.173.85.1:8081sentry-trace: fc85924cb1724a38aa6a73be09ebc2bc-b542b3bb14b831c7-0User-Agent: ZapierAccept-Encoding: gzip, deflate, brAccept: /Connection: keep-aliveContent-Type: application/json; charset=utf-8Content-Length: 48x-datadog-trace-id: 2110273769097866701x-datadog-parent-id: 13390451017487162922x-datadog-sampling-priority: 1traceparent: 00-00000000000000001d4932cff1e72dcd-b9d4704137971e2a-01tracestate: dd=s:1{“”: “80”, “_1”: “70”, “_2”: “RGB”, “_3”: “24V”}
I am using a server socket listening to port 8081 and here’s the code in datavaialable
Var input As String = Me.ReadAll
Me.Write("HTTP/1.1 200 OK" + EndOfLine.CRLF)
Me.Write("Content-Type: text/plain" + EndOfLine.CRLF)
Me.Write("Connection: close" + EndOfLine.CRLF)
Me.Write(EndOfLine.CRLF) // Marquer la fin des en-têtes avec CRLF
Me.Flush
me.Close
If input.IndexOf("POST") <> -1 Then
// Afficher toute la requête brute reçue
'Données.TfListen.Text=input
MessageBox("Requête brute reçue : " + EndOfLine + input)
end
Thanks
Chris
I’m a little confused between your two posts, let’s clarify some basics:
- Which direction do you intend to communicate? From Airtable to Xojo? From Xojo to Airtable? Both?
- That successful message from Airtable, was that recieved by your Web App or Desktop App?
- You are able to successfully reach a Desktop TCPSocket but not a Web App?
- Not to be rude, just to really check, do you know how to use the HandleURL system to build a Webhook Listener? You have to respond with
200
so that Airtable knows the message was received.
We’re missing some key factor that’s causing you to have trouble listening to Airtable, but from your descriptions, I’m not quite sure what.
Hi Tim,
Thanks for you help 
First, I have never heard about a webhook until a few days ago and I am not sure to really understand how it works
I use xojo to make small apps to help run my small business. One of them helps me to calculate custom product prices and make a drawing of them to send out to customers.
The supplier wants to use airtable to send to my App the datas to calculate the custom price and retrieve that price and the drawing. To my understanding it has to be in both direction.
For exemple you can see at the end of the post from Airtable 80, 70, RGB, 24V, these are datas to calculate the custom price. My idea was to retrieve the datas run my App to calculate the price and send out the price.
Therefore to your question 1, I would answer both direction.
2/ I could not manage so far to receive datas from postman or airtable with my web App
The desktop App works well, I can receive datas and postman receive the datas I send back
Me.Write("HTTP/1.1 200 OK" + EndOfLine.CRLF)
But airtable just time out saying it’s not getting answer back from me
3/ yes desktop works but not the web App
4/ You are right I have only use mojo to make a web app once and I did not have to use handleURL. But I have read you are supposed to send back 200 and I did in both APP
If Request.Method = "POST" Then
// Récupérer les données du formulaire envoyées par le webhook
Var largeur As String = Request.Parameter("largeur")
Var hauteur As String = Request.Parameter("hauteur")
Var couleur As String = Request.Parameter("couleur")
Var type As String = Request.Parameter("type")
// Construire le texte à afficher dans TFEcout
Var texte As String = "Largeur: " + largeur + ", Hauteur: " + hauteur + ", Couleur: " + couleur + ", Type: " + type
// Assigner la valeur au WebTextField appelé TFEcout
Données.TFEcout.Value = texte
// Répondre au serveur webhook avec un statut 200 et un message de succès
Response.Status = 200
Response.MIMEType = "text/plain"
Response.Write("Données reçues avec succès")
// Indiquer que la requête a été traitée avec succès
Return True
End If
// Si ce n'est pas une requête POST, retourner False pour indiquer que la requête n'a pas été gérée
Return False
But in the web App I don’t even seem to receive the datas…
I hope things are more clear for you now.
Postman receive my answer 200 OK every time but not airtable. It’s why I thought maybe I needed to add some kind of ID in my answers instead of just 200 OK. Or maybe use json to answer?
Chris
Hi,
I was away and could not work on it for a while. Meanwhile Airtable start to receive my answer in time 
// Répondre immédiatement avec des en-têtes correctement formatés
Me.Write("HTTP/1.1 200" + EndOfLine.CRLF)
Me.Write("Content-Type: text/plain" + EndOfLine.CRLF)
Me.Write("Connection: close" + EndOfLine.CRLF)
Me.Write(EndOfLine.CRLF) // Marquer la fin des en-têtes avec CRLF
and after a couple test, I finally could send text Airtable could understand. I had to use json formatting :
Var jsonResponse As New JSONItem
jsonResponse.Value("status") = "ok"
jsonResponse.Value("message") = "response"
jsonResponse.Value("received") = True // Ajouter un champ indiquant le succès
The last thing I have to do is display a drawing of the product but it has to be on an url in order for airtable to be able to use it.
Is it possible to display a webpage with a Xojo desktop App ?
Thanks
Chris
Yes, use a DesktopHTMLViewer.
My objective is to send an image to airtable, do you know if it’s possible through webhook?
If not, the people using Airtable told me they could connect to an url and change it into a pdf they could use.
HTMLViewer can display an url and accept picture drop. But I did not think it was possible to connect to it like a webpage on a website?
Thanks
Chris
Since I have to display my image on an url for Airtable to be able to use it, I am switching back to a Web App
Thanks for your helps
Chris