•   over 5 years ago

Webhooks not working

I'm trying to make use of the webhooks the API provides and cannot seem to do so. This is the procedure I am currently following:

I have a requestbin url that I have submitted as my webhook url in my app settings.

I get a request_id from my app, and then with the following python script change the status of the request

def main():
request_id = sys.argv[1]
status = sys.argv[2]
change_status(request_id, status)

def change_status(request_id, status):
params = {'status': status}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer bUXHiu5GJwzancKzUF58mcRa7kaDSN'}

res = requests.put('https://sandbox-api.uber.com/v1/sandbox/requests/'\
+ request_id, data=json.dumps(params), headers=headers)
print res.json

No post request is made to the URL however. The status does change as the print res.json does return a status code of 204. Any help with this would be great.

  • 17 comments

  •   •   over 5 years ago

    I guess they do not support http urls, only https.

  •   •   over 5 years ago

    I am also facing the same problem. I am using https for the webhook url in my application settings.
    I don't receive a callback from uber. Why is that?

    curl -X "PUT" "https://sandbox-api.uber.com/v1/sandbox/requests/xxxx-xxx-xxxx-xxxx-24xx882ebcxxx" -H "Authorization: Bearer rgP1pVgxxxxdXqgrznFxxxAufNjJy" -d "{\"status\":\"accepted\"}" -H "Content-Type: application/json" -D -
    HTTP/1.1 204 No Content
    Server: nginx
    Date: Mon, 27 Apr 2015 17:34:03 GMT
    Content-Type: text/html; charset=UTF-8
    Content-Length: 0
    Connection: keep-alive
    X-Rate-Limit-Remaining: 990
    Content-Language: en
    X-Rate-Limit-Reset: 1430157600
    X-Rate-Limit-Limit: 1000
    X-Uber-App: uberex-sandbox
    Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
    X-XSS-Protection: 1; mode=block

  •   •   over 5 years ago

    Hey, any update on this issue?

    I'm having the same problem with the webhook url not being called. I'm using https and have tried on both sandbox and prod. Polling the /v1/requests/{request_id} resource shows that the request changes state, but no callback received. ..??

  •   •   over 5 years ago

    Any update on this issue? I have mailed Uber API mail id also two days before and waiting for reply.

  • Manager   •   over 5 years ago

    Requestb.in will not work for testing Uber API webhooks because they do not support HTTPS.

    You should receive a callback request to your WEBHOOK URL every time you successfully request a ride in production or in the sandbox.

    A good way to check if your webhook endpoint is configuring correctly, is to use the following curl command:

    `curl -X "POST" -d '{"data":true}' --verbose`

    where is the value you have added to your application config. If that curl doesn't register a callback to your endpoint, something isn't setup correctly.

    Common issues:

    - Make sure you have the complete URL stored on the config page, e.g.: https://www.example.com/webhook
    - Make sure your SSL certificate is valid for the domain your endpoint is hosted on
    - Make sure you are listening for POST requests (most people listen for GETs by default)

  •   •   over 5 years ago

    I got this working finally :)
    The problem was the SSL key chain in my server.
    I got the webhooks received on my server after my fix.

    Thanks guys.

  •   •   over 5 years ago

    Still have not got this working. I created an app on parse. whose url is https://www.safewheels.parseapp.com/status and am using that as the webhook url. When I log request.body in the express framework I am using for the app, I am not receiving anything. No post request is being made to that url? Anything else I can try to get this working.

  •   •   over 5 years ago

    Nitin, The ssl certificate seems to be invalid.
    https://dl.pushbulletusercontent.com/XTJ5UMEpOG77YLioVaNZbjHlWrLfUvrT/Screenshot_2015-05-05-03-47-15.png

    I faced the same issue. Once i correct the certificate everything went fine.
    See wget throws the error.

    ban-1ed-m:ubrhck nmed$ wget -O /var/tmp/a.json "https://www.safewheels.parseapp.com/status"
    --2015-05-05 03:51:08-- https://www.safewheels.parseapp.com/status
    Resolving www.safewheels.parseapp.com... 107.23.120.166
    Connecting to www.safewheels.parseapp.com|107.23.120.166|:443... connected.
    ERROR: no certificate subject alternative name matches
    requested host name 'www.safewheels.parseapp.com'.
    To connect to www.safewheels.parseapp.com insecurely, use `--no-check-certificate'.

    I see the https certificate being proper for "https://safewheels.parseapp.com/status" though.
    ban-1nahmed-m:ubrhck nahmed$ wget -O - "https://safewheels.parseapp.com/status"
    --2015-05-05 03:53:46-- https://safewheels.parseapp.com/status
    Resolving safewheels.parseapp.com... 54.88.100.109
    Connecting to safewheels.parseapp.com|54.88.100.109|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 151 [text/html]
    Saving to: 'STDOUT'

    0% [ ] 0 --.-K/s


    Uber Status


    Uber Status
    fudge machine

    100%[==================================================================================================================================================================>] 151 --.-K/s in 0s

    2015-05-05 03:53:48 (12.0 MB/s) - written to stdout [151/151]

    You edit your Webhook URL and retry.

  •   •   over 5 years ago

    Hmm, I tried taking out the www but still nothing. Don't know if you have any experience with parse but the way I'm checking if I receive anything is by looking at the logs. I do console.log(req.body.event_id), but nothing happens. Does the request need to have a new id for it to send a post request, a lot of times when working with the sandbox api, I get the same request id for any ride I create, then after a while I start getting a new request id. Thanks for all the help so far!

  •   •   over 5 years ago

    As the moderator recommended, we need to check whether our endpoint is good at receiving post data.

    bn-1nmed-m:ubrhck nmed$ wget -O - "https://safewheels.parseapp.com/status" --post-data '{"data": "dummy"}' --header "Content-Type: application/json"
    --2015-05-05 04:05:44-- https://safewheels.parseapp.com/status
    Resolving safewheels.parseapp.com... 54.236.154.35
    Connecting to safewheels.parseapp.com|54.236.154.35|:443... connected.
    HTTP request sent, awaiting response... 500 Internal Server Error
    2015-05-05 04:05:45 ERROR 500: Internal Server Error.

    I see your server crashing when i send post data, whereas my server is accepting post data.

  •   •   over 5 years ago

    Ahh I see. What kind of server are you using to get accept the post data? It seems strange to me that I get no notification of that through the parse logs that the post request is failing. Will look into this further. Thanks!

  •   •   over 5 years ago

    I have a dedicated debian machine with a public IP.
    I know parse.com but haven't used their APIs.
    You make that wget is working by setting up an endpoint receiving post data. Also don't use "www" since the certificate is not valid there.

    Awaited to see you get on track.
    Best wishes Nitin!

  •   •   over 5 years ago

    Hi Ahmed,

    I corrected both the issues and still am not receiving anything at the url. I should be getting a post request from uber every time I create a new ride or change the status of a ride correct?

    Here's the server name, I tried it in an ssl checker, and running the command you posted above, both work well, but again, nothing from uber when I create a ride:

    https://arcane-taiga-6284.herokuapp.com

    https://arcane-taiga-6284.herokuapp.com/status for post requests

  • Manager   •   over 5 years ago

    Can you please provide me with your client_id so I can look into our logs? Thanks.

  •   •   over 5 years ago

    Yep no problem, here you go!

    oShtBtA4Lh44kNEsUsDl2cFavZkJsTfs

  •   •   over 5 years ago

    Hmm I got it working now. Changed the webhook url to not include the https:// and also am using the owner's account access token as opposed to another developer's access token I had added to the app.

  • Manager   •   over 5 years ago

    Glad you got it resolved Nitin!

Comments are closed.