icon picker
Devs/Admins

All functions and questions for devs and admins
Last edited 104 days ago by John Kesig.
error
Please understand that this could change significantly to allow for more flexibility in development and maintenance.

Plugin API

List of functions I’ve made accessible to the dev/user, what arguments they take, and what they accomplish. This is by no means all of them, it’s just what I felt was the more important commands without the need for diving deep into it. In this you should find several things:
Name of the command
Required arguments for calling the function
Description of the command
An example of the function in action
The location where you can find it in the plugin

Search
get_access_token
No Arguments
get_app_level_token
No Arguments
get_channel_id
{access_token}, {current_project}
get_channel_users
{access_token}, {channel_id}
get_current_project
No Arguments
get_notify_custom_channel
No Arguments
get_notify_user_method
No Arguments
get_notify_user_pool
No Arguments
get_prism_slack_username
No Arguments
get_server_machine
No Arguments
is_studio_loaded
No Arguments
reset_bolt_server_status
No Arguments
start_bolt_server
No Arguments
stop_bolt_server
No Arguments
get_access_token
Arguments
No Arguments
Description
Retrieve the access token from the slack json file
Example
slack = pcore.getPlugin('Slack')

access_token = slack.get_access_token()

print(access_token)
Location
Slack\Scripts\client\prism\api.py


Extending the Bolt Server Functions

These are examples of things you can include in the Bolt Server file to have more interaction with Slack. I’m not going to post whole functions here, unless necessary, but give you an idea of where to put and what you will need.

Create Project on Slack Channel Creation

In order to do this, you’ll need to go to this file:
{Slack Plugin Directory}/Scripts/server/events.py
For this particular setting, we are creating a Project when a Slack channel gets created. However, we are filtering out the first two characters to ensure that it doesn’t just create projects willy-nilly. We are taking the name of the channel and using it to create a Project at the designated location along with the Prism Preset we have here at the studio. If you have a preset, you can input it in that location.

...

@self.app.event("channel_created")
def event_channel_created(ack, event, say):
ack()

channel_name = event["channel"]["name"].upper()
...
(Request Block)
...

if '25' in channel_name[:2]:
path = f"{PATH_TO_PROJECTS}/{channel_name}"
self.core.projects.createProject(channel_name, path, preset="WF")


Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.