Created
May 6, 2020 22:00
-
-
Save nasrulhazim/0c7be19cdec0fad599404acf48cbc3d4 to your computer and use it in GitHub Desktop.
Microsoft Team Transformer from Webhook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\WebhookClient\Transformers; | |
use App\Contracts\WebhookPayload as Payload; | |
class MicrosoftTeam | |
{ | |
public static function transform(Payload $payload): array | |
{ | |
return [ | |
'title' => $payload->getTitle(), | |
'text' => $payload->getText(), | |
'themeColor' => $payload->getColor(), | |
'sections' => [ | |
[ | |
'potentialAction' => [ | |
[ | |
'@context' => 'http://schema.org', | |
'@type' => 'OpenUri', | |
'name' => $payload->getActionName(), | |
'targets' => [[ | |
'os' => 'default', | |
'uri' => $payload->getActionUrl(), | |
]], | |
], | |
], | |
], | |
], | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment