

# SendEvent
<a name="API_SendEvent"></a>

Sends an event to a room. Use this within your application’s business logic to send events to clients of a room; e.g., to notify clients to change the way the chat UI is rendered.

## Request Syntax
<a name="API_SendEvent_RequestSyntax"></a>

```
POST /SendEvent HTTP/1.1
Content-type: application/json

{
   "attributes": { 
      "string" : "string" 
   },
   "eventName": "string",
   "roomIdentifier": "string"
}
```

## URI Request Parameters
<a name="API_SendEvent_RequestParameters"></a>

The request does not use any URI parameters.

## Request Body
<a name="API_SendEvent_RequestBody"></a>

The request accepts the following data in JSON format.

 ** [attributes](#API_SendEvent_RequestSyntax) **   <a name="ivs-SendEvent-request-attributes"></a>
Application-defined metadata to attach to the event sent to clients. The maximum length of the metadata is 4 KB total.  
Type: String to string map  
Required: No

 ** [eventName](#API_SendEvent_RequestSyntax) **   <a name="ivs-SendEvent-request-eventName"></a>
Application-defined name of the event to send to clients.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 100.  
Required: Yes

 ** [roomIdentifier](#API_SendEvent_RequestSyntax) **   <a name="ivs-SendEvent-request-roomIdentifier"></a>
Identifier of the room to which the event will be sent. Currently this must be an ARN.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `arn:aws:ivschat:[a-z0-9-]+:[0-9]+:room/[a-zA-Z0-9-]+`   
Required: Yes

## Response Syntax
<a name="API_SendEvent_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "id": "string"
}
```

## Response Elements
<a name="API_SendEvent_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [id](#API_SendEvent_ResponseSyntax) **   <a name="ivs-SendEvent-response-id"></a>
An identifier generated by Amazon IVS Chat. This identifier must be used in subsequent operations for this message, such as DeleteMessage.  
Type: String  
Length Constraints: Fixed length of 12.  
Pattern: `[a-zA-Z0-9]+` 

## Errors
<a name="API_SendEvent_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
  
HTTP Status Code: 403

 ** PendingVerification **   
  
HTTP Status Code: 403

 ** ResourceNotFoundException **   
  
HTTP Status Code: 404

 ** ThrottlingException **   
  
HTTP Status Code: 429

 ** ValidationException **   
  
HTTP Status Code: 400

## See Also
<a name="API_SendEvent_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/ivschat-2020-07-14/SendEvent) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/ivschat-2020-07-14/SendEvent) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/ivschat-2020-07-14/SendEvent) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/ivschat-2020-07-14/SendEvent) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/ivschat-2020-07-14/SendEvent) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/ivschat-2020-07-14/SendEvent) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/ivschat-2020-07-14/SendEvent) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/ivschat-2020-07-14/SendEvent) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/ivschat-2020-07-14/SendEvent) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/ivschat-2020-07-14/SendEvent) 