AnsweredAssumed Answered

Sending messages via the Conversations API

Question asked by Michael Zimmerman on Oct 19, 2018
Latest reply on Oct 30, 2018 by Robert Carroll

I am taking my first fumbling steps at scripting using the Rest APIs, so please be gentle!


We have a survey coming up that will require us to send out individual/unique survey links to students, and are hoping to use the Canvas Inbox/Conversations as one channel for distributing them.  I'm also trying to get my feet wet with the APIs and scripting.


To get a feel for how this might work, I'm playing with the Canvas Live API.  I've been able to do other things like creating courses via the API, and I can retrieve a list of conversations, but am having trouble creating a new conversation via the API.


I'm filling in the Live API form with recipients as just the numeric canvas_id, or spelling out "recipients[]=<id>", but neither seems to work.  The response I'm getting back is:


"There was a problem with your last request. You may have tried to perform an action after a long period of inactivity. If that's the case, try going back, reloading the page you were working on, and resubmitting. If not, please let us know what you were doing when the error happened."


The response headers say:


"Connection": "keep-alive",
"Content-Length": "19496",
"Content-Type": "text/html; charset=utf-8",
"Date": "Fri, 19 Oct 2018 17:13:17 GMT",
"P3p": "CP=\"None, see\"",
"Server": "Apache",
"Status": "422 Unprocessable Entity",
"X-Canvas-Meta": "q=739;",
"X-Content-Type-Options": "nosniff",
"X-Request-Context-Id": "b0807f1e-d432-4d0e-88bc-431889a8cce4",
"X-Request-Processor": "00128f213e1b667ff",
"X-Runtime": "0.098474",
"X-Session-Id": "fbb6af825b6850c61a85e1f3a03d448a",
"X-Ua-Compatible": "IE=Edge,chrome=1",
"X-Xss-Protection": "1; mode=block"


The admin user who's sending the message (and whose access token I'm using) can send messages to this recipient via the GUI without specifying a course, so that doesn't seem to be the issue.  Is there something else I'm missing about creating messages with the Conversations API?