0

I'm having an issue capturing the userid that will send a message to my Slack Channel and give me a visibility who uses my Python script. The variable name that I use in my Workflow Slack Channel is User and it's data type is Text. The script works fine if I hard code the user but that is not what I want.

I tried below script but it gives me "SyntaxError: invalid syntax"

import json
import requests

#This will send a slack message to my logs channel

url = "https://hooks.slack.com/workflows/XXXXXX/XXXXXX/XXXXXX/XXXXX"
data = {'User': <@User>, 'Message': 'used the app!'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)

I'm expecting the script will capture the userid whoever uses the script and send message to my Slack Channel. Correct syntax would be nice. Thank you very much.

JoeCastro
  • 59
  • 5

0 Answers0