webhook-fix
All checks were successful
Deploy on push / deploy (push) Successful in 7s

This commit is contained in:
2024-12-11 22:21:05 +03:00
parent 7751b0d0f8
commit 444c853f54
2 changed files with 8 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ from orm.author import Author
from resolvers.stat import get_with_stat
from services.db import local_session
from services.schema import request_graphql_data
from settings import ADMIN_SECRET
from settings import ADMIN_SECRET, WEBHOOK_SECRET
async def create_webhook_endpoint():
@@ -33,14 +33,19 @@ async def create_webhook_endpoint():
"event_name": "user.login",
"endpoint": "https://core.dscrs.site/new-author",
"enabled": True,
"headers": {
"Authorization": WEBHOOK_SECRET
},
}
}
gql = {
"query": f"query {operation}($params: AddWebhookRequest!) {{"
"query": f"query {operation}($params: AddWebhookRequest!)"
+ "{"
+ f"{query_name}(params: $params) {{ message }} "
+ "}",
"variables": variables,
"operationName": operation,
}
result = await request_graphql_data(gql, headers=headers)
logger.info(result)