G
G
gill_onus2022-03-26 23:47:32
Python
gill_onus, 2022-03-26 23:47:32

How to receive outgoing webhooks from Bitrix24 using python FastAPI?

Hello everyone, I'm trying to fiddle with FastAPI

. At the moment, it turns out to accept webhooks from B24, passing only if parameters were passed in them, for example, this deletes the deal

@app.post('/kill-deal')
def send_data(deal_to_kill: int):
    kill_deal(deal_to_kill)
    return {deal_to_kill: '<- сделка удалена'}


I can't figure out how to accept outgoing webhooks from b24 =( I'm trying

to subscribe to the "Task Update" event https://dev.1c-bitrix.ru/rest_help/tasks/events_ta...

on my side I wrote like this

class Item(BaseModel):
    event: str
    data: dict
    auth: str


@app.post("/task_update/", response_model=Item)
def print_task(item: Item):
    print(item)
    return item


when changing the task on the B24 side, fast api sends to the console
INFO:     мой ip  - "POST /task_update/ HTTP/1.1" 422 Unprocessable Entity


I don't understand what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question