could not send a tag notification from remote api java

Answered

Comments

3 comments

  • Avatar
    Dmitry Dyudeev

    Hello,

    Here's the example code with the "conditions" section:

     public static void main(String[] args) throws JSONException, MalformedURLException
    {
        String method = "createMessage";
        URL url = new URL(PUSHWOOSH_SERVICE_BASE_URL + method);
    
    
        // PUT YOUR conditions here
        JSONArray conditions = new JSONArray()
                .put(new JSONArray()
                        .put("idtag")
                        .put("EQ")
                        .put("idtag1"));
    
        JSONArray notificationsArray = new JSONArray()
                .put(new JSONObject().put("send_date", "now")
                        .put("content", "test")
                        .put("link", "http://pushwoosh.com/")
                        .put("conditions", conditions));
    
        JSONObject requestObject = new JSONObject()
                .put("application", APPLICATION_CODE)
                .put("auth", AUTH_TOKEN)
                .put("notifications", notificationsArray);
    
        JSONObject mainRequest = new JSONObject().put("request", requestObject);
        System.out.println("Request is: " + requestObject.toString());
        JSONObject response = SendServerRequest.sendJSONRequest(url, mainRequest.toString());
    
        System.out.println("Response is: " + response);
    }
    

    Could you please try to test it and let us know about the results?

  • Avatar
    Pcageao

    Now, this runs for me ;-) Thanks you!!!

  • Avatar
    C Sinuhe

    Hello. Can you help me, please? I have a same dude, but in PHP. I have this:

    pwCall('createMessage', [ 'application' => PW_APPLICATION, 'auth' => PW_AUTH, 'conditions' => [['IsMember', 'EQ', 'no']], 'notifications' => [ [ 'send_date' => 'now', 'content' => 'test', 'data' => ['custom' => 'json data'], 'link' => 'http://pushwoosh.com/' ] ] ] );

    But that is not working, I dont found answer in the appi guide. Any body can help me about, please.

Please sign in to leave a comment.