Zendesk Webhook Authorization in Python

5 댓글

  • Tala Owais

    Tipene Hughes implementing those lines gives me the following output :

    webHookSignature:
     b'\xf4\****
     str(base64.b64encode(hmac_result), 'utf-8'):
    8wtf5****

    The problem might be the Zendesk webhook I am using , How Can I get the right webhook that must me used in the Hmac?

     

    0
  • Tipene Hughes
    Zendesk Developer Advocacy
    Hi Tala,
     
    I don't think this is necessarily an issue with the webhook you're using. I've gone ahead and put together an example that might be helpful to you. Take a look through this and see if you're able to identify what might be causing the error on your end. 
     
    If you continue to run in to errors, let me know and we can pull this in to a ticket so I can take a look at your code in more detail.
     
    Thanks!
     
    Tipene
    0
  • Tala Owais

    Hi Tipene .,

     

    Thank you for your reply !

    My issue was how I submitted the body variable to the function , As I was reading json from the request , I was not getting the raw Body (ex. body = req.get_body() in Azure Functions )

     

    Your example helped me to think about the issue , Thank alot 

    0
  • Tipene Hughes
    Zendesk Developer Advocacy
    Glad to hear you've got it working!
     
    Have a great day :)
     
    Tipene
    0
  • Tipene Hughes
    Zendesk Developer Advocacy

    Hey, Tala!

    Can you try adding this to your code and see if that gets it working?

    ...
    webHookSignature = base64.b64decode(signature.encode('utf-8'))
    if webHookSignature == str(base64.b64encode(hmac_result), 'utf-8'):
    return True
    ...
    -1

댓글을 남기려면 로그인하세요.

Zendesk 제공