This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Current »



Overview

The following operations allow you to work with messages. Click an 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
getMessageReturns a message.

Operation details

This section provides details on the operation.

Retrieving messages

This operation returns a message. It requires the fields parameter to be used in init.

getMessage
<facebook.getMessage>
	<messageId>{$ctx:messageId}</messageId>
    <fields>{$ctx:fields}</fields>
</facebook.getMessage> 
Properties
  • messageId: Unique ID for this message.

  • fields: The fields which belongs to an object.

Sample request

Following is a sample REST request for the getMessage operation. 

Sample Request for getMessage
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"CAACEdEose0cBAGlDzIRGv0KAopxqBhmSKgQTbfvnROAZAwZBPSnH7OpqVeEP9t4eZCpO2xbIdIZAI4g6MayNwIgk3R7t4xqX2atZAKfxqJS8UnacJJjthuAsnr8eI7pyOuLojRtdzH2zNFdwt7K1QeJgH6isCYpAFg2ZBY6r3MqDssgTQ7fES5zCrPpopr3S29wAKiz089MgZDZD",
"messageId":"192451917539863",
} 

For further illustration on the fields parameter, refer to https://developers.facebook.com/docs/graph-api/reference/message#readfields

Related Facebook documentation

https://developers.facebook.com/docs/graph-api/reference/message#read

Sample configuration

Following is a sample proxy service that illustrates how to connect to Facebook with the init operation and use the 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.

As a best practice, create a separate sequence for handling the response payload for errors. In the following sample, this sequence is "faultHandlerSeq".

Sample 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> 
  • No labels