Can Xano grab data from a web callback URL?

Options

Hi Xano,
I am currently trying to integrate Square's point of sale API with Xano - https://developer.squareup.com/docs/pos-api/build-mobile-web

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

Tagged:

Best Answer

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Answer ✓
    Options

    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

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    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".

  • Tim McIntosh
    Tim McIntosh Member
    Options

    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.

  • Tim McIntosh
    Tim McIntosh Member
    Options

    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. :)