Questions about sending notifications

Hello,

I have two questions about sending notifications with the api:

1.) Is there a possiblity to hide the “settings”-button in a web push notification?

2.) I have a problem sending a notification via the api to a special user. I tried the following curl request:

curl -XPOST https://management-api.wonderpush.com/v1/deliveries
-d accessToken=XXX
-d targetUserIds=’[“af13db1f-5035-42b0-9b66-f8f8014632ff”]’
-d campaignId=‘01ddkqivopla1e32’
-d notification=’{“alert”:{“text”:“Test an einen Nutzer…”}, “push”: {“payload”:{“exampleKey”:“exampleValue”}}}’

I get a {“success”:true,“campaignId”:“01ddkqivopla1e32”,“notificationId”:“01ddkrj60m1lbfg1@1”}-response but no push notification appears. What is the right way to set the targetUserIds with curl?

Thanks for some help with this!

Best regards,

Timo

Hi Timo,

The targetUserIds parameter expects a comma-separated list of values, not a JSON syntax: targetUserIds=id1,id2,id3.

That said, you can send a JSON POST body where an array of values is supported. Don’t forget to give the Content-Type: application/json in such case.
Here’s what your example call would give:

curl -XPOST https://management-api.wonderpush.com/v1/deliveries \
    -H 'Content-Type: application/json' \
    --data-binary '{
        "accessToken": "XXX",
        "targetUserIds": ["af13db1f-5035-42b0-9b66-f8f8014632ff"],
        "campaignId": "01ddkqivopla1e32",
        "notification": {"alert":{"text":"Test an einen Nutzer…"}, "push": {"payload":{"exampleKey":"exampleValue"}}}
    }'

HTTPie is also a great tool if you want to send JSON a la cURL.

Best,

Hi Olivier,

thanks for your answer!

I tested it without json-syntax with one targetUserId and it worked fine.

It I have multiple targetUserIds it’s just a concat of the ids without any marks, right?

I also tested the json-systax and it also worked fine.

Thanks a lot!

Best regards,

Timo

Hi Timo,

You concatenate the ids, separated by a single comma (,), no space, no quotes.

Best,

Hi Olivier,

great - thanks for your help!

Best regards,

Timo