TMC
TMC

Reputation: 8154

How to insert newline in "caption" attribute through Facebook Graph API wall post?

I've seen apps post links with "captions" to user's walls and they have a newline in them. Foursquare is one of these apps.

I cannot figure out how to get a newline recognized and I've tried everything, including just passing in "\r\n", "\n", etc.

(note: I'm talking about publishing to a user's wall -- http://developers.facebook.com/docs/reference/api/post/)

Upvotes: 2

Views: 4338

Answers (4)

Suma Gowda
Suma Gowda

Reputation: 41

Try using only description instead of caption.

Upvotes: 0

TMC
TMC

Reputation: 8154

Turns out the way to do this easily is to provide both caption and description parameters with the HTTP POST. Caption will be the first line, and Description will act as the second.

Upvotes: 2

heksemann
heksemann

Reputation: 44

Use the following:

<center></center>

as part of your caption string. It will create a line-break for you when posting the link.

Upvotes: 1

Love Sharma
Love Sharma

Reputation: 1999

Try using properties arguments in graph api:

https://graph.facebook.com/me/feed?message=he&access_token=<ACCESS_TOKEN>&properties={1:{'text':'something',href='http://www.example.com'},2:{'text':'anything',href='http://www.example.com'}}

This will publish post in 2 lines... (Note: json should be converted to string before processing)

Upvotes: 0

Related Questions