Skip to content

Latest commit

 

History

History
221 lines (175 loc) · 7.43 KB

Message.md

File metadata and controls

221 lines (175 loc) · 7.43 KB

Available Functions

Message

Message object creating

public function __construct ( ?string $content = '', ?string $title = '', ?string $priority = Message::PRIORITY_NORMAL, ?string $level = Message::LEVEL_INFO )
Param Type Required Description
$content String No Message text
$title String No Message title
$priority String No Priority. Available values are listed in the setPriority function
$level String No Level. Available values are listed in the setLevel function

setTitle

Set message title

public function setTitle ( string $title ): $this
Param Type Required Description
$title String Yes Message title

getTitle

Get message title

public function getTitle (): string

setContent

Set message text

For recipients that do not support HTML, these tags will be ignored.

public function setContent ( string $content ): $this
Param Type Required Description
$content String Yes Message text. Available HTML tags: <b>, <i>, <a href="">, <br>

getContent

Get message text

public function getContent (): string

setPriority

Define message priority

For recipients which supports priority, the message will be highlighted accordingly.

public function setPriority ( string $priority ): $this
Param Type Required Description
$priority String Yes Message priority

Available values:

Message::PRIORITY_LOWEST
Message::PRIORITY_LOW
Message::PRIORITY_NORMAL
Message::PRIORITY_HIGH
Message::PRIORITY_HIGHEST 

getPriority

Get message priority

public function getPriority (): string

setLevel

Define message level

For recipients which have differences in the display of messages at different levels, this level will be applied.

public function setLevel ( string $level ): $this
Param Type Required Description
$level String Yes Message level

Available values:

Message::LEVEL_VERBOSE
Message::LEVEL_INFO
Message::LEVEL_NOTICE
Message::LEVEL_WARNING
Message::LEVEL_ERROR
Message::LEVEL_SUCCESS

getLevel

Get message level

public function getLevel (): string

addFile

Attach local file

public function addFile ( string $filePath, ?string $mimeType = null, ?string $fileName = null ): $this
Param Type Required Description
$filePath String Yes Local file path
$mimeType String No File MimeType
$fileName String No File name and extension

addFileFromContent

Attach file by content

public function addFileFromContent ( string $content, ?string $fileName = null, ?string $mimeType = null ): $this
Param Type Required Description
$content String Yes File content
$fileName String No File name and extension
$mimeType String No File MimeType

addFileFromUrl

Attach remote file

public function addFileFromUrl ( string $url, ?string $fileName = null, ?string $mimeType = null ): $this
Param Type Required Description
$url String Yes Remote file path
$fileName String No File name and extension
$mimeType String No File MimeType

addImage

Attach local image

public function addImage ( string $filePath, ?string $mimeType = null, ?string $fileName = null ): $this
Param Type Required Description
$filePath String Yes Local file path
$mimeType String No File MimeType
$fileName String No File name and extension

addImageFromContent

Attach image by content

public function addImageFromContent ( string $content, ?string $fileName = null, ?string $mimeType = null ): $this
Param Type Required Description
$content String Yes File content
$fileName String No File name and extension
$mimeType String No File MimeType

addImageFromUrl

Attach remote image

public function addImageFromUrl ( string $url, ?string $fileName = null, ?string $mimeType = null ): $this
Param Type Required Description
$url String Yes Remote file path
$fileName String No File name and extension
$mimeType String No File MimeType

addAction

Attach action with callback

public function addAction ( string $name, string $title, ?string $callback_url = null, string $callback_method = 'get', array $callback_headers = [], string $callback_content = '' )
Param Type Required Description
$name String Yes Action name
$title String Yes Action (button) title
$callback_url String No Callback URL
$callback_method String No Callback method
$callback_headers Array No Callback headers (key: value)
$callback_content String No Callback content (for POST, PUT, PATCH methods)

Available values for $callback_method:

Message::CALLBACK_METHOD_HRAD   - HEAD
Message::CALLBACK_METHOD_GET    - GET
Message::CALLBACK_METHOD_POST   - POST
Message::CALLBACK_METHOD_PUT    - PUT
Message::CALLBACK_METHOD_PATCH  - PATCH
Message::CALLBACK_METHOD_DELETE - DELETE

send

Send the message

You can get the source token when connecting the PHP source to your channel on the Notify.Events service side.

public function send ( string $token )
Param Type Required Description
$token String Yes Source token