agent: |
d9lrJPxOd8ujJkFhFA1cList all the Zendesk webhooks
List all the Zendesk webhooks
There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
inputs
outputs
import requests
from requests.auth import HTTPBasicAuth
# Function to create a webhook in Zendesk
def list_webhook(email, api_token, subdomain):
# Define the endpoint URL for creating webhooks
url = f'https://{subdomain}.zendesk.com/api/v2/webhooks'
# Define the headers including the authorization
headers = {
'Content-Type': 'application/json'
}
# Make the request to create the webhook
response = requests.get(url, auth = HTTPBasicAuth(email + '/token', api_token), headers=headers)
# Check if the request was successful
if response.status_code == 200:
return {'success': True, 'webhooks': response.json()}
else:
print(response.status_code)
return {'success': False, 'error': response.text}
creds = _get_creds(zendesk_cred_label)['creds']
api_token = creds['password']
email = creds['username']
op = list_webhook(email, api_token, subdomain)
print("Response: ", json.dumps(op, indent=4))
copied