teams_api.messages.create(room.id, text='Hello, person who has email ' + str(email) + ' and sent the message ' + str(message)) else: print('received none post request, not handled!') if __name__ == '__main__': # Read the configuration that contains the bot access token config = read_yaml_data('/opt/config/config.yaml')['hello_bot'] teams_api = WebexTeamsAPI(access_token=config['teams_access_token']) # Get some required NGrok information ngrok_url = get_ngrok_url() # Define the name of webhook webhook_name = 'hello-bot-wb-hook' # Find any existing webhooks with this name and if this already exists then delete it dev_webhook = find_webhook_by_name(teams_api, webhook_name) if dev_webhook: delete_webhook(teams_api, dev_webhook) # Create a new teams webhook with the name defined above create_webhook(teams_api, webhook_name, ngrok_url + '/teamswebhook') # Host flask web server on port 5000 flask_app.run(host='0.0.0.0', port=5000)
elif (word in interaction): used.append(word) if (interaction[word] != []): s = random.choice(interaction[word]) query.append(s) spark_api.messages.create(room.id, text=s) interaction[word].remove(s) x = 1 i = i + 1 if (x == 0): spark_api.messages.create(room.id, text=random.choice( interaction['generic'])) else: print('received none post request, not handled!') if __name__ == '__main__': config = read_yaml_data('/opt/config/config.yaml')['hello_bot'] spark_api = CiscoSparkAPI(access_token=config['spark_access_token']) ngrok_url = get_ngrok_url() webhook_name = 'hello-bot-wb-hook' dev_webhook = find_webhook_by_name(spark_api, webhook_name) if dev_webhook: delete_webhook(spark_api, dev_webhook) create_webhook(spark_api, webhook_name, ngrok_url + '/sparkwebhook') flask_app.run(host='0.0.0.0', port=5000)