To send a message to a specific user or channel, you can use the following API endpoint:
Endpoint: POST /send-message/
Payload Parameters:
- exchange_token (Optional): Reserved for public commands that need to interact on behalf of other users. Contact DailyBot support for more information.
- message (Required): Message to send.
- target_users (Optional): List of user UUIDs that will receive the message.
- target_teams (Optional): List of team UUIDs that will receive the message. All members involved in those teams will receive the message.
- target_channels (Optional): List of JSON objects that include the following parameters:
- id (Required): ID of the channel where the message will be sent.
- is_channel_message (Required): Boolean, if the channel ID belongs to a user (it is a DM to a user), then this parameter must be set as "false". Otherwise, set it as "true" to send the message to a regular channel.
- image_url (Optional): URL of an image to post.
- buttons (Optional): JSON object that includes the following parameters:
- label (Required): Text for the button.
- label_after_click (Required): Message to be shown when the user clicks the button.
- value (Required): Next instruction to be executed by the bot if the type is "Command".
- button_type (Required): Type of the button (it should be "Command").
Request Example 1:
{
"exchange_token":"5945bf0g2-66f5-4b29-bbd6-07421dfga87",
"message": "John Wick",
"target_users": [user_uuid1, user_uuid2,...],
"target_teams": [team_uuid1, team_uuid2,...],
"target_channels": [{
"id": "id_channel",
"is_channel_message": true|false,
}
,...],
"image_url":"https://secure.gravatar.com/avatar/image.png",
"buttons":[{
"label": "Text button",
"label_after_click": "Text after click",
"value": "next command",
"button_type": "Command"
}
]
}
"exchange_token":"5945bf0g2-66f5-4b29-bbd6-07421dfga87",
"message": "John Wick",
"target_users": [user_uuid1, user_uuid2,...],
"target_teams": [team_uuid1, team_uuid2,...],
"target_channels": [{
"id": "id_channel",
"is_channel_message": true|false,
}
,...],
"image_url":"https://secure.gravatar.com/avatar/image.png",
"buttons":[{
"label": "Text button",
"label_after_click": "Text after click",
"value": "next command",
"button_type": "Command"
}
]
}
Request Example 2:
{
"message": “Welcome”,
"target_channels":[
{
"id": "IDLKSAN",
"is_channel_message": false,
}
],
"exchange_token":“108af73c0c11780c787745004189a8376f75bd6cad19b9c149e1d75428010e43”
}
"message": “Welcome”,
"target_channels":[
{
"id": "IDLKSAN",
"is_channel_message": false,
}
],
"exchange_token":“108af73c0c11780c787745004189a8376f75bd6cad19b9c149e1d75428010e43”
}
Response Example:
- No body is returned.
How to Use:
-
Prepare Payload: Create a JSON payload with the required and optional parameters based on your messaging needs.
-
Submit Request: Use the
POST
method on the specified endpoint to send the message. -
Review Response: No body is returned. Verify the HTTP status code to ensure a successful operation.
If you have any questions or need further assistance, please reach out to our support team at support@dailybot.com.
Comments
0 comments
Article is closed for comments.