class O365TeamsSendMessageService

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

Properties

protected AccountInterface $currentUser

The current user.

protected GraphService $graphService

The o365 graph service.

protected MessengerInterface $messenger

The messenger.

Methods

__construct(MessengerInterface $messenger, GraphService $graphService, AccountProxyInterface $accountProxy)

Constructs an O365TeamsSendMessageService object.

false|string
createOneOnOneChat(string $userPrincipalName)

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

User|false
getUserDataFromRecipient(string $recipient)

Get the user data of a recipient.

mixed|null
sendMessageToUser(string $recipient, string $message)

Send a message to a single user.

Details

at line 48
__construct(MessengerInterface $messenger, GraphService $graphService, AccountProxyInterface $accountProxy)

Constructs an O365TeamsSendMessageService object.

Parameters

MessengerInterface $messenger

The messenger.

GraphService $graphService

The o365 graph service.

AccountProxyInterface $accountProxy

The current user.

at line 128
protected false|string createOneOnOneChat(string $userPrincipalName)

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

Parameters

string $userPrincipalName

The recipient of the message.

Return Value

false|string

The chat ID or FALSE.

Exceptions

TempStoreException
GuzzleException
IdentityProviderException

at line 108
User|false getUserDataFromRecipient(string $recipient)

Get the user data of a recipient.

Parameters

string $recipient

The recipients usePrincipalName (mail address).

Return Value

User|false

The recipient user data.

at line 69
mixed|null sendMessageToUser(string $recipient, string $message)

Send a message to a single user.

Parameters

string $recipient

The recipient of the message.

string $message

The actual message we want to send.

Return Value

mixed|null

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

Exceptions

TempStoreException
GuzzleException
IdentityProviderException