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

As a Content Editor I want a "Push" button, to send push notification about specific contents I'm managing. #534

Open
sseppi opened this issue Feb 13, 2024 · 17 comments
Assignees

Comments

@sseppi
Copy link
Contributor

sseppi commented Feb 13, 2024

In the old Data Browser there was the possibility to send push notification about specific contents.

Image

The first real use case we have is the Push of notification about NOI News to the NOI App.

In this issue we should define and implement a generic solution, to allows us to activate this push functionality without the need to riprogramm it every time there is a new app or content that should be pushd or notified.

Open Questions

  • How do we define the user role that is allowed to send the push notification?
    Maybe it could be simply all users who have edit rights on the data);
  • How do we set the apps that should be notified? Do we use the published on attribute?
@sseppi
Copy link
Contributor Author

sseppi commented Feb 13, 2024

@mrabans @RudiThoeni I've created this issue and we need to start defining how should be the generic solution. Are there other open questions that should be taken into consideration for this issue?

@mrabans
Copy link

mrabans commented Feb 14, 2024

@sseppi probably we have to discuss this in detail to come up with a future proof solution.

@RudiThoeni
Copy link
Member

We discussed about the push functionality and the idea was to have one generic Push Endpoint where this informations has to be passed:

  • id
  • type of the dataset (example for tourism is _Meta.Type)
  • language (if the push has to be sent only in one language)
  • identifier --> could be the publisher example noi-communityapp

On Publisher Level the Push Functionality has to be activated. We thought about activating it on Dataset type.

The information (Timestap when, PushId etc...) has to ba saved on data level and displayed to the user somewhere, so he knows that a push was already sent etc....

@RudiThoeni
Copy link
Member

We had a discussion where we defined:

  • We save the information (Push URL, Parameter etc...) into the publisher data
  • Parameter are saved single (in style of the Metdata api)
  • Parameters which should be filled by Databrowser are marked with {fieldname} example {_Meta.Type}
  • Supported Parameters are simple datatypes, only string arrays are supported where all values are passed with a , as separator
  • Where the possibility exist to process it on backend side (like the language on the noi community app push) we do it on backendside
  • The Pushresult is saved in the data (date, result Push api, etc..)
  • We use HTTP POST instead of HTTP Get

Some UX questions emerged

  • Where should the button be displayed (Listview, Editview ...)
  • What if more Push buttons are there (Button with Dropdown)

@pkritzinger
Copy link
Collaborator

@RudiThoeni what do you mean with

What if more Push buttons are there (Button with Dropdown)

Could you pls specify the usecase?

@sseppi
Copy link
Contributor Author

sseppi commented Mar 14, 2024

Hi @pkritzinger

in case we have two different "publishers" that allows to send push notification at two different apps (e.g. NOI App and suedtirol.info), we need to allow the user to choose where he wants to push the notification.

We thought that one possible way would be to have a dropdown menu or a checkbox that allows the user to select the applications he wants to send the push to.

Did I clarified better what we ment?

@RudiThoeni what do you mean with

What if more Push buttons are there (Button with Dropdown)

Could you pls specify the usecase?

@pkritzinger
Copy link
Collaborator

@sseppi now it's crystal clear, thanks :)

@RudiThoeni
Copy link
Member

Hi @gappc @sseppi
I worked on the requested changes.
Api Side: (noi-techpark/odh-api-core#420)

  • Added an Array to each Publisher which stores the push Information
  • The push information is stored as List or Parameters and a BaseUrL
  • Added a POST Endpoint to start a push which should be valid for all pushes where id, type, publisher has to be passed
  • The push Result will be stored in a table and i created an api to retrieve Push results

Databrowser Side: (#553)

  • Added the skeleton to add push information via databrowser but i got stuck on an issue, instead of loosing to much time for this issue, would be better if you can continue the work (maybe after a short meeting) or even better a short pair programming session..... what do you think about it?
    image

When bot of this tasks are completed everything is ready to add the implementation for the push button

@gappc
Copy link
Collaborator

gappc commented Apr 2, 2024

Hey @RudiThoeni, I saw your PR. Although I didn't look into the details, it looks already very nice 👍

From the screenshot I think I know where you got stuck: pathparam ;)

Lets schedule a meeting and maybe do some pair programming, so we can exchange ideas and possible solutions.

@sseppi
Copy link
Contributor Author

sseppi commented Apr 2, 2024

@gappc

As you can see from the previous comment of Rudi, he prepared everything is needed to implement the "Push" button. He has only one question, he would like to discuss with you.

From my point of view, the next steps are:

  • you get in touch with Rudi to clarify the open questions he has;
  • you implement the Push button like proposed in the Figma shared by Paul.

As agreed during the meeting, since the backend isn't still ready now, we implement only the logic to send the push, not the one to program it. I will create a dedicated issue to the Program Push functionality (#554 ).

@RudiThoeni
Copy link
Member

RudiThoeni commented Apr 4, 2024

Hi @sseppi
With the great help from @gappc now it is possible to add multiple push information to each publisher in the section "PublishConfig"

on test i added now for the publishers
idm-marketplace
[https://api.tourism.testingmachine.eu/v1/PushData/{Id}/{_Meta.Type}/idm-marketplace]
noi-communityapp
[https://api.tourism.testingmachine.eu/v1/PushData/{Id}/{_Meta.Type}/noi-communityapp] (At the moment lets not use this call because it sends a push to all app users of the community app ;)
This is a POST Endpoint

To perform the push the User must have the right permissions otherwise 403 is returned

If all goes well the api call returns a http 200 with a Dictionary<string, PushResponse>

    public class PushResponse
    {
        public string Id { get; set; }
        public string Publisher { get; set; }
        public DateTime Date { get; set; }
        public dynamic Result { get; set; }
    }

To be discussed: What we display when the push is done
I will add some test cases where no effective push is created....
I noticed also a small bug (on a already configured PublisherConfig/PathParam deleting a PublisherConfig/PathParam inside the table only works if first i add a new one....) (write it down here for me so i don't forget it)

Will write here when everything is ready

@sseppi
Copy link
Contributor Author

sseppi commented Apr 5, 2024

Hi @RudiThoeni and @gappc ,

thank you for the great work!

To be discussed: What we display when the push is done

If we have it, I think that ID and timestamp of the push could be useful, to easily debug in case of problems.

What do you think?
Best
Stefano

@RudiThoeni
Copy link
Member

I created a Table where all push infos are stored.... and an api where all pushinfo can be retrieved....
A push info has as fixed Values an Id, Timestamp, Publisher, Result.Success
If we provide the Id and the Success it should be enough, every additional info could be retrieved with the Push Api Info (which could be displayed via databrowser) --> cool we see that all begins working together )

@RudiThoeni
Copy link
Member

@gappc now everything is ready to implement the button
As mentioned before on idm-marketplace, noi-communityapp there are pushconfigs defined.

The endpoint the button should finally reach is
POST https://api.tourism.testingmachine.eu/v1/PushData/{Id}/{Type}/{Publisher}

I added some mocks to the endpoint so we can test, it does provide this responses
If all is working i will activate the effective pushes :)

{
    "idm-marketplace": {
        "Id": "f8c691e7-ac2b-4c92-8ed6-9e5c9036fde7",
        "Publisher": "idm-marketplace",
        "Date": "2024-04-05T14:18:19.5313719+02:00",
        "Result": {
            "Response": "This is a mockup response",
            "HttpStatusCode": "OK",
            "Service": "idm-marketplace",
            "Success": true
        },
        "PushObject": {
            "Id": "smgpoifad01289740e1d2f58dc1aa29288bb33",
            "Type": "odhactivitypoi"
        }
    }
}

{
    "noi-communityapp": {
        "Id": "69bad1f0-d9de-4b25-be5c-9484441e5021",
        "Publisher": "noi-communityapp",
        "Date": "2024-04-05T14:12:53.5357176+02:00",
        "Result": {
            "Messages": 1,
            "Success": true,
            "Response": "This is a mockup response",
            "Error": ""
        },
        "PushObject": {
            "Id": "smgpoifad01289740e1d2f58dc1aa29288bb33",
            "Type": "odhactivitypoi"
        }
    }
}

The Button should show only if the push was done (Result.Success true/false) and maybe provide the (Id) so that if something went wrong it could all be looked into the PushResults Api (i still have to create the view in the databrowser for this api).

@gappc
Copy link
Collaborator

gappc commented Apr 21, 2024

@sseppi can we close this issue?

@sseppi
Copy link
Contributor Author

sseppi commented Apr 22, 2024

@gappc I will test the feature together with the client and, in case of positive feedback, close it.

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

5 participants