Advertisement
Guest User

Untitled

a guest
Nov 9th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. def sendMessage(spaceId, messageTitle, messageText):
  2.  
  3.     urlToPostMessageBack = "/teams/" + spaceId + "/messages"
  4.  
  5.     jsonRaw ={
  6.         "type": "appMessage",
  7.         "version": 1,
  8.         "annotations": [
  9.             {
  10.                 "type": "generic",
  11.                 "version": 1,
  12.                 "text": "<enter your text here>"
  13.             }
  14.         ]
  15.     }
  16.  
  17.     headers = {'Authorization': "Bearer " + getToken(), "Content-Type" : "application/json"}
  18.     resp = requests.post("https://api.watsonwork.ibm.com" + urlToPostMessageBack, data={"body": json.dumps(jsonRaw, ensure_ascii=False)}, headers = headers)
  19.     print resp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement