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

support for subscriber creation in trigger function #41

Open prathapbelli opened 1 year ago

prathapbelli commented 1 year ago

As I read we have node package support for triggering event with subscriber details which basically upsert the subscriber before triggering event. two modes

  1. Ahead of Trigger
  2. Inline of Trigger
    to: {
      subscriberId: '<USER_IDENTIFIER>',
      email: 'email@email.com',
      firstName: 'John',
      lastName: 'Doe',
    },

Can we get that Inline of Trigger functionality in python sdk

unicodeveloper commented 1 year ago

@ryshu are you taking this up? this feels very straightforward

unicodeveloper commented 1 year ago

More thoughts here:

  1. Ahead of trigger means you call the resource to create a subscriber first before you trigger an event. Here you use the SubscriberAPI in this SDK.
  2. Inline of trigger means you trigger the event by passing the subscriber details and Novu creates if the subscriber if it is non-existent. @ryshu is that not what the EventApi currently does?
ryshu commented 1 year ago

@unicodeveloper

The API doesn't support it today, because when we designed it, we felt that inline mode was a bad practice that implied that the user didn't properly manage his upstream user base and its synchronization with Novu.

In the future, we'll be working internally at SpikeeLabs to develop a synchronization utility between an existing database and Novu on this subject, rather than relying on upsert mode.

The problem can be solved quite simply by upgrading the linked DTO to indicate that the API supports these transmissions too.

ryshu commented 1 year ago

image

unicodeveloper commented 1 year ago

@unicodeveloper

The API doesn't support it today, because when we designed it, we felt that inline mode was a bad practice that implied that the user didn't properly manage his upstream user base and its synchronization with Novu.

In the future, we'll be working internally at SpikeeLabs to develop a synchronization utility between an existing database and Novu on this subject, rather than relying on upsert mode.

The problem can be solved quite simply by upgrading the linked DTO to indicate that the API supports these transmissions too.

So can we upgrade the linked DTO to provide this? Every other SDK supports it and we don't want the Python SDK to be an exception.

kridafans commented 1 year ago

Do you have any updates on this?

unicodeveloper commented 1 year ago

@VeldaKiara Do you want to handle this? It could be your next task. It's pretty straightforward.

VeldaKiara commented 1 year ago

Sure thing. I can pick this up.

VeldaKiara commented 1 year ago

Allow me to understand the issue better. What is needed here is to update the event dto, specifically InputEventDto to reflect this information "to": { "subscriberId": "string", "email": "string", "firstName": "string", "lastName": "string", "phone": "string", "avatar": "string", "locale": "string", "data": {}

@ryshu mentions that "this can be solved quite simply by upgrading the linked DTO to indicate that the API supports these transmissions too" which means if the dto changes the function should also accommodate or reflect this change.

ethanclusta commented 8 months ago

Hey, just wondering if there's any more update on this functionality being added? Or the synchronisation utility that @ryshu mentions above (which sounds exactly what I was hoping to find)?

VeldaKiara commented 8 months ago

Yes there are some updates that I will share during the weekend.

May the wombat of happiness snuffle through your underbrush, Velda Kiara Software Developer

On Thu, 11 Jan 2024, 00:16 Ethan, @.***> wrote:

Hey, just wondering if there's any more update on this functionality being added? Or the synchronisation utility that @ryshu https://github.com/ryshu mentions above (which sounds exactly what I was hoping to find)?

— Reply to this email directly, view it on GitHub https://github.com/novuhq/novu-python/issues/41#issuecomment-1885746553, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYLK2B2YPKQ3HIBQENE6LDYN4AK5AVCNFSM6AAAAAA2BYR6VKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVG42DMNJVGM . You are receiving this because you were mentioned.Message ID: @.***>