Skip to content

Message routes: update, delete

The Message Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for Message, one group of Message routes.

Message.update

Changes the given properties of a Message. Verb page.

Text
PATCH /{namespace}/messages/{id}

Path: id. Body, as JSON: the other inputs. Emits Message.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Message.
mediumstringOne of email, sms, voice, or chat.
directionstringOne of inbound or outbound.
bodytextWhat it says.
fromstringThe sender: an address, a number, or a Channel id.
tostringThe recipient: an address, a number, or a Person id.
subjectstringThe subject line, for email.
purposestringWhy it goes out, such as onboarding; consent and suppression rules read it.

Returns

OutputTypeRequiredDescription
messageMessagerequiredThe Message.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X PATCH https://api.sb/leaseline.app/messages/message_3Dg8ysSOyQ \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"medium":"email"}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "message": {
    "$id": "https://api.sb/leaseline.app/messages/message_3Dg8ysSOyQ",
    "$type": "Message",
    "medium": "email",
    "direction": "inbound",
    "body": "Example body"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Message.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Message.delete

Deletes a Message: a soft delete that keeps its history, undone by Thing.restore. Verb page.

Text
DELETE /{namespace}/messages/{id}

Path: id. Emits Message.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Message.

Returns

OutputTypeRequiredDescription
messageMessagerequiredThe Message.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X DELETE https://api.sb/leaseline.app/messages/message_3Dg8ysSOyQ \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "message": {
    "$id": "https://api.sb/leaseline.app/messages/message_3Dg8ysSOyQ",
    "$type": "Message",
    "medium": "email",
    "direction": "inbound",
    "body": "Example body"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Message.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}