Skip to content

Commit a84b7f8

Browse files
Add a new example for chatPostMessage with Blocks
See #114
1 parent 6e4b7c8 commit a84b7f8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

doc/examples/posting-message.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,23 @@
1414
'channel' => 'general',
1515
'text' => 'Hello world',
1616
]);
17+
18+
$response = $client->chatPostMessage([
19+
'username' => 'example bot',
20+
'channel' => 'general',
21+
'text' => 'Message with blocks',
22+
'blocks' => json_encode([
23+
[
24+
'type' => 'section',
25+
'text' => [
26+
'type' => 'mrkdwn',
27+
'text' => ':tada: Blocks are working!',
28+
],
29+
],
30+
]),
31+
]);
1732

18-
echo 'Message sent.';
33+
echo 'Messages sent.';
1934
} catch (SlackErrorResponse $e) {
2035
echo 'Fail to send the message.', PHP_EOL, $e->getMessage();
2136
}

0 commit comments

Comments
 (0)