# Sending a message to a webhook bot in VBA? (Python script attached)



## anon500 (Sep 16, 2020)

I would like to send messages to a webhook.

Attached is my python script, could anyone help convert this to Excel VBA?

I've seen someone do it here 




__
		https://www.reddit.com/r/vba/comments/6tz0yz
 but I'm a novice to programming


```
import json
import requests
import sys

WEBHOOK_URI = 'webhook url'

def post_message(msg):
    response = None
    try:
        response = requests.post(
            url=WEBHOOK_URI,
            json={"Content": msg})
        return json.loads(response.text)
    except:
        return response.text

## Check for a message as runtime parameter
if len(sys.argv) != 2:
    print('\n\tIncorrect usage!')
    print('\n\tExample Usage:')
    print('\tpython3 ' + sys.argv[0] + ' \"Hello World\"\n')
    exit()

## Get the message to send as a parameter
message = sys.argv[1]

## Post the message
req_res = post_message(message)
print(json.dumps(req_res, indent=2))
```


Usage is...

python c:\user\python scripts\send_message.py "Hello World"


----------

