...
Table of Contents | ||||
---|---|---|---|---|
|
...
Overview
The following operations allow operation allows you to work with messages. Click an the operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with messages, see Sample configuration.
Operation details
This section provides details on the operation.
Anchor | ||||
---|---|---|---|---|
|
...
a message
The getMessag
operation retrieves a message based on the specified message ID.
Info | ||
---|---|---|
| ||
Before performing this operation, ensure that you call the |
Code Block | ||||
---|---|---|---|---|
| ||||
<facebook.getMessage> <messageId>{$ctx:messageId}</messageId> <fields>{$ctx:fields}</fields> </facebook.getMessage> |
Properties
Unique ID for this messagemessageId
:The unique ID of the message you want to retrieve.
fields
: The fields to include in the response when you retrieve a message. For more information on the fields property, see https://developers.facebook.com/docs/graph-api/reference/message#readfields
Sample request Anchor request request
Following is a sample REST request for the getMessage that can be handled by the getMessage
operation.
Code Block | ||||
---|---|---|---|---|
| ||||
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAGlDzIRGv0KAopxqBhmSKgQTbfvnROAZAwZBPSnH7OpqVeEP9t4eZCpO2xbIdIZAI4g6MayNwIgk3R7t4xqX2atZAKfxqJS8UnacJJjthuAsnr8eI7pyOuLojRtdzH2zNFdwt7K1QeJgH6isCYpAFg2ZBY6r3MqDssgTQ7fES5zCrPpopr3S29wAKiz089MgZDZD",
"messageId":"192451917539863",
} |
...
Related Facebook documentation:
...
Following is a sample proxy service that illustrates how to connect to Facebook with the init operation and the init
operation, and then use the getMessage operation getMessage
operation. The sample request for this proxy can be found in getMessage
sample request. You can use this sample as a template for using other operations in this category.
Info |
---|
As a best practice, create create a separate sequence for handling the to handle response payload for errors. In the following sample, this sequence is "faultHandlerSeq"the sequence that handles errors is the |
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="facebook_getMessage"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence onError="faultHandlerSeq">
<property name="apiUrl" expression="json-eval($.apiUrl)"/>
<property name="apiVersion" expression="json-eval($.apiVersion)"/>
<property name="accessToken" expression="json-eval($.accessToken)"/>
<property name="fields" expression="json-eval($.fields)"/>
<property name="messageId" expression="json-eval($.messageId)"/>
<facebook.init>
<apiUrl>{$ctx:apiUrl}</apiUrl>
<apiVersion>{$ctx:apiVersion}</apiVersion>
<accessToken>{$ctx:accessToken}</accessToken>
</facebook.init>
<facebook.getMessage>
<messageId>{$ctx:messageId}</messageId>
<fields>{$ctx:fields}</fields>
</facebook.getMessage>
<respond/>
</inSequence>
<outSequence>
<property name="messageType" value="application/json" scope="axis2" />
<send/>
</outSequence>
</target>
</proxy> |