DEV Community

AndySqlman
AndySqlman

Posted on

How to send a message to Slack workspace members using an SQL statement

Reposted from https://www.sqlmessenger.com/docreader.html?id=556

Q: How to send a message to Slack workspace members using an SQL statement?

A: You can use the "External Interface" feature of SQLMessenger to achieve this function. This method supports PostgreSQL, MySQL, SQL Server, Oracle, and Informix databases.

Step 1: Configure the Slack App in SQLMessenger.
For specific steps, please refer to Sending Messages to Slack Workspace Members via Slack API.

Step 2: Create datasource in SQLMessenger and enable the option "Allow sending messages to Slack from the interface table in this data source".

  • Create datasource in SQLMessenger
    Image description

  • Enable the option "Allow sending messages to Slack from the interface table in this data source"
    Image description

Step 3: Insert data into the interface table to send messages to members of your Slack workspace.

  • After enabling this option, SQLMessenger will create a table named 'sqlmessenger_intf' in the datasource. You can insert data into this table to send messages to members of your Slack workspace.

  • For example, to send a message to a member with member ID "U015NGUUGQ0" through the Slack App named "MySlackApp", you can use the following statement:

INSERT INTO sqlmessenger_intf
            (oper_type,
             slack_app_name,
             send_to,
             body)
VALUES      ( 'S',--Operation type. "S" indicates to send a message to Slack workspace members via Slack API.
             'MySlackApp',--Specify which Slack app to use for sending this message.
             'U015NGUUGQ0',--The Slack workspace members who will receive this message. Separate multiple members with a comma (",").
             'This is a test message' --The content of the message.
);
Enter fullscreen mode Exit fullscreen mode

Related Document: Using External Interface, DataSource Management, Sending Messages to Slack Workspace Members via Slack API

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more