예제 #1
0
 def test_create_webhook(self):
     webhook = Webhook()
     room = Room.get(session, name=roomname)
     webhook.targetUrl ='http://foo.net/api/v1'
     webhook.filter = 'roomId={}'.format(room.id)
     webhook.name = 'python sdk testing webhook'
     webhook.resource = 'messages'
     webhook.event = 'created'
     webhook = webhook.create(session)
     self.assertIsInstance(webhook, Webhook)
예제 #2
0
    def post(self):

        # Register our webhook
        session = Session('https://api.ciscospark.com',
                          os.getenv("SPARK_TOKEN"))
        webhook = Webhook()
        webhook.targetUrl = request.url_root + '/api/spark'
        webhook.resource = 'messages'
        webhook.event = 'created'
        resp = webhook.create(session)
        if resp.ok:
            REGISTERED = True