Created
August 8, 2021 01:19
-
-
Save acidjazz/d8da559adbf9cd533154a83b1e142242 to your computer and use it in GitHub Desktop.
webhooks
This file contains hidden or 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
<? | |
public function test() | |
{ | |
if ($this->hook->type === 'discord') { | |
Http::post( | |
$this->hook->url, | |
[ | |
'username' => 'fume', | |
'avatar_url' => 'https://fume.app/fume-light-full.png', | |
'embeds' => [ | |
[ | |
'author' => [ | |
'name' => 'Spicy Chicken', | |
'icon_url' => | |
'https://haze.s3.amazonaws.com/hB436S9eEeTPxFrqcGItJ9iVyeHPDqBIfwwBQsuM.jpg', | |
], | |
'color' => '3551096', | |
'url' => 'https://fume.app/', | |
'fields' => [ | |
[ | |
'name' => 'Commit', | |
'value' => | |
<<<'TAG' | |
Bob Chevrolet committed [⬆️ Updated dependencies](https://github.com) to [master](https://github.com/) | |
TAG | |
, | |
], | |
[ | |
'name' => 'Deployment', | |
'value' => | |
<<<'TAG' | |
John smith deployed [spicy chicken](https://fume.app) to | |
[staging](https://fume.app/) using the Fume CLI on John's Macbook Pro | |
TAG | |
, | |
], | |
], | |
], | |
], | |
] | |
); | |
} | |
if ($this->hook->type === 'slack') { | |
$commit = <<<'TAG' | |
Bob Chevrolet committed <https://github.com|⬆️ Updated dependencies> to <https://github.com|master> | |
TAG; | |
$deployment = <<<'TAG' | |
John smith deployed <https://fume.app|spicy chicken> to | |
<https://fume.app/|staging> using the Fume CLI on John's Macbook Pro | |
TAG; | |
$payload = [ | |
'username' => 'fume', | |
'icon_url' => 'https://fume.app/fume-light-full.png', | |
'text' => <<<'TAG' | |
Project: *Spicy Chicken* | |
TAG | |
. "\n" . ' *Commit* ' . "\n\t" . $commit . "\n" . ' *Deployment* ' . "\n\t" . $deployment . "\n\n", | |
]; | |
Http::post($this->hook->url, $payload); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment