Add a post

Note:

  • Each time the zoho.connect.addPost integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
  • Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.connect.addPost integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script. 

Overview

This task can be used to post to a group in Zoho Connect. The user gets to post a status, an event, and a task.

Syntax

<variable> = zoho.connect.addPost(<type>, <scopeID>, <partitionID>, <contentMap>, <connectionName>);

where,

ParameterData typeDescription
<variable>KEY-VALUE

is the variable which will hold returned repsonse.

The response will contain the message status and the Stream ID of the posted message

<type>TEXT

is the variable that denotes the type of the post.

Applicable values for this parameter are:

  • status
  • event
  • task
<scopeID>NUMBER

is the variable which represents the Scope ID of the network where the message will be posted.

You can also fetch the scope ID from the response of myNetworks task.

<partitionID>NUMBER

is the variable which represents the Partition ID of the network where the message will be posted.

You can also fetch the partition ID from the response of myGroups task.

<contentMap>KEY-VALUE

is the variable which will hold the contents of the post.

Applicable keys are specified in the table below.

<connectionName>

 

TEXT

is the name of the Zoho connect connection.

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter unless the authtoken is manually deleted from accounts.
  • Add relevant scopes as mentioned in Zoho Cliq API - Add a record
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

Applicable keys for contentMap param

To post a status
Key nameData typeMaximum lengthDescription
message*HTML Text25000Content to be posted as Status(Supports basic Html tags which are supported in editor)
titleTEXT300Title of the status
linkUrlTEXT500Url to be posted as link Info
To post an event
Key nameData typeMaximum lengthDescription
eventTitle*Text250Title of the event
eventDescText1000Description of the event
eventLocationText250Location of the event
invitedUsersText2000CSV of user email Ids - to invite user
invitedUserIdsJSONArray2000Json Array of zuid - to invite user
invitedGroupIdsJSONArray2000Json Array of partitionId - to invite group
startDate*Text100Start date of event in "yyyy-MM-dd HH:mm" format
endDate*Text100end date of event in "yyyy-MM-dd HH:mm" format
allDayBoolean-whether the event is All day or not
To post a task
Key nameData typeMaximum lengthDescription

taskTitle* 

**Task can create inside board only

Text250 Title of the task
taskDescText500Description of the task
sectionIdNumber250Id of the section inside a board
priorityNone|Low|Medium|High-Priority of the task
assignedUsersText2000CSV of user email Ids - to assign user(if empty task creator will be assigned by default)
assignedUserIdsJSONArray2000Json Array of zuid - to assign user(if empty task creator will be assigned by default)
dueDateText200due date of event in "yyyy-MM-dd" format
clearDueDateBoolean-to remove due date
isCompletedBoolean-to complete a task (will work in update task alone)
isReopenBoolean-to reopen a completed task (will work in update task alone)
frequencyNumber-Allowed values : 0,1,2,3 {0 - Daily ,1 - Weekly, 2 - Monthly, 3 - Yearly}
howOftenRepetitionNumber-Allowed values 1 to 30
dayOfWeekNumber-

Mandatory for WEEKLY repetition.

Allowed values : 1,2,3,4,5,6,7 {1 - Sunday to 7 - Saturday}

Multiple day for week repetition can be done by comma separated values

dayOfMonthNumber-

Mandatory for MONTHLY and YEARLY repetition

Allowed values 1 to 31. 

monthOfYearNumber-

Used in YEARLY repetition

Allowed values 0 to 11.  0 - January to 11 - December

repeatEndDateText200Repetition End Date in "yyyy-MM-dd" format
clearRepetitionBoolean-To stop repetition
reminderTimeText200Reminder Time in "yyyy-MM-dd HH:mm" format
remindAllBoolean-Whether to remind All and remind current user alone
clearReminderBoolean-To remove reminder
To map a third party entity with connect entity
Key nameData typeMaximum lengthDescription
tpEntityIdText250Third part ID (example - task id from Trello)
tpMetaDetailsJSONObject5000Third part details

 

Example

Consider the below example where the user can post a status to a group using the post type, Scope ID, Partition ID, the message to be posted (message title being optional)

contentMap = {"message":"This is a test message", "title":"This is a test title"}
postDetails = zoho.connect.addPost("status", 105000017039001, 105000207776548, contentMap);

where,

postDetails
is a variable which will hold the returned response
status
is a STRING value that represents the type of the post
105000017039001
is a BIGINT variable that represents the Scope ID of the network
105000207776548
is a BIGINT variable that represents the Partition ID of the group
contentMap
is a MAP variable that represents message content to be posted to the group

Additionally, users can post stuff from third party services. For example, a tweet in twitter can be posted in Connect using a third party message id and metadata of the post content.

This is to facilitate integration and to allow the user to assign a custom ID (different from those of ZOHO Connect posts) for easy identification and retrieval. The syntax remains the same as zoho.connect.addPost(), the only change being in the contentMap with additional (optional) parameters

This third party message can be retrieved using both the Stream ID and the Third Party Entity Id (custom) of the message

Consider below the example where a tweet about the inventory details of a stationery store is being posted in ZOHO Connect

metaDetails = {"Charts":"4", "Books":"10};
contentMap = {"message":"Stock Details of Stationery Store", "title":"Stationery Store", "tpEntityId":"TPEntity001", "tpMetaDetails":metaDetails };
postDetails = zoho.connect.addPost("status", 105000017039001, 105000207776548, contentMap);

where,

metaDetails
is a JSONObject variable that represents the third party message content to be posted
tpEntityId
is a STRING variable that represents the third party ID of the message to be posted
TPEntity001
is a STRING value that represents an alphanumeric, user-defined third party ID of the message to be posted
tpMetaDetails
is a JSON Object variable that represents the third party message content

Sample Response

  • Following is a sample success response:
{"id":"105000209424697",
"status":"success" }
  • To fetch the stream ID, use the following snippet:
info <response_variable>.get("id");
  • The response returned is null when the Scope ID supplied is incorrect
  • The response returned when an incorrect Partition ID is supplied is provided below
{"reason":"Something went wrong. Please try after sometime.",
"status":"failure"}
  • The following error message is encountered when the message content is not supplied in the contentMap required to post a message.
{"reason":"Post content should not be empty.",
"status":"failure"}

Related Links