Nicolai9852
Nicolai9852

Reputation: 1

Unable to send Tweet Text containing line breaks to Discord via Webhook

So I ran some testing and found my issue.

I am trying to create a Twitter ---> Discord via Webhook and I found out that sometimes the messages in Discord would not be sent.

My own investigation found out that if a Tweet text is separated by a Line Break, it will return an error 400. However, if the tweet text is not separated by the line break, it would have no issues. Below is attached examples with and without the Tweet text. Hopefully someone can help me with this issue :-)

Screenshots below

Example below where it worked (without line breaks in Tweet) (Succes): https://cdn.discordapp.com/attachments/796362439159185408/845663070545117184/unknown.png https://cdn.discordapp.com/attachments/796362439159185408/845663103311544367/unknown.png

Example where I just wrote "Test" (Succes): https://cdn.zapier.com/storage/photos/fc1adef9e707786d8412353186f894eb_2.png

Examples below which contains line breaks (Error, returns error 400): https://cdn.discordapp.com/attachments/564727164470165504/845665915437449226/unknown.png https://cdn.zapier.com/storage/photos/2b498a21900713e0c38e1978a6f14eaf_2.png https://cdn.zapier.com/storage/photos/4ea22a1f477a4e99ec6e2c9944359e73_2.png

Code below

{
"username": "CREY Games Tweets",
  "avatar_url": "https://cdn.discordapp.com/attachments/564727164470165504/845578260708196382/Composite_Shot_1-00000000.png",
  "embeds": [
    {
      "title": "A New Tweet from CREY Games!",
      "description": "{{122828147__text}} \nLink to Tweet: {{122828147__url}}",
      "color": 1942002,
      "image": {
        "url": "{{122828147__entities__attached_media__media_url}}"
      }
    }
  ]
}

Upvotes: 0

Views: 1000

Answers (2)

Farhan
Farhan

Reputation: 1601

Use double quote \n e.g "\n"

Upvotes: 0

xavdid
xavdid

Reputation: 5262

It's hard to tell without seeing the exact text content of the tweets that do and don't work (the images are sort of helpful, but all sorts of invisible things can hide in text).

That said, I'd try using a code step or something to remove offending characters from the text of the tweet. So the new Zap would be:

  1. Twitter trigger
  2. Code step (remove line breaks or <br> tags or sometehing
  3. Post discord message with the output of step 2 (not the text of step 1)

Upvotes: 0

Related Questions