How to use Webhook in Python Functions

In typescript functions, it is possible to call a webhook with the following code, but is it possible to make a similar call in python function?

import { <WebhookApiName>} from "@foundry/external-systems/sources";

const responce = <WebhookApiName>.webhooks.<ApiName>.call({xxx})
1 Like

Source imports to python functions are coming soon! Initially, we expect python functions to work more like python transforms, where you import the source directly and use it with a requests client, rather than invoking specific webhooks defined in the data connection user interface. Our goal is to provide the maximum flexibility for doing code-based interactive workflows against external systems.

An example of the kind of python function code we expect to support:

import requests
from functions.api import function

@function(sources=["<source_rid>"])
def get_pokemon_types(name: str) -> list[str]:

    data = requests.request("GET", f'https://pokeapi.co/api/v2/pokemon/{name}/').json()

    return [type_['type']['name'] for type_ in data['types']]

Keep an eye out for documentation and an announcement about this feature in the coming weeks.

1 Like

Thank you for your response.
I look forward to the announcement of the new feature.