Create_notification... does not create a notification

Hi folks -

I’m attempting to create a notification via the API, using this query:

mutation {
    create_notification (
        user_id: 11227690,
        target_id: 373022691,
        target_type: Project,
        text: "This is a message"
    ) {
        id
    }
}

The user ID is my ID, and the target ID is an item ID for a board that I am the owner of. I get back this response:

{
    "data": {
        "create_notification": {
            "id": "-1"
        }
    },
    "account_id": 4751227
}

No notification gets sent. I confirmed I can get notifications via automations, but nothing via the API.

Any ideas?

Hi @josephwegner :wave:

When creating a notification via API, you’re unable to send a notification to yourself.

This means if you’re using the API key that’s tied to your login, you’ll need to send this notification to another user on the account.

Other that that, your mutation looks perfect :ok_hand:

Is this information helpful? Let me know if you have any questions or if I can be of further assistance! :raised_hands:

-Scott

Hi Scott,

I find it weird not being able to send notification to yourself. How to achieve this? Should we create an account just for that and use its api key or is their a way to have an api key tied to our company account but not to any logins.

Regards,

Hey Mathieu! At the moment there’s no way to send a notification to yourself. As a workaround I’d suggest inviting a dummy user and using their API key to send notifications to your users (including yourself).

I’ll do that, it shouldn’t count in the paid user counter though.

Hi Dipro, I was hoping to send a notification to the user who is currently signed on (and using hos OAuth token) but apparently this does not work (by design ??). There are cases that I need to inform a user form within my app (e.g. if they are using a non paid version :slight_smile:). What do you recommend for sending an alert to the user currently logged in. A popup message box will also do.

Hey Bas!

Good point. At the moment there isn’t a way to send a notification to yourself, so you’ll need to use a different API key to make these updates. As a workaround, you could store a service account/dummy user’s API key in your app, used specifically for notifications.

Let me sync up with @VladMonday and the team about this and we’ll add this feedback to our backlog.

Interestingly enough I was able to send a notification to myself :). I used my personal API token for that (not the one I got through OAuth). Unfortunately it did not solve my use case. I need to be able to throw an error / warning. I think I have seen warning from monday in the top and middle of the screen. It would be nice if this possibility was exposed through the API.

Hi @dipro

I am able to write a notification to myself (if I also have sufficient rights on the targetId) and the notification bell shows a +1 and turns red. When I try to read the notification it shows very briefly and then it goes on holiday :slight_smile: (ie not visible anymore). Looks like the implementation of the notifications is a little confusing.

I will start a new tread on with a request for different notifications.

1 Like