Last active
June 21, 2016 15:44
-
-
Save bengolder/1d27a6fe23156f7dd2c3eb6207f69d62 to your computer and use it in GitHub Desktop.
When I try to send a multiline email message through the Front API, all of the newline characters disappear, and I get a result similar to `bad_result.txt`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| These should be separate lines of text. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import json | |
| message = '''These | |
| should be separate lines | |
| of text.''' | |
| data = { | |
| 'subject': 'Hello', | |
| 'body': message, | |
| 'text': message, | |
| 'to': to, | |
| 'options': { | |
| 'archive': False | |
| } | |
| } | |
| payload = json.dumps(data) | |
| requests.post( | |
| url='https://api2.frontapp.com/channels/{}/messages'.format(settings.FRONT_EMAIL_CHANNEL_ID), | |
| data=payload, | |
| headers={ | |
| 'Authorization': 'Bearer {}'.format(settings.FRONT_API_TOKEN), | |
| 'Accept': 'application/json', | |
| 'Content-Type': 'application/json' | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment