| 1 |
Slack Module |
| 2 |
|
| 3 |
Arsen Semenov |
| 4 |
|
| 5 |
<[email protected]> |
| 6 |
|
| 7 |
Copyright © 2021 arsperger.com |
| 8 |
__________________________________________________________________ |
| 9 |
|
| 10 |
Table of Contents |
| 11 |
|
| 12 |
1. Admin Guide |
| 13 |
|
| 14 |
1. Overview |
| 15 |
2. Dependencies |
| 16 |
|
| 17 |
2.1. Kamailio Modules |
| 18 |
2.2. External Libraries or Applications |
| 19 |
|
| 20 |
3. Parameters |
| 21 |
|
| 22 |
3.1. slack url (str) |
| 23 |
3.2. channel (str) |
| 24 |
3.3. username (str) |
| 25 |
3.4. icon_emoji (str) |
| 26 |
|
| 27 |
4. Functions |
| 28 |
|
| 29 |
4.1. slack_send(format) |
| 30 |
|
| 31 |
List of Examples |
| 32 |
|
| 33 |
1.1. Set slack webhook URL parameter |
| 34 |
1.2. Set channel parameter |
| 35 |
1.3. Set username parameter |
| 36 |
1.4. Set icon_emoji parameter |
| 37 |
1.5. slack_send usage |
| 38 |
|
| 39 |
Chapter 1. Admin Guide |
| 40 |
|
| 41 |
Table of Contents |
| 42 |
|
| 43 |
1. Overview |
| 44 |
2. Dependencies |
| 45 |
|
| 46 |
2.1. Kamailio Modules |
| 47 |
2.2. External Libraries or Applications |
| 48 |
|
| 49 |
3. Parameters |
| 50 |
|
| 51 |
3.1. slack url (str) |
| 52 |
3.2. channel (str) |
| 53 |
3.3. username (str) |
| 54 |
3.4. icon_emoji (str) |
| 55 |
|
| 56 |
4. Functions |
| 57 |
|
| 58 |
4.1. slack_send(format) |
| 59 |
|
| 60 |
1. Overview |
| 61 |
|
| 62 |
This module provides integration with Slack over webhooks. Slack |
| 63 |
integration (https://api.slack.com/messaging/webhooks) |
| 64 |
|
| 65 |
It relays on libcurl through http_client module. |
| 66 |
|
| 67 |
2. Dependencies |
| 68 |
|
| 69 |
2.1. Kamailio Modules |
| 70 |
2.2. External Libraries or Applications |
| 71 |
|
| 72 |
2.1. Kamailio Modules |
| 73 |
|
| 74 |
The following modules must be loaded before this module: |
| 75 |
* HTTP_CLIENT - the http_client module should be loaded first. |
| 76 |
|
| 77 |
2.2. External Libraries or Applications |
| 78 |
|
| 79 |
The following libraries or applications must be installed before |
| 80 |
running Kamailio with this module loaded: |
| 81 |
* libcurl |
| 82 |
|
| 83 |
3. Parameters |
| 84 |
|
| 85 |
3.1. slack url (str) |
| 86 |
3.2. channel (str) |
| 87 |
3.3. username (str) |
| 88 |
3.4. icon_emoji (str) |
| 89 |
|
| 90 |
3.1. slack url (str) |
| 91 |
|
| 92 |
Slack webhook url |
| 93 |
|
| 94 |
Default value is not set (empty) |
| 95 |
|
| 96 |
Example 1.1. Set slack webhook URL parameter |
| 97 |
... |
| 98 |
modparam("slack", "slack_url", "https://hooks.slack.com/services/T00000000/B0000 |
| 99 |
0000/XXXXXXXXXXXXXXXXXXXXXXXX") |
| 100 |
... |
| 101 |
|
| 102 |
3.2. channel (str) |
| 103 |
|
| 104 |
Slack channel name |
| 105 |
|
| 106 |
Default value is #kamailio |
| 107 |
|
| 108 |
Example 1.2. Set channel parameter |
| 109 |
... |
| 110 |
modparam("slack", "channel", "#kamailio") |
| 111 |
... |
| 112 |
|
| 113 |
3.3. username (str) |
| 114 |
|
| 115 |
Specify the username for the published message |
| 116 |
|
| 117 |
Default value is webhookbot. |
| 118 |
|
| 119 |
Example 1.3. Set username parameter |
| 120 |
... |
| 121 |
modparam("slack", "username", "webhookbot") |
| 122 |
... |
| 123 |
|
| 124 |
3.4. icon_emoji (str) |
| 125 |
|
| 126 |
specify an emoji (using colon shortcodes, eg. :white_check_mark:) to |
| 127 |
use as the profile photo alongside the message. |
| 128 |
|
| 129 |
Default value is :ghost: |
| 130 |
|
| 131 |
Example 1.4. Set icon_emoji parameter |
| 132 |
... |
| 133 |
modparam("slack", "icon_emoji", ":ghost:") |
| 134 |
... |
| 135 |
|
| 136 |
4. Functions |
| 137 |
|
| 138 |
4.1. slack_send(format) |
| 139 |
|
| 140 |
4.1. slack_send(format) |
| 141 |
|
| 142 |
Send a formatted message to slack channel. |
| 143 |
|
| 144 |
The parameters are: |
| 145 |
* format - The formatted string to be sent. |
| 146 |
|
| 147 |
The parameters can contain pseudo-variables. |
| 148 |
|
| 149 |
This function can be used from ANY_ROUTE. |
| 150 |
|
| 151 |
Example 1.5. slack_send usage |
| 152 |
... |
| 153 |
slack_send("Hello from Kamailio! caller=$fU;callee=$tU;callid=$ci"); |
| 154 |
... |