arazzo: 1.0.1
info:
title: Sendbird Moderate the Author of the Latest Channel Message
summary: Read a channel's latest message, identify its author, and mute that user.
description: >-
A reactive moderation flow that pulls the most recent message in a channel,
extracts the author's user ID, and mutes that user in the same channel. It
branches on whether the channel has any messages so an empty channel ends
cleanly. Useful for automated abuse response triggered off the latest post.
Every step spells out its request inline so the flow can be read and
executed without opening the underlying OpenAPI description.
version: 1.0.0
sourceDescriptions:
- name: messagesApi
url: ../openapi/sendbird-messages-api-openapi.yml
type: openapi
- name: moderationApi
url: ../openapi/sendbird-moderation-api-openapi.yml
type: openapi
workflows:
- workflowId: moderate-channel-message-author
summary: Mute the author of the most recent message in a channel.
description: >-
Lists the latest message, branches on whether one exists, and mutes the
message author in the channel.
inputs:
type: object
required:
- apiToken
- channelUrl
properties:
apiToken:
type: string
description: Sendbird Api-Token from the dashboard.
channelUrl:
type: string
description: URL of the channel to inspect and moderate.
seconds:
type: integer
description: Mute duration in seconds. -1 for indefinite.
default: 600
description:
type: string
description: Reason recorded for the mute.
default: Automated moderation of latest message author.
steps:
- stepId: latestMessage
description: Fetch the single most recent message in the channel.
operationId: $sourceDescriptions.messagesApi.listMessages
parameters:
- name: Api-Token
in: header
value: $inputs.apiToken
- name: channel_url
in: path
value: $inputs.channelUrl
- name: prev_limit
in: query
value: 1
successCriteria:
- condition: $statusCode == 200
outputs:
authorId: $response.body#/messages/0/user/user_id
onSuccess:
- name: hasMessage
type: goto
stepId: muteAuthor
criteria:
- context: $response.body
condition: $.messages[0]
type: jsonpath
- name: empty
type: end
- stepId: muteAuthor
description: Mute the author of the latest message in the channel.
operationId: $sourceDescriptions.moderationApi.muteUser
parameters:
- name: Api-Token
in: header
value: $inputs.apiToken
- name: user_id
in: path
value: $steps.latestMessage.outputs.authorId
requestBody:
contentType: application/json
payload:
channel_url: $inputs.channelUrl
seconds: $inputs.seconds
description: $inputs.description
successCriteria:
- condition: $statusCode == 200
outputs:
moderatedUserId: $steps.latestMessage.outputs.authorId
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.