npm update -g generator-symphony
config.yaml
file:config.yaml
file, the BDK assumes that your Symphony Pod, Agent, and Key Manager components are all accessible via the same host, port, and scheme.config.yaml
file:host
port
context
scheme
pod
host
, port
, scheme
, context
, and proxy
attributesbot
username
, privateKeyPath
, certificatePath
, andcertificatePassword
app
appId
, privateKeyPath
, certificatePath
, and certificatePassword
ssl
trustStore
and trustStore
password for SSL communicationversion
idFilePath
retry
maxAttempts
multiplier
initialIntervalMillis
maxIntervalMillis
maxIntervalMillis
is 1500 ms, then the interval for the next retry will be 1500 ms.SymphonyBdk
instance with your config.yaml
file, the BDK loads in your config and authenticates your bot. Once authenticated, your bot is ready to leverage the REST APIs in order to create rich automations and workflows on Symphony.SymphonyBDK
class within your bot project:DatafeedService
interface that makes it easier than ever for bots to manage real-time messages and events. The DatafeedService
interface provides the following methods for your bot to use:start()
stop()
subscribe(RealTimeEventListener)
unsubscribe(RealTimeEventListener)
RealTimeEventListener
. This RealTimeEventListener
class must implement eventType methods (e.g. onMessageSent()
) along with custom business logic inside.MESSAGESENT
) of the inbound event. If there is a corresponding eventType method registered, the bot will execute the business logic inside of this eventType method. Otherwise the bot will not perform an action and will continue to listen for inbound events from the datafeed. An example implementation is provided out of the box by the BDK 2.0:RealTimeEventListener
class and their corresponding eventTypes. Implement the following methods in order to listen for a given Symphony event:onMessageSent()
onInstantMessageCreated()
onMessageSuppressed()
onRoomCreated()
onRoomUpdated()
onRoomDeactivated()
onRoomReactivated()
onUserRequestedToJoinRoom()
onUserJoinedRoom()
onUserLeftRoom()
onRoomMemberPromotedToOwner()
onRoomMemberDemotedFromOwner()
onConnectionRequested()
onConnectionAccepted()
onSymphonyElementsAction()
onSharedPost()
ActivityRegistry
class:@bdk2-bot /buy
(Slash command with a bot @mention)/buy 1000 goog
(Slash command without a bot @mention)'hello'
(Not a Slash command - Listen for a specific word)CommandActivity
class, you must implement the matcher()
and onActivity()
methods provided by the AbstractActivity
class. For more information on the implementation of the CommandActivity
class, continue here.id
= "hello-form"<text-field>
name = "name"FormReplyActivity
class:FormReplyActivity
class, you must implement the methods matcher()
, onActivity()
and info()
methods provided by the AbstractActivity
class. For more information on the implementation fo the FormReplyActivity
class, continue here.RealTimeEventListener
class. In addition, this class makes it easy to access user, message, and room data in context. Each eventType method is implemented with instances of V4Initiator
and V4MessageSent
objects:V4Initiator
class methods to access the the user data in context:initiator.getUser().getUserId()
initiator.getUser().getFirstName()
initiator.getUser().getLastName()
initiator.getUser().getDisplayName()
initiator.getUser().getEmail()
initiator.getUser().getUsername()
V4MessageSent
class methods to access message data in context:event.getMessage().getMessageId()
event.getMessage().getTimestamp()
event.getMessage().getMessage()
event.getMessage().getSharedMessage()
event.getMessage().getData()
event.getMessage().getAttachments()
V4MessageSent
class methods to access stream data in context:event.getMessage().getStream().getStreamId()
event.getMessage().getStream().getStreamType()
event.getMessage().getStream().getRoomName()
event.getMessage().getStream().getMembers()
event.getMessage().getStream().getExternal()
event.getMessage().getStream().getCrossPod()
CommandActivity
classes have access to to this data through the CommandContext
class. This class is instantiated with instances of V4Initiator
and V4MessageSent
objects. Bots are able access to the user, message, and stream data in context through the same methods shown above. Leverage these methods within the onActivity()
method shown below:FormReplyContext
class. This class is instantiated with instances of the V4Initiator
and V4SymphonyElementsAction
class. The V4SymphonyElementsAction
class provides the following methods to access form data in context:context.getSourceEvent().getStream()
context.getSourceEvent().getFormMessageId()
context.getSourceEvent().getFormId()
context.getSourceEvent().getFormValues()
TemplateEngine
class provided by the BDK. Implement the newBuiltInTemplate()
method to reuse an simple messageML template:newTemplate()
methods provided by the TemplateEngine
class:newBuiltInTemplate()
newTemplateFromFile()
newTemplateFromClasspath()
newTemplateFromUrl()
newTemplateFromClasspath()
method:BotApplication.java
class:@Component
annotation:com.symphony.bdk.spring.events.RealTimeEvent<T>
parameter@Slash
annotation. Note that the CommandContext
is mandatory to successfully register your command. If not defined, a warn
message will appear in your application log:FormReplyActivity
or CommandActivity
will be automatically registered within the ActivityRegistry