Hi, I am trying to register my webhook using this code in terminal “node example_scripts/webhook_management/validate-webhook-config.js”. But it gives me an error “{“errors”:[{“code”:214,“message”:“Non-200 response code during CRC GET request (i.e. 404, 500, etc).”}]}”. My code in python 3 to respond to CRC challenge is like this
sha256_hash_digest = hmac.new(TWITTER_CONSUMER_SECRET.encode(‘utf-8’),
msg=connexion.request.args.get(‘crc_token’).encode(‘utf-8’),
digestmod=hashlib.sha256).digest()
log.info(str(sha256_hash_digest))
res = base64.b64encode(sha256_hash_digest).decode(‘utf-8’)
response = {
'response_token': 'sha256=' + res,
'response_code': 200
}
log.info(json.dumps(response))
return json.dumps(response)
Does the code look correct? Code given by twitter is for 2.7 and does not work for python 3. It requires to encode values for hmac. Currently I am validating my webhook using account-activity-dashboard UI. Does anyone have python 3 code to validate/register webhook?