Created
May 19, 2016 18:39
-
-
Save spasiu/1a422ce09d36ecb8749f82f076b853af to your computer and use it in GitHub Desktop.
example of setting a webhook via the Smooch API in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jwt # https://github.com/jpadilla/pyjwt | |
| import requests # http://docs.python-requests.org/en/master/ | |
| SECRET = 'your_secret' | |
| KID = 'your_key' | |
| token = jwt.encode({'scope': 'app'}, SECRET, algorithm='HS256', headers={'kid': KID, 'alg': 'HS256'}) | |
| response = requests.get(url="https://app.smooch.io/v1/webhooks", | |
| headers={'content-type': 'application/json', 'authorization': 'Bearer ' + token }, | |
| json={'target' : 'http://example.com/hooks'}) | |
| print(response.json()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment