Skip to content

Instantly share code, notes, and snippets.

@nasrulhazim
Created May 6, 2020 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasrulhazim/0c7be19cdec0fad599404acf48cbc3d4 to your computer and use it in GitHub Desktop.
Save nasrulhazim/0c7be19cdec0fad599404acf48cbc3d4 to your computer and use it in GitHub Desktop.
Microsoft Team Transformer from Webhook
<?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