# Posting to a Chatter Feed

The following code example shows a call to post an item to the context user’s Chatter feed.

```java
var sr = JSON.parse('<%=signedRequestJson%>');
// Reference the Chatter user's URL from Context.Links object.
var url = sr.context.links.chatterFeedsUrl+"/news/"+sr.context.user.userId+"/feed-items";
var body = {body : {messageSegments : [{type: "Text", text: "Some Chatter Post"}]}};

Sfdc.canvas.client.ajax(url,
    {client : sr.client,
        method: 'POST',
        contentType: "application/json",
        data: JSON.stringify(body),
        success : function(data) {
        if (201 === data.status) {
             alert("Success");
             }
        }
    });
```

**See Also**

- [Cross-Domain XHR](/docs/platform/canvas-framework/guide/canvas-app-xhr-intro.md)
- [Context](/docs/platform/canvas-framework/guide/context-object.md)
- [Links](/docs/platform/canvas-framework/guide/links-object.md)
