Our Messaging API designed to fullfill most of your use cases and can be easily integrate to any of the system. We can send single message to both private and public channel in your workspace by adding the channel as slack in messaging API. The D7Messaging App should be added to your workspace before sending slack messages.
POST
/messages/v1/send
Authentication
AUTHORIZATION: Bearer Token
Request parameters
Parameter
Value / Pattern
*work_space_name
Workspace name to send message. D7Messaging App should be added to the workspace here.
*channel_name
Channel name to send message. To send a message to a channel, you can provide the channel name for both public and private channels. For public channels, simply specify the channel name. However, for private channels, you'll need to grant access to the D7Messaging App by using the command "/invite @D7Messaging".
*content
The message content is being sent. Now you can only send text messages through this API
*channel
To select the messaging channel that you want to use. (e.g., slack, SMS etc.)
report_url
To receive delivery status (DLR) for your slack message, specify the callback server URL where you want to receive the slack message status updates using the report_url parameter. When the delivery status changes, the status updates will be sent to the specified URL. For information on the format of the DLR message, please refer to the "Receiving DLR" section.
Response
When the request is validated, request_id, status and created time will be returned. Users can use this request_id to query status using the Get status endpoint.
{"detail":{"code":"ACCESS_TOKEN_SIGNATURE_VERIFICATION_FAILED","message":"It looks like your requests were failed due to a missing or invalid 'Access Token'. Sign up at https://app.d7networks.com and create an authentication token in the developer section."}}
constClient=require('direct7')constclient=newClient(apiToken="Your API token")constresponse=awaitclient.slack.sendSlackMessage({content:'Hello, this is a test message!',work_space_name:'WoekSpaceName',channel_name:'ChannelName',report_url:'https://the_url_to_recieve_delivery_report.com'});console.log(response);
fromdirect7importClientclient=Client(api_token="Your API token")client.slack.send_slack_message(content="Greetings from D7 API",work_space_name="WorkspaceName",channel_name="ChannelName",report_url="https://the_url_to_recieve_delivery_report.com")
require_once__DIR__.'/vendor/autoload.php';usedirect7\Direct7\Client;$client=newClient(api_token="Your API token")$response=$direct7->slack->sendSlackMessage(content:'Hello, World!',work_space_name:'WorkSpaceName',channel_name:'ChannelName',report_url:'https://example.com/callback');var_dump($response);
import("github.com/d7networks/direct7-go-sdk/direct7")apiToken:="Your Api Token"client:=direct7.NewClient(apiToken)slack:=direct7.NewSlack(client)content:="Greetings from D7 API"workSpaceName:="WorkspaceName"channelName:="ChannelName"reportURL:="https://the_url_to_recieve_delivery_report.com"response,err:=slack.SendSlackMessage(content,workSpaceName,channelName,reportURL)
varheaders={'Content-Type':'application/json','Authorization':'Bearer {{api_access_token}}'};varrequest=http.Request('POST',Uri.parse('https://api.d7networks.com/messages/v1/send'));request.body=json.encode({"message_globals":{"report_url":"https://the_url_to_recieve_delivery_report.com"},"messages":[{"channel":"slack","content":"Greetings from D7 API","work_space_name":"WorkspaceName","channel_name":"ChannelName"}]});request.headers.addAll(headers);http.StreamedResponseresponse=awaitrequest.send();if(response.statusCode==200){print(awaitresponse.stream.bytesToString());}else{print(response.reasonPhrase);}
require'direct7'client=Direct7::Client.new('Your API token')client.slack.send_slack_message(content="Greetings from D7 API",work_space_name="WorkspaceName",channel_name="ChannelName",report_url="https://the_url_to_recieve_delivery_report.com")