Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
maxLevel3
typeflat

...

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.

OperationDescription
getMessage
Returns
Retrieves a message.

Operation details

This section provides details on the operation.

Anchor
getMessage
getMessage
Retrieving

...

a message

The getMessag operation retrieves a message based on the specified message ID.

Info
titleNote

Before performing this operation, ensure that you call the init operation with the fields properties.

Code Block
languagehtml/xml
titlegetMessage
<facebook.getMessage>
	<messageId>{$ctx:messageId}</messageId>
    <fields>{$ctx:fields}</fields>
</facebook.getMessage> 
Properties

Anchor
request
request
Sample request

Following is a sample REST request for the getMessage that can be handled by the getMessage operation. 

Code Block
languagehtml/xml
titleSample Request for getMessage
{
"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 faultHandlerSeq.

Code Block
languagehtml/xml
titleSample Proxy
<?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>