Messages API

sends to a selected subset of users

POST /api/v1/messages/

Parameters

Name Description
subject subject
message message
recipient_ids array of user ids to deliver the message to
recipient_filters hash of user filters to search users to deliveries the message to
course_id id of a course to determine which users receive the message
disable_html_template html or text email
send_to_all boolean of whether or not you should send to everybody

Request

Headers

Accept: application/json
X-Api-Token: xCmDuDjx5rPixQnmLsJGzNSfmsEwsweMhg
X-Api-Email: user-149@example.com

Route

POST /api/v1/messages/

Body

{"subject":"Marty we have to go","message":"BACK TO THE FUTURE!","recipient_ids":[1252,1253]}

cURL

curl "http://localhost:3000/api/v1/messages/" -d '{"subject":"Marty we have to go","message":"BACK TO THE FUTURE!","recipient_ids":[1252,1253]}' -X POST \
	-H "Accept: application/json" \
	-H "X-Api-Token: xCmDuDjx5rPixQnmLsJGzNSfmsEwsweMhg" \
	-H "X-Api-Email: user-149@example.com" \
	-H "Content-Type: application/json" \
	-H "Host: school.worksonmy.computer"

Response

Headers

Content-Type: application/json; charset=utf-8
Content-Length: 493

Status

201 Created

Body

{
  "created_at": "2019-10-31T22:08:48Z",
  "receipt_count": 2,
  "drop_rate": 0,
  "open_rate": 0,
  "click_rate": 0,
  "deliver_rate": 0,
  "bounce_rate": 0,
  "message": "BACK TO THE FUTURE!",
  "email_unsubscribed_students": false,
  "failed_recipient_ids": null,
  "recipient_ids": [
    1252,
    1253
  ],
  "subject": "Marty we have to go",
  "send_to_all": false,
  "id": 6,
  "sent_count": 0,
  "meta": {
    "class": "message",
    "url": null,
    "name": "6",
    "description": "",
    "image_url": null
  },
  "open_count": 0,
  "click_count": 0,
  "drop_count": 0,
  "bounce_count": 0,
  "deliver_count": 0
}