bots


Is it possible for a bot to have a dynamic name in Slack?


Is it possible to create a bot in slack which has a dynamic name, or who posts under a different name depending on a given situation?
Yes, here is an example in perl, which uses the hostname and pid to generate the name of the bot.
sub slack {
my ( $message ) = #_;
use LWP::UserAgent;
use HTTP::Request;
use Sys::Hostname;
my $uri = "https://hooks.slack.com/services/"
. "this-is-your-api-key";
my $json = '{"channel": "#example_channel", '
. '"username": "' . hostname . "." . $$ . '", '
. '"text": "' . $message . '", '
. '"icon_emoji": ":trollface:"}' ;
my $request = HTTP::Request->new( 'POST', $uri );
$request->header( 'Content-Type' => 'application/json' );
$request->content( $json );
my $agent = LWP::UserAgent->new;
my $result = $agent->request( $request );
}
When sending a message via incoming webhook, you have the option of sending a parameter username which specifies the name that will appear i.e.
{
"text": "the message i'm sending",
"name": "whatever-name-you-want"
}
(You can also specify a different icon on every message using the icon_url parameter with a value of a URL to the image you want)

Related Links

What would be the right way to ask the person to enter a city inside a bot?
What is the right way to save/track state inside a Facebook Messenger bot?
How to implement a chatbot to human executive switch using Microsoft Bot Framework?
How to stop or throttle bot traffic
Skype bot card images not showing up
Bot Framework - Sign-In Card, how get auth result
How to stop my telegram bot replying to a message multiple times
Empty message body in receive messages from telegram bot
Bot Framework Facebook Messenger Account Linking
Slack bot - using Botkit to clear old messages
How to make bot commands available only for admin in a supergroup in Telegram?
Data not predictably received in skype using bots
How to resolve the issue when I want to show multiple videos in Skype by using bots
messenger bot enable push
How to Do the next process when i am click the button in bot framework by using Thumbnail Card
How to use the ThumbnailCard in IDialog Context

Categories

HOME
artificial-intelligence
lambda
verification
yii
opencv-python
long-integer
scroll
transactions
tcsh
jersey-2.0
cryptography
flurry
tibco
clone
sentry
onvif
mutation-testing
slide
watch-os-3
erd
sap-fiori
business-intelligence
http-authentication
pe
error-logging
azure-machine-learning
device
ini
software-packaging
beego
sap-lumira
openbravo
ccavenue
annotation-processing
tsung
ibm-connections
memory-fences
actframework
om-next
uivisualeffectview
assert
cloudwatch
deployd
ol3-google-maps
brightscript
gestures
watir-webdriver
pen
mpmovieplayercontroller
pbx
libharu
mathml
timestamping
django-redis
grinder
deeplink
helm
android-mapview
arbre
vdm-sl
dynamics-ax-2012-r2
componentart
deque
fuseesb
kognitio-wx2
string.format
window-resize
maven-central
accountmanager
proxy-server
cloo
smips
saga
hyphen
progress-db
virtual-channel
form-for
axacropdf
arel
background-thread
ofstream
itunes-sdk
system-requirements
playorm
coordinate
hardcode
fragment-identifier
urchin
resharper-5.0
mysqli-multi-query
source-code-protection
ntruencrypt
ning
jboss-mdb

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App