Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pop-ups #6

Open
JoranAngevaare opened this issue Nov 8, 2021 · 0 comments
Open

Add pop-ups #6

JoranAngevaare opened this issue Nov 8, 2021 · 0 comments

Comments

@JoranAngevaare
Copy link
Contributor

Here is an example I wrote before:

import os
from pprint import pprint
from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler
import utilixapp = App(token=utilix.uconfig.get('slack', 'slack_api_token'))
​
@app.view("set-elog")
def view_submission(ack, body, client, say):
    ack()
    values = body["view"]['state']['values']
    pprint(values)
    say(f'testing stuf, say {values}', channel = body.get('channel_id', 'C016UUARHAR'))
    
@app.command("/developer_test")
def handle_command(body, ack, client, logger, say):
    ack()
    res = client.views_open(
        trigger_id=body["trigger_id"],
        view={
            "type": "modal",
            "callback_id": "set-elog",
            "title": {"type": "plain_text", "text": "Say somethgin"},
            "submit": {"type": "plain_text", "text": "Submit"},
            "close": {"type": "plain_text", "text": "Cancel"},
            "blocks": [
		{
			"type": "input",
			"block_id": "name",
			"element": {
				"type": "plain_text_input",
				"action_id": "name"
			},
			"label": {
				"type": "plain_text",
				"text": "What is your name?"
			}
		},
		{
			"type": "input",
			"block_id": "entry",
			"element": {
				"type": "plain_text_input",
				"action_id": "entry"
			},
			"label": {
				"type": "plain_text",
				"text": "What do you want to put in the elog"
			}
		}
            ],
        },
    )
    say(f'Thanks will do!')
​
@app.event("app_mention")
def event_test(say):
    say("Hi there!")
​
if __name__ == "__main__":
    SocketModeHandler(app, utilix.uconfig.get('slack', 'slack_app_token')).start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant