## createFhircastMessagePayload() function

Creates a serializable JSON payload for the `FHIRcast` protocol

**Signature:**

```typescript
export declare function createFhircastMessagePayload<EventName extends FhircastEventVersionOptional | FhircastEventVersionRequired>(topic: string, event: EventName, context: FhircastEventContext<EventName> | FhircastEventContext<EventName>[], versionId?: string): FhircastMessagePayload<EventName>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| topic | string | The topic that this message will be published on. Usually a UUID. |
| event | EventName | The event name, ie. "Patient-open" or "Patient-close". |
| context | [FhircastEventContext](/content/docs/sdk/core.fhircasteventcontext) <EventName> \| [FhircastEventContext](/content/docs/sdk/core.fhircasteventcontext) <EventName>\[\] | The updated context, containing new versions of resources related to this event. |
| versionId | string | _(Optional)_ The current `versionId` of the anchor context. For example, in `DiagnosticReport-update`, it's the `versionId` of the `DiagnosticReport`. |

**Returns:**

[FhircastMessagePayload](/content/docs/sdk/core.fhircastmessagepayload) <EventName>

A serializable `FhircastMessagePayload`.

- [createFhircastMessagePayload() function](/content/docs/sdk/core.createfhircastmessagepayload#createfhircastmessagepayload-function/index.html)
- [Parameters](/content/docs/sdk/core.createfhircastmessagepayload#parameters/index.html)
