webhook must be a non-empty string URL
jody-schering opened this issue · 1 comments
I'm calling the https://plaid.com/docs/api/tokens/#linktokencreate endpoint using the plaid-python libraries. When I create a link token request.
LinkTokenCreateRequest:
{'client_name': 'MYCLIENTNAME', 'country_codes': ['US'], 'language': 'en', 'products': ['auth', 'transactions'], 'user': {'client_user_id': 'XXXXXXXXXX'}, 'webhook': '/webhooks/091e07ab'}
The plaid response is:
{
"display_message": null,
"documentation_url": "https://plaid.com/docs/#create-link-token",
"error_code": "INVALID_FIELD",
"error_message": "webhook must be a non-empty string URL",
"error_type": "INVALID_REQUEST",
"request_id": "Ed8TfBcVuIzzc5p",
"suggested_action": null
}
The request works if I leave out the webhook parameter. Here's the code:
webhook_url = f"/webhooks/{user_hook_id}"
logger.info(f"webhook_url = {webhook_url}")
api_client = create_plaid_client()
client = plaid_api.PlaidApi(api_client)
token_request = LinkTokenCreateRequest(
products=[Products('auth'), Products('transactions')],
webhook=webhook_url,
client_name=client_name,
country_codes=[CountryCode('US')],
language='en',
user=LinkTokenCreateRequestUser(
client_user_id=user_hook_id
)
)
logger.info(f"token_request = {token_request}")
# create link token
token_response = client.link_token_create(token_request)
token = token_response['link_token']
I've also tried with the full hostname and uri and both produce the same error. What is wrong with the request?
I think this question was also asked on stack overflow and resolved there: https://stackoverflow.com/questions/69802686/plaid-webhook-must-be-a-non-empty-string-url