I'm trying to send a message from the v3 SurveyMonkey api. In doing so, I'm using the following pattern as required from the API:
POST /surveys/{id}/collectors
POST /collectors/{id}/messages
POST /collectors/{id}/messages/{id}/recipients/bulk
POST /collectors/{id}/messages/{id}/send
Steps 1-3 work fine, but when I try to issue the send command, I get a 400 Bad Request error. The error message states:
"The body provided was not a proper JSON string."
I am using the httr package in R to send the message if that helps.
u <- paste('https://api.surveymonkey.net/v3/collectors', collectorID, "messages", messageID, "send", sep="/")
h <- httr::add_headers(Authorization = token)
out <- httr::POST(u, config = h)
As I review the API documentation, it does not appear that a body is required for this command. What am I missing?
For step 4:
A body is actually required. There is an optional field (
scheduled_date
). If you want it to send right away without scheduling, you send an empty JSON object.And that'll work, but it still expects a JSON body.