# WebSocketAwsIntegrationProps

Props for AWS type integration for a WebSocket Api.

Extends: WebSocketAwsIntegrationProps
Used as props by: WebSocketAwsIntegration

- Source: [`aws-apigatewayv2-integrations/lib/websocket/aws.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/websocket/aws.ts#L17)
- Type last changed: v2.134.0 · 26 Mar 2024

## Example

```ts
import { WebSocketAwsIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as iam from 'aws-cdk-lib/aws-iam';

const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi');
new apigwv2.WebSocketStage(this, 'mystage', {
  webSocketApi,
  stageName: 'dev',
  autoDeploy: true,
});

declare const apiRole: iam.Role;
declare const table: dynamodb.Table;
webSocketApi.addRoute('$connect', {
  integration: new WebSocketAwsIntegration('DynamodbPutItem', {
    integrationUri: `arn:aws:apigateway:${this.region}:dynamodb:action/PutItem`,
    integrationMethod: apigwv2.HttpMethod.POST,
    credentialsRole: apiRole,
    requestTemplates: {
      'application/json': JSON.stringify({
        TableName: table.tableName,
        Item: {
          id: {
            S: '$context.requestId',
          },
        },
      }),
    },
  }),
});
```

## Properties

- `contentHandling`: [ContentHandling](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.ContentHandling.html) — Specifies how to handle response payload content type conversions.

  **Default:** The response payload will be passed through from the integration response to the route response or method response without modification.

- `credentialsRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — Specifies the credentials role required for the integration.

  **Default:** No credential role provided.

- `integrationMethod`: string (required) — Specifies the integration's HTTP method type.

- `integrationUri`: string (required) — Integration URI.

- `passthroughBehavior`: [PassthroughBehavior](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.PassthroughBehavior.html) — Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource.

  **Default:** No passthrough behavior required.

  There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and
  NEVER.

- `requestParameters`: { [key: string]: string } — The request parameters that API Gateway sends with the backend request.

  **Default:** No request parameter provided to the integration.

  Specify request parameters as key-value pairs (string-to-string
  mappings), with a destination as the key and a source as the value.

- `requestTemplates`: { [key: string]: string } — A map of Apache Velocity templates that are applied on the request payload.

  **Default:** No request template provided to the integration.

  ```
    { "application/json": "{ \"statusCode\": 200 }" }
  ```

- `templateSelectionExpression`: string — The template selection expression for the integration.

  **Default:** No template selection expression provided.

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.seconds(29) — The maximum amount of time an integration will run before it returns without a response.

  Must be between 50 milliseconds and 29 seconds.
