Add a connection to a group, send a message to the group, then remove the connection.
Adds a connection to a group via addConnectionToGroup, broadcasts to the group via sendToGroup, then removes the connection via removeConnectionFromGroup.
arazzo: 1.0.1
info:
title: Azure Web PubSub Join Group, Send, then Leave
summary: Add a connection to a group, broadcast a message to that group, then remove the connection.
description: >-
A scoped fan-out pattern: a connection is added to a named group, a message
is broadcast to everyone in that group, and finally the connection is removed
from the group so it no longer receives future group traffic. Every step
inlines its request — Authorization bearer header, required api-version query,
request body, and documented status codes — so the flow is self-describing.
version: 1.0.0
sourceDescriptions:
- name: hubApi
url: ../openapi/microsoft-azure-web-pubsub-webpubsub-api-openapi.yml
type: openapi
workflows:
- workflowId: join-group-send-leave
summary: Add a connection to a group, send a message to the group, then remove the connection.
description: >-
Adds a connection to a group via addConnectionToGroup, broadcasts to the
group via sendToGroup, then removes the connection via
removeConnectionFromGroup.
inputs:
type: object
required:
- accessToken
- hub
- group
- connectionId
- message
properties:
accessToken:
type: string
description: JWT bearer token for the Web PubSub data plane.
apiVersion:
type: string
description: Data plane REST API version.
default: "2024-01-01"
hub:
type: string
description: Target hub name.
group:
type: string
description: Group name to add the connection to and broadcast to.
connectionId:
type: string
description: The connection id to add to the group.
message:
type: string
description: The plain-text message to broadcast to the group.
steps:
- stepId: addConnection
description: >-
Add the connection to the named group so it begins receiving group
messages.
operationId: AddConnectionToGroup
parameters:
- name: Authorization
in: header
value: "Bearer $inputs.accessToken"
- name: hub
in: path
value: $inputs.hub
- name: group
in: path
value: $inputs.group
- name: connectionId
in: path
value: $inputs.connectionId
- name: api-version
in: query
value: $inputs.apiVersion
successCriteria:
- condition: $statusCode == 200
outputs:
addStatus: $statusCode
- stepId: sendToGroup
description: >-
Broadcast the supplied plain-text message to every connection in the group.
operationId: SendToGroup
parameters:
- name: Authorization
in: header
value: "Bearer $inputs.accessToken"
- name: hub
in: path
value: $inputs.hub
- name: group
in: path
value: $inputs.group
- name: api-version
in: query
value: $inputs.apiVersion
requestBody:
contentType: text/plain
payload: $inputs.message
successCriteria:
- condition: $statusCode == 202
outputs:
sendStatus: $statusCode
- stepId: removeConnection
description: >-
Remove the connection from the group so it stops receiving future group
messages.
operationId: RemoveConnectionFromGroup
parameters:
- name: Authorization
in: header
value: "Bearer $inputs.accessToken"
- name: hub
in: path
value: $inputs.hub
- name: group
in: path
value: $inputs.group
- name: connectionId
in: path
value: $inputs.connectionId
- name: api-version
in: query
value: $inputs.apiVersion
successCriteria:
- condition: $statusCode == 204
outputs:
removeStatus: $statusCode
outputs:
addStatus: $steps.addConnection.outputs.addStatus
sendStatus: $steps.sendToGroup.outputs.sendStatus
removeStatus: $steps.removeConnection.outputs.removeStatus
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.