
Taylor Caldwell • over 8 years ago
Receipt Parsing documentation
I can't seem to find any documentation on the receipt parsing feature of the API. Maybe I'm looking in the wrong place. Can someone point me to more information regarding this?
Comments are closed.
15 comments
Tony Blank Manager • over 8 years ago
Hello Taylor,
Thanks for checking out our receipt parsing feature! Since it's in beta, we don't have any docs up on our site, but we put instructions on how to get started in the updates section here on ChallengePost: http://contextio.challengepost.com/updates/3621-using-the-context-io-receipt-parsing-feature
Let me know if you have any more questions - happy to help!
Cheers,
Tony
Norm N • over 8 years ago
Hi Tony+Dan, couple of questions on the receipt parsing:
1) is it possible to use something along the lines of account.get_messages(subject='subject', include_body=False) to get receipt data or do I have to use webooks?
2) the way I understand webhooks, it's only for new emails. To get the receipt data for existing emails, I have to first create a webhook and then add the source so once i add the new source all "new" emails/receipts will posted to the webhook?
3) have you got an example of the POST request? in particular what variable name contains the JSON data?
4) POST source - how does this deal with gmail/hotmail that requires OAuth2 tokens?
Tony Blank Manager • over 8 years ago
Hi Norm!
Hope you're doing well!
1) We'll work on making the "UI" better for our beta receipt parsing in the future, but for now, you have to use webhooks.
2) Yep, if you set up a new webhook with the receipt parsing param, you'll be notified of new emails. If you want to get the history, you have to do it when you add the user for the first time by making an account, making a webhook, then adding a source.
3) Email me and Dan (our product manager who has those samples) tony [at] context [dot] io and dan [at] context [dot] io
4) We just added a blog post that details how to add users without using our connect tokens. Check it out and let us know if you have any questions - happy to help! http://blog.context.io/2015/07/adding-a-user-with-context-io/
Happy hacking and good luck!
Tony
Norm N • over 8 years ago
As always thanks guys! Getting here... I don't seem to be receiving the post data, documentation says "When you receive the POST request from our servers, it is important to respond to it with a 200 before doing any additional processing.". I don't suppose you guys happen to know how to do that in python flask (or even django)?
Tony Blank Manager • over 8 years ago
If the view is set to accept POSTs (which is should be by default) then you should be sending 200s. I'd add in additional logging and check out the webhook logs in the console to see if there's any additional information there.
Are you testing locally? Make sure to set up a tunnel with something like ngrok and configure the webhook to hit that temp URL. Many times when you can't see the POST, we're sending it to an incorrectly configured URL.
Let me know if you need more help! Always happy to :)
Cheers,
Tony
Norm N • over 8 years ago
I've tested with curl both locally and remotely and works fine. And it's the correct url :)
Might just be my ignorance, not even too sure how to send a response in the middle of handling a request. If not python flask/django, you happen to have some php code that does that?
Tony Blank Manager • over 8 years ago
It shouldn't be anything your application code deals with - that's handled by the web server. AFAIK, should just "happen" - I can check with other engineers on my team to make sure I'm not spacing anything out though :)
Norm N • over 8 years ago
:D
Seems to make sense though that it would "just happen".
Do I need to include the http part in the url or what qualifies as a correct url? i'm using something like "http://zzz:5000/webhooks_post/aaa/bbb"
Fwiw I'm doing something along the lines in flask:
@app.route('/webhooks_post//',methods=['POST'])
def run_rteWebhook(aaa,bbb):
if request.method == 'POST' and request.content_type=='application/json':
save(json.loads(request.data))
return(jsonify({'status':'ok'}))
except Exception as e:
return(jsonify({'status':e.args}))
return(jsonify({'status':"error: wrong content type"}))
Tony Blank Manager • over 8 years ago
Hi Norm!
Yeah, the URL should be a fully qualified domain name.
If you check out the webhook logs in the console you should see if it's returning a 404, which would likely mean the URL isn't correct. If you're seeing 200s in there, then the issue would be with how you're handling the data in the POST. Feel free to email me more code samples - happy to help troubleshoot the flask side as well.
Cheers,
Tony
Norm N • over 8 years ago
Do you set Content-Type: application/json? I can see the post requests coming through but doesn't get processed...
Tony Blank Manager • over 8 years ago
Yeah, we do - feel free to email us some more flask code (make sure to show any var instantiations so we know what the objects are) and we can help troubleshoot.
Cheers,
Tony
Norm N • over 8 years ago
Thanks Tony! Might shoot something over later. For now my account got disabled again 'Disabled due to 3 consecutive failed connection attempts'. Second time in 2/3 weeks, what am I doing wrong?
kalpana D • about 8 years ago
HI Tony, Dan
I am kalpana. Senior PHP developer. I want to know abt beta Receipt parsing. I got some info via your support . Since it is not actively supporting, i came here to proceed.
As per the given instruction, i have created account with webhook url and added source.
In my webhook url, i have get all GET, POST params and emailed to my email id to know when this beta parsing taking place and what the params(response) it is sending.
But i am getting the email with empty param. It seems no data returning to web hook url.
How to track this. Pls help me. I need to integrate this for my app where i am writing WS for that app.
kalpana D • about 8 years ago
My webhook url with filter_parsed_receipts=1 (Mydomain/webhook.php)
Desiree Schillinger Manager • about 8 years ago
Hi Kalpana,
I forwarded your messages to Dan and we'll get you the answers you need as soon as we can. Thx!