novuhq / novu-python

Python SDK for Novu - The open-source notification infrastructure for engineers. 🚀
https://novu-python.readthedocs.io
MIT License
74 stars 32 forks source link

Python SDK missing option for Tenant ID in event triggering #94

Closed IakMastro closed 11 months ago

IakMastro commented 11 months ago

Hello,

We want to integrate Novu to our stack. Our stack is based on many multi-tenancy technologies and consists of a main middleware that is written in Python and communicates with each service separately.

I tried to use your Python SDK to trigger specific tenant information. However, I noticed the option to change the tenant is missing from the Trigger function.

For example, in your NodeJS SDK you do it like that:

  import { Novu } from '@novu/node';

  const novu = new Novu("<NOVU_API_KEY>");

  await novu.trigger('<WORKFLOW_TRIGGER_ID>',
    {
      to: {
        subscriberId: '<UNIQUE_SUBSCRIBER_IDENTIFIER>',
      },
      payload: {
        name: "Hello World",
      },
      actor: "actorId"
      tenant: "tenantIdentifier"
    }
  );

In Python, the same function has this parameters:

    def trigger(
            self,
            name: str,
            recipients: Union[str, List[str]],
            payload: dict,
            overrides: Optional[dict] = None,
            transaction_id: Optional[str] = None,
            actor: Optional[str] = None,
    ) -> EventDto:

I can't find where to set up the tenant so my requests will work properly.

ryshu commented 11 months ago

Hi @IakMastro,

It seems to be quite blocking indeed when using the "multi-tenant" part. I'm looking to quickly add the field without having a breaking change.

@Cliftonz We should probably do another pass on the SDK with the implementation of the tenants to see where the API methods do not support it.