Account activity webhook replies with 214

account-activity
error-214

#1

I’ve been trying to register the crc for an account activity API webhook. I’ve created a quick and dirty crc response using flask and a self signed SSL certificate. The code for the CRC challenge is the following:

app = Flask(__name__)
sslify = SSLify(app)
CORS(app)

@app.route('/default', methods=['GET'])
def default():
  return("default!!")

# Defines a route for the GET request
@app.route('/webhooks/twitter', methods=['GET'])
def webhook_challenge():

  # creates HMAC SHA-256 hash from incomming token and your consumer secret
  key_bytes= bytes("my consumer secret" , 'utf-8')
  data_bytes = bytes(request.args.get('crc_token'), 'utf-8') # Assumes `data` is also a string.
  sha256_hash_digest = hmac.new(key_bytes, msg=data_bytes, digestmod=hashlib.sha256).digest()

  # construct response data with base64 encoded hash
  response = {
    'response_token': 'sha256=' + str(base64.b64encode(sha256_hash_digest))
  }

  # returns properly formatted json response
  return json.dumps(response)

context = ('cert.pem', 'key.pem')
if __name__ == "__main__":
    app.run(host="0.0.0.0", port=443,ssl_context=context)

and the code to trigger the crc challenge is the following:

from requests_oauthlib import OAuth1Session
import urllib

CONSUMER_KEY = 'my consumer key'
CONSUMER_SECRET = 'my consumer secret'
ACCESS_TOKEN = 'my token'
ACCESS_SECRET = 'my secret'

twitter = OAuth1Session(CONSUMER_KEY,
                        client_secret=CONSUMER_SECRET,
                        resource_owner_key=ACCESS_TOKEN,
                        resource_owner_secret=ACCESS_SECRET)
webhook_endpoint = urllib.parse.quote_plus('https://52.55.57.237/webhooks/twitter')
url = 'https://api.twitter.com/1.1/account_activity/all/AccountAPI/webhooks.json?url={}'.format(webhook_endpoint)
r = twitter.post(url)
from pprint import pprint
pprint(vars(r))

Unfortunately, I keep getting a 214 error that I can’t find an explanation for. It says:

“code”:214,“message”:“Webhook URL does not meet the requirements. Please, check your SSL Configuration.”

However, I am not getting any request logged in flask, is this just because my ssl certificate is self signed? My problem is likely similar to:

which is the only instance I have found of the same error message.


#2

Have you reviewed our recommended server configurations section on this page?


#3

Yes, it’s a grade A on ssllabs.com
I using a digitalocean free ssl , may be this is the problem ?
Is twitter not agree about free ssl certificate ?


#4

That should not be a problem, but without knowing the URL for the webhook it is difficult to help to troubleshoot.


#5

This is my webhook
https://twitterapi.amaz.sa/webhook/5c003c50a8e63c0271ee921d

I purchased a new ssl certificate but the same response.
Please help me


#7

This is my webhook
https://twitterapi.amaz.sa/webhook/5c003c50a8e63c0271ee921d

I purchased a new ssl certificate but the same response.
Please help me


#8

Please don’t post duplicate comments, this doesn’t help anyone. We can try to check the endpoint when we have time.


#9

I’m sorry, i just was assign the comment to you.
I’m waiting your replay
thanks