Hello community!
I’m not a developer, but I’ve managed to create a Postman monitor that publishes every few hours a tweet using the Twitter API v1.1. It’s working, and it’s running, yay! A pre-request script fetches the content from a JSON file on my website that is updated hourly and has only a key/value pair:
{"tweet_text":"Hello, world!"}
The value is then stored in a variable that is passed on to Twitter API as being the content for the “status” parameter.
The problem is that it only works when the content does not contain any of the following characters:
: / ? ! ( ) + #
Attempts to post a tweet containing any of the above characters return an error code 32, “Could not authenticate you” from the Twitter API. (So the very “Hello world!” example given above would not work, given the exclamation point ending the sentence. And of course being unable to use the proper punctuation, let alone the # symbols, makes for poor tweets. (For the purpose of testing, I set the string on the pre-request script itself, instead of fetching from my site):
Any ideas on what may be causing my requests to result in errors?
Thanks
Edit: I’ve already tried
- escaping using \ followed by 0x3A and :, \u003A.
- using the escape() object
- sending the parameters as part of the body (x-www-form-urlencoded option)
- EncodeURI and EncodeURIComponent
- backslash before each punctuation mark