Skip to content

Message methods: update, delete

The Message Verbs update, delete as typed SDK methods, with inputs, result, refusals and an example.

Reference for Message, one group of Message methods.

Message.update

Changes the given properties of a Message. Verb page.

TypeScript
interface MessageVerbs {
  update(input: MessageUpdateInput, options?: SB.CallOptions): SB.Call<Message>
}

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

TypeScript
import { $ } from 'startup-builder'

const message = await $.Message.update({ id: 'message_3Dg8ysSOyQ', medium: 'email' })

Message.delete

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

TypeScript
interface MessageVerbs {
  delete(input: MessageDeleteInput, options?: SB.CallOptions): SB.Call<Message>
}

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

TypeScript
import { $ } from 'startup-builder'

const message = await $.Message.delete({ id: 'message_3Dg8ysSOyQ' })