Beispiel #1
0
 def send(self, message_text):
     payload = json.dumps({'text': message_text})
     if check_that_remote_connections_are_okay('SLACK POST:', payload):
         celery_request('POST',
                        url=self.webhook_url,
                        data=payload,
                        headers=self.headers)
Beispiel #2
0
 def send(self, message_text):
     payload = json.dumps({
         'text': message_text
     })
     if check_that_remote_connections_are_okay(
             'SLACK POST:', payload):
         celery_request('POST',
                        url=self.webhook_url,
                        data=payload,
                        headers=self.headers)
Beispiel #3
0
def send_mailgun_email(to, message, sender_profile, subject):
    post_data = {
        "from": "{name} <{email}>".format(
            name=sender_profile.name,
            email=sender_profile.get_clearmyrecord_email()),
        "to": [to],
        "subject": subject,
        "text": message
    }
    tasks.celery_request(
        'POST', MAILGUN_MESSAGES_API_URL, auth=mailgun_auth(), data=post_data)
Beispiel #4
0
 def send(self, to, body, subject=None):
     if isinstance(to, str):
         to = [to]
     data = {
         'body': body.replace('\n', '<br>'),
         'text': body,
         'to': to,
         'options': {
             'archive': True
         }
     }
     if subject:
         data.update(subject=subject)
     payload = json.dumps(data)
     if check_that_remote_connections_are_okay('FRONT POST:', payload):
         celery_request('POST',
                        url=self.build_api_url_endpoint(),
                        data=payload,
                        headers=self.build_headers())
Beispiel #5
0
 def send(self, to, body, subject=None):
     if isinstance(to, str):
         to = [to]
     data = {
         'body': body.replace('\n', '<br>'),
         'text': body,
         'to': to,
         'options': {
             'archive': True
         }
     }
     if subject:
         data.update(subject=subject)
     payload = json.dumps(data)
     if check_that_remote_connections_are_okay(
             'FRONT POST:', payload):
         celery_request('POST',
                        url=self.build_api_url_endpoint(),
                        data=payload,
                        headers=self.build_headers()
                        )