Can Xano grab data from a web callback URL?
Hi Xano,
I am currently trying to integrate Square's point of sale API with Xano -
Originally I had planned to use a webhook where it would grab and utilise the data sent from Square. However, after some testing I have noticed Square adds the data onto your specified callback URL. I have provided an example below.
EG. callback URL: https://www.example.com?data=encoded_data_here)
I am receiving the data to my callback URL but I don't know how to get Xano to grab it out for me. Can Xano pull this data out from the URL and make use of it?
Thank you
Best Answer
-
Sounds like Square is not calling your Xano endpoint at all if you don't see the request in the history!
A common issue with webhooks is that some of them are based GET and others on POST. And Xano makes a separate "query" for each. If Square is sending a GET your POST endpoint will never receive it.
So I would try: make a new endpoint, set it to "GET" and give it the same name as your current one. See if Square talks to either of your endpoints.
Answers
-
Yes, Xano will look at the query string by means of the inputs on your function stack. If you have something in the URL coming into Xano called "?data=X&stuff=y" you can create an input called "data" of type "text" and you will find it holds the value "X". Similarly, creating an input called "stuff" will contain "y".
-
Thanks for the comment Ray. I have tried your recommendation and still not getting anything in the request history, which is normally the first thing I will go to check. If you don't mind I will put up some screenshots to see if you can identify the problem.
The below screenshot shows my square_callback_url webhook. I have the data as text in the input and use get all input encoding JSON.
My next screenshot shows what Square has posted to the callback URL. I do get the error code on the page which I am not sure about but the URL I have on the screenshot below matches what's in the Square dashboard to whats in the Xano webhook apart from "?data="
Any help would be much appreciated.
Thank you.
-
Hi @Ray Deck
Your answer was spot on. Just needed to change it to a GET request. I was under the impression all Xano webhooks needed to be a POST but you learn something new every day. :)
Categories
- 2.1K All Categories
- 43 π£ Announcements
- 32 π¦Ύ Releases
- 30 π Welcome
- 552 π€· Help! I'm a Noob
- 39 π± No-Code Front-Ends
- 419 π Working with APIs
- 278 π’ Transforming data
- 100 π Connect Xano to ...
- 13 π§βπ» Find an Expert
- 239 βOther questions
- 9 π Security
- 13 βοΈ Snippets
- 16 π Showcase
- 3 π£οΈ ο»Ώ Xano Chatter
- 49 πΊ Video Tutorials
- 156 π Request a feature
- 156 π Report a Bug
- 17 π Templates & Extensions
- π¬ Feedback