Forum Discussion

Claudius's avatar
5 years ago

Failing to send PM v3 via API v2 notes_threads collection

I am building an endpoint that should send a private message from the current admin user to a given user. I am using the restbuilder to build my CREATE call to the notes_threads collection like this:...
  • DougS's avatar
    5 years ago

    Hi Claudius,

    I tried this out locally and found a bug that is causes a NullPointerException in the java back-end when you don't include the "is_broadcast" field. To work around this, just add the field, set to either true or false (the different options are discussed on the Threaded Private Message API Support page):

    <#assign PMPostCall = restBuilder()
       .method("POST")
       .path("/notes_threads")
       .body({
        "type": "notes_thread",
          "subject" : "Important note",
          "new_note" : {
              "type" : "threaded_note",
              "body" : "We have just approved your application. Welcome and now please take a look around."
          },
          "is_broadcast": false,
          "thread_recipients" : {
                "list_item_type":"note_recipient",
                "items": [
                  {
                      "type" : "note_recipient",
                        "user": {
                          "type": "user",
                            "login": "admin"
                        }
                    }
                ]
          }
            })
       .admin(true) />
    <#assign resp = PMPostCall.call() />

    I will file a bug to have this bug corrected.

    Thanks,

    -Doug