Skip to content

Commit

Permalink
notification news
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKatsoulis committed Apr 29, 2018
1 parent 0abdac0 commit 4f6658e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ def send_users_notification(database, company_name, article_id):
users_collection = database['users']
query = {'notification_type': 'Companies'}
users = users_collection.find(query)
logger.info('Checking if user follows {}'.format(company_name))
for user in users:
if company_name in user.get('companies'):
url = 'https://api.chatfuel.com/bots/591189a0e4b0772d3373542b/' \
'users/{}/' \
'send?chatfuel_token=vnbqX6cpvXUXFcOKr5RHJ7psSpHDRzO1hXBY8dkvn50ZkZyWML3YdtoCnKH7FSjC' \
'&chatfuel_block_id=5ae5a2d9e4b0f617d6a06eee&last%20name={}&article={}'.\
format(user.get('user_id'), user.get('name'), article_id)
logger.info(url)
logger.info(user.get('name'))
try:
r = requests.post(url)
except requests.exceptions.RequestException as e:
Expand Down

0 comments on commit 4f6658e

Please sign in to comment.