Documentation

O365TeamsSendMessageService
in package

This service is used to send messages to users / channels.

Table of Contents

$currentUser  : AccountInterface
The current user.
$graphService  : GraphService
The o365 graph service.
$messenger  : MessengerInterface
The messenger.
__construct()  : mixed
Constructs an O365TeamsSendMessageService object.
getUserDataFromRecipient()  : User|false
Get the user data of a recipient.
sendMessageToUser()  : mixed|null
Send a message to a single user.
createOneOnOneChat()  : false|string
Create a chat we can use to send the message to.
extractUserPrincipalNameFromAutocompleteInput()  : mixed|null
Extracts the user principal name from the autocompletion result.

Properties

Methods

__construct()

Constructs an O365TeamsSendMessageService object.

public __construct(MessengerInterface $messenger, GraphService $graphService, AccountProxyInterface $accountProxy) : mixed
Parameters
$messenger : MessengerInterface

The messenger.

$graphService : GraphService

The o365 graph service.

$accountProxy : AccountProxyInterface

The current user.

Return values
mixed

getUserDataFromRecipient()

Get the user data of a recipient.

public getUserDataFromRecipient(string $recipient) : User|false
Parameters
$recipient : string

The recipients usePrincipalName (mail address).

Return values
User|false

The recipient user data.

sendMessageToUser()

Send a message to a single user.

public sendMessageToUser(string $recipient, string $message) : mixed|null
Parameters
$recipient : string

The recipient of the message.

$message : string

The actual message we want to send.

Tags
throws
TempStoreException
throws
GuzzleException
throws
IdentityProviderException
Return values
mixed|null

The recipients email address so we can create a link to the Teams chat.

createOneOnOneChat()

Create a chat we can use to send the message to.

protected createOneOnOneChat(string $userPrincipalName) : false|string
Parameters
$userPrincipalName : string

The recipient of the message.

Tags
throws
TempStoreException
throws
GuzzleException
throws
IdentityProviderException
Return values
false|string

The chat ID or FALSE.

extractUserPrincipalNameFromAutocompleteInput()

Extracts the user principal name from the autocompletion result.

private static extractUserPrincipalNameFromAutocompleteInput(string $input) : mixed|null
Parameters
$input : string

The input coming from the autocompletion result.

Return values
mixed|null

An userPrincipalName or NULL if the input does not contain one.

Search results