Slack
نظرة عامة
Section titled “نظرة عامة”يدمج موفر Slack العامل الرقمي لديك مع مساحات عمل Slack. وهو يدعم:
- الرسائل المباشرة (DMs)
- رسائل القنوات
- الإشارات إلى التطبيق
- المكونات التفاعلية (الأزرار والقوائم)
- رسائل Block Kit الغنية
- أوامر slash
- الردود ضمن الخيوط
المتطلبات المسبقة
Section titled “المتطلبات المسبقة”- مساحة عمل Slack
- صلاحية مسؤول لإنشاء تطبيق Slack
الإعداد
Section titled “الإعداد”-
إنشاء زوج رموز تكوين Slack
انتقل إلى api.slack.com/apps وأنشئ زوج رموز تكوين للتطبيق. انسخ القيمتين:
- Configuration access token (
xoxe.xoxp-...) - Configuration refresh token (
xoxe-1-...)
- Configuration access token (
-
تكوين الموفر
answers.json {"setup_answers": {"messaging-slack": {"slack_configuration_access_token": "xoxe.xoxp-xxx","slack_configuration_refresh_token": "xoxe-1-xxx"}}} -
تشغيل الإعداد
Terminal window gtc setup --answers answers.json ./my-bundle -
النقر على Add to Slack
يقوم الإعداد بتسجيل تطبيق Slack أو تحديثه ويعرض إجراء Add to Slack. افتح عنوان URL لتفويض Slack الذي تم إنشاؤه، واختر مساحة العمل، وراجع النطاقات المطلوبة، ثم وافق على التثبيت.
عندما يعود تحويل OAuth إلى الإعداد، يحفظ Greentic معرف تطبيق Slack، ومعرف العميل، وسر العميل، وإجابات OAuth الخاصة بوقت التشغيل للمستأجر. إذا لم تتم معالجة callback تلقائيا، فشغل
gtc setup --answers answers.json ./my-bundleمرة أخرى بعد الموافقة على التثبيت. -
إضافة التطبيق في Slack
افتح Slack وتحقق من تثبيت التطبيق في مساحة العمل. لمحادثات القنوات، أضف التطبيق إلى القناة التي يجب أن يرد فيها العامل. يمكنك فعل ذلك من إعدادات تكامل القناة أو عبر ذكر التطبيق أو دعوته في القناة.
-
بدء وقت التشغيل أو إعادة تشغيله
Terminal window gtc start ./my-bundleيستخدم بدء التشغيل
slack_app_idالمحفوظة وزوج رموز التكوين لتحديث بيان تطبيق Slack بعنوان webhook الحالي. -
اختبار القناة
أرسل رسالة مباشرة إلى التطبيق أو اذكر التطبيق في قناة Slack التي أضفته إليها. تصل أحداث القنوات فقط للقنوات التي يكون التطبيق عضوا فيها وتسمح بها النطاقات المثبتة.
خيارات التكوين
Section titled “خيارات التكوين”| الخيار | مطلوب | الوصف |
|---|---|---|
slack_configuration_access_token | نعم | رمز تكوين Slack قصير العمر المستخدم لتحديثات بيان التطبيق |
slack_configuration_refresh_token | نعم | Refresh token يستخدم لتدوير configuration access token |
slack_app_id | منشأ | Slack app id يتم إنشاؤه أو إرجاعه بواسطة الإعداد |
slack_client_id | منشأ | Slack OAuth client id يتم إرجاعه عند تسجيل التطبيق |
client_secret | سر منشأ | Slack OAuth client secret يتم إرجاعه عند تسجيل التطبيق |
Features
Section titled “Features”Text Messages
Section titled “Text Messages”- id: reply type: reply config: message: "Hello! How can I help you?"Markdown Formatting
Section titled “Markdown Formatting”Slack uses mrkdwn format:
- id: formatted type: reply config: message: | *Bold* _Italic_ `code` >Blockquote • Bullet pointBlock Kit Messages
Section titled “Block Kit Messages”Use Slack’s Block Kit for rich layouts:
- id: rich_message type: reply config: blocks: - type: section text: type: mrkdwn text: "*Welcome!*\nHow can I assist you today?" - type: divider - type: actions elements: - type: button text: type: plain_text text: "Get Help" action_id: "help_clicked" value: "help" - type: button text: type: plain_text text: "View Status" action_id: "status_clicked" value: "status"Interactive Buttons
Section titled “Interactive Buttons”- id: ask_action type: reply config: message: "What would you like to do?" blocks: - type: actions elements: - type: button text: type: plain_text text: "Create Ticket" style: primary action_id: "create_ticket" - type: button text: type: plain_text text: "Cancel" style: danger action_id: "cancel"Select Menus
Section titled “Select Menus”- id: select_option type: reply config: blocks: - type: section text: type: mrkdwn text: "Select a category:" accessory: type: static_select action_id: "category_select" options: - text: type: plain_text text: "Technical Support" value: "technical" - text: type: plain_text text: "Billing" value: "billing" - text: type: plain_text text: "General" value: "general"Thread Replies
Section titled “Thread Replies”Reply in a thread:
- id: thread_reply type: reply config: message: "This replies in the thread" thread_ts: "{{original_message.thread_ts}}"File Uploads
Section titled “File Uploads”تتغير واجهات API الخاصة بملفات Slack بمرور الوقت. استخدم هذا فقط عندما تعرض حزمة messaging-slack المثبتة دعم الملفات لإصدارك؛ وإلا فأرسل رابطا أو استخدم تدفق الرفع الخارجي الحالي في Slack.
- id: upload_file type: reply config: files: - url: "https://example.com/report.pdf" filename: "report.pdf" title: "Monthly Report"Ephemeral Messages
Section titled “Ephemeral Messages”Messages only visible to one user:
- id: ephemeral type: reply config: message: "Only you can see this" ephemeral: true user: "{{user_id}}"Handling Interactions
Section titled “Handling Interactions”Button Clicks
Section titled “Button Clicks”name: handle_interactionversion: "1.0"
nodes: - id: route_action type: branch config: conditions: - expression: "action_id == 'help_clicked'" to: show_help - expression: "action_id == 'create_ticket'" to: create_ticket default: unknown_action
- id: show_help type: reply config: message: "Here's how I can help..."
triggers: - type: block_action target: route_actionSelect Menu Changes
Section titled “Select Menu Changes”- id: handle_select type: branch config: conditions: - expression: "selected_value == 'technical'" to: technical_flow - expression: "selected_value == 'billing'" to: billing_flowSlash Commands
Section titled “Slash Commands”- Go to Slash Commands in your app settings
- Create a command (e.g.,
/support) - Set Request URL to your webhook
Handle in your flow:
name: slash_commandversion: "1.0"
nodes: - id: handle_command type: reply config: message: "Support bot at your service!" response_type: in_channel # or "ephemeral"
triggers: - type: slash_command command: "/support" target: handle_commandChannel Configuration
Section titled “Channel Configuration”Single Channel
Section titled “Single Channel”tenants: demo: teams: support: channels: slack: provider: messaging-slack config: channel_id: "C1234567890"Multiple Channels
Section titled “Multiple Channels”tenants: demo: teams: support: channels: slack-general: provider: messaging-slack config: channel_id: "C1234567890" slack-vip: provider: messaging-slack config: channel_id: "C0987654321"Troubleshooting
Section titled “Troubleshooting”App Not Receiving Messages
Section titled “App Not Receiving Messages”-
Verify Event Subscriptions:
- Check Request URL is correct
- Ensure events are enabled
- Verify bot is subscribed to correct events
-
Check Bot Permissions:
- Reinstall app after adding scopes
- Verify bot is in the channel
-
Test Webhook:
Terminal window curl https://your-domain.com/v1/messaging/ingress/messaging-slack/demo/default
“not_authed” Error
Section titled ““not_authed” Error”Your bot token is invalid or expired. Get a fresh token from OAuth & Permissions.
”channel_not_found” Error
Section titled “”channel_not_found” Error”- Verify channel ID is correct
- Ensure bot is added to the channel
- Check channel is not archived
Rate Limiting
Section titled “Rate Limiting”Slack rate limits vary by method. Handle gracefully:
- id: reply type: reply config: message: "Response" retry_on_rate_limit: true max_retries: 3Security
Section titled “Security”Greentic automatically validates:
- Request timestamp
- Signature using signing secret
- Token verification
Next Steps
Section titled “Next Steps”- Block Kit Builder - Design rich messages
- موفر Teams - إضافة تكامل Teams
- دليل التدفقات - بناء workflows معقدة