Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper Python documentation #120

Open
Mitra-Electronics opened this issue Sep 25, 2023 · 5 comments
Open

Add proper Python documentation #120

Mitra-Electronics opened this issue Sep 25, 2023 · 5 comments

Comments

@Mitra-Electronics
Copy link

No description provided.

@unicodeveloper
Copy link
Contributor

unicodeveloper commented Sep 26, 2023

@Mitra-Electronics Can you throw more light on this?

We have the Python Quickstart, and Python Cookbook. Please check them out and let me know what you think.

@Mitra-Electronics
Copy link
Author

Mitra-Electronics commented Sep 29, 2023

@unicodeveloper For example, in the Triggering Notifications section in the Python Quickstarts page, the example is given as follows:

from novu.api import EventApi

EventApi().trigger(
    name="test",  # The trigger ID of the workflow. It can be found on the workflow page.
    recipients="123",
    payload={},  # Your Novu payload goes here
) 

But in the default Novu Account Activation Development Workflow, the above example doesn't work, even after entering the correct Novu API key and the correct workflow ID.

After looking into the source code, I was able to fix the error

event_api.trigger(
        name="account-activation",
        recipients={
            "subscriberId": "650af3f587135ffdc3325599",
            "phone": "<ReplaceWithData>",
            "email": "<ReplaceWithData>"
        },  # type: ignore
        payload={}, # Your Novu payload goes here
    )

The above code works, but when I enable type checking in VS Code in a Python file, it shows a type error. The subscriber was created by default, I didn't create it.

@unicodeveloper
Copy link
Contributor

unicodeveloper commented Oct 3, 2023

Sorry for the confusion @Mitra-Electronics. We'll get the quickstarts page updated, it was an error. It should have been:

event_api = EventApi("https://api.novu.co/api/", "<NOVU_API_KEY>")
event_api.trigger(
    name="<YOUR_TEMPLATE_NAME>",
    recipients="<YOUR_SUBSCRIBER_ID>",
    payload={},  # Your Novu payload goes here
)

@Smartmind12
Copy link
Contributor

@unicodeveloper would you like me to make the update in the documentation for you?

@utkarsh125
Copy link

@unicodeveloper I would like to update the docs for you...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants