Slack postMessage posts message multiple times

Slack postMessage posts message multiple times

I want to post a message to Slack through a bot. When I use api/postMessage through the bot, the message gets posted multiple times (sometimes 2,3 and rarely once). When I post the same message through postman, the message is posted only once.

I want to post a message to Slack through a bot. When I use api/postMessage through the bot, the message gets posted multiple times (sometimes 2,3 and rarely once). When I post the same message through postman, the message is posted only once.

def start_bot(redis_object):
    print('In start bot')
    slack_client = SlackClient('xoxb-xxxx')
    bot_id = None
    PING_DELAY = 1 #1 sec
    response = ''
    if slack_client.rtm_connect(with_team_state=False):
        print("Starter Bot connected and running!")
        bot_id = slack_client.api_call("auth.test")["user_id"]
        while True:
            rtm_response = slack_client.rtm_read()
            #print(rtm_response)
            command, channel = parse_bot_commands(rtm_response,bot_id)
            if command:
                print("Channel",channel)
                response = handle_command(command, channel,redis_object)
                print(str(1),'########',response)
                requests.get('https://slack.com/api/chat.postMessage',
                    headers={'Authorization': 'xoxb-xxxx'},
                    params = {'text': response, 'channel': channel})
            time.sleep(PING_DELAY)
    else:
        print("Connection failed.")

print(str(1),'########',response) prints only once on the terminal but the message is still posted multiple times in the thread. Posting through slack_client.api_call method also posts multiple times.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Top Python Development Companies | Hire Python Developers

After analyzing clients and market requirements, TopDevelopers has come up with the list of the best Python service providers. These top-rated Python developers are widely appreciated for their professionalism in handling diverse projects. When...

Building a simple REST API with Python and Flask

In this Python tutorial, you'll learn how to create a simple REST API with Flask, Python and FlaskRESTful. We create a simple REST API with Python. We use the Flask framework and Flask_RESTful library to make it fast and easy.

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3