me = teams_api.people.me() if message.personId == me.id: return 'OK' else: 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')
print("SUGGESTION POST RECEIVED:") print(data) print("\n") global suggestion suggestion = data['suggestion'] teams_api.messages.create(spaceRoomId, text='A new suggestion was made: ' + suggestion + '.') 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')['emotebot'] 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 = 'emotebot-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')