# Pinpoint

Source: /aws/services/pinpoint/

:::caution
Amazon Pinpoint will be [retired on 30 October 2026](https://docs.aws.amazon.com/pinpoint/latest/userguide/migrate.html) and will be removed from LocalStack soon after this date.
:::

## Introduction

Pinpoint is a customer engagement service to facilitate communication across multiple channels, including email, SMS, and push notifications.
Pinpoint allows developers to create and manage customer segments based on various attributes, such as user behavior and demographics, while integrating with other AWS services to send targeted messages to customers.

LocalStack allows you to mock the Pinpoint APIs in your local environment.
The supported APIs are available on our [API Coverage section](#api-coverage), which provides information on the extent of Pinpoint's integration with LocalStack.

## Getting started

This guide is designed for users new to Pinpoint and assumes basic knowledge of the AWS CLI and our [`lstk aws`](/aws/developer-tools/running-localstack/lstk/cloud-and-iac-commands/#aws) command.

Start your LocalStack container using your preferred method.
We will demonstrate how to create a Pinpoint application, retrieve all applications, and list tags for the resource.

### Create an application

Create a Pinpoint application using the [`CreateApp`](https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id.html) API.
Execute the following command:

```bash
lstk aws pinpoint create-app \
    --create-application-request Name=ExampleCorp,tags={"Stack"="Test"}
```

```bash title="Output"
{
    "ApplicationResponse": {
        "Arn": "arn:aws:mobiletargeting:us-east-1:000000000000:apps/4487a55ac6fb4a2699a1b90727c978e7",
        "Id": "4487a55ac6fb4a2699a1b90727c978e7",
        "Name": "ExampleCorp",
        "CreationDate": 1706609789.906863
    }
}
```

### List applications

You can list all applications using the [`GetApps`](https://docs.aws.amazon.com/pinpoint/latest/apireference/apps.html) API.
Execute the following command:

```bash
lstk aws pinpoint get-apps
```

```bash title="Output"
{
    "ApplicationsResponse": {
        "Item": [
            {
                "Arn": "arn:aws:mobiletargeting:us-east-1:000000000000:apps/4487a55ac6fb4a2699a1b90727c978e7",
                "Id": "4487a55ac6fb4a2699a1b90727c978e7",
                "Name": "ExampleCorp",
                "CreationDate": 1706609789.906863
            }
        ]
    }
}
```

### List tags for the application

You can list all tags for the application using the [`GetApp`](https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id.html) API.
Execute the following command:

```bash
lstk aws pinpoint list-tags-for-resource \
    --resource-arn arn:aws:mobiletargeting:us-east-1:000000000000:apps/4487a55ac6fb4a2699a1b90727c978e7
```

Replace the `resource-arn` with the ARN of the application you created earlier.
```bash title="Output"
{
    "TagsModel": {
        "tags": {
            "Stack": "Test"
        }
    }
}
```

### OTP verification

The operations [`SendOTPMessage`](https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-otp.html#SendOTPMessage) and [`VerifyOTPMessage`](https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-verify-otp.html#VerifyOTPMessage) are used for one-time password (OTP) verification.

On production AWS, `SendOTPMessage` sends an SMS text message with the OTP code.
The OTP can then be verified against the reference ID using `VerifyOTPMessage`

LocalStack however can not send real SMS text messages.
Instead it provides alternative ways to retrieve the actual OTP code as illustrated below.

Begin by making a OTP request:

```bash
lstk aws pinpoint send-otp-message \
  --application-id fff5a801e01643c18a13a763e22a8fbf \
  --send-otp-message-request-parameters '{
      "BrandName": "LocalStack Pro",
      "Channel": "SMS",
      "DestinationIdentity": "+1224364860",
      "ReferenceId": "liftoffcampaign",
      "OriginationIdentity": "+1123581321",
      "CodeLength": 6,
      "AllowedAttempts": 3,
      "ValidityPeriod": 2
    }'
```

```bash title="Output"
{
    "MessageResponse": {
        "ApplicationId": "fff5a801e01643c18a13a763e22a8fbf"
    }
}
```

You can use the debug endpoint `/_aws/pinpoint/<application_id>/<reference_id>` to retrieve the OTP message details:

```bash
curl http://localhost:4566/_aws/pinpoint/fff5a801e01643c18a13a763e22a8fbf/liftoffcampaign | jq .
```

```bash title="Output"
{
  "AllowedAttempts": 3,
  "BrandName": "LocalStack Pro",
  "CodeLength": 6,
  "DestinationIdentity": "+1224364860",
  "OriginationIdentity": "+1123581321",
  "ReferenceId": "liftoffcampaign",
  "ValidityPeriod": 2,
  "Attempts": 0,
  "ApplicationId": "fff5a801e01643c18a13a763e22a8fbf",
  "CreatedTimestamp": "2024-10-17T05:38:24.070Z",
  "Code": "655745"
}
```

The OTP code is also printed in an `INFO` level message in the LocalStack log output:

```bash title="Output"
2024-10-17T11:08:24.044 INFO : OTP for application ID fff5a801e01643c18a13a763e22a8fbf reference ID liftoffcampaign: 655745
```

Finally, the OTP code can be verified using:

```bash
lstk aws pinpoint verify-otp-message \
  --application-id fff5a801e01643c18a13a763e22a8fbf \
  --verify-otp-message-request-parameters '{
      "ReferenceId": "liftoffcampaign",
      "DestinationIdentity": "+1224364860",
      "Otp": "655745"
  }'
```

```bash title="Output"
{
    "VerificationResponse": {
        "Valid": true
    }
}
```

When validating OTP codes, LocalStack checks for the number of allowed attempts and the validity period.
Unlike AWS, there is no lower limit for validity period.

## API Coverage


### pinpoint API coverage

Source service: `pinpoint`. 20 of 122 tracked operations are implemented.

Service documentation: /aws/services/pinpoint/
License availability: available starting with the Ultimate plan. See /aws/licensing/ for current plan details.

| Operation | Status |
| --- | --- |
| CreateApp | Implemented |
| CreateCampaign | Not implemented |
| CreateEmailTemplate | Not implemented |
| CreateExportJob | Not implemented |
| CreateImportJob | Not implemented |
| CreateInAppTemplate | Not implemented |
| CreateJourney | Not implemented |
| CreatePushTemplate | Not implemented |
| CreateRecommenderConfiguration | Not implemented |
| CreateSegment | Not implemented |
| CreateSmsTemplate | Not implemented |
| CreateVoiceTemplate | Not implemented |
| DeleteAdmChannel | Not implemented |
| DeleteApnsChannel | Not implemented |
| DeleteApnsSandboxChannel | Not implemented |
| DeleteApnsVoipChannel | Not implemented |
| DeleteApnsVoipSandboxChannel | Not implemented |
| DeleteApp | Implemented |
| DeleteBaiduChannel | Not implemented |
| DeleteCampaign | Not implemented |
| DeleteEmailChannel | Not implemented |
| DeleteEmailTemplate | Not implemented |
| DeleteEndpoint | Implemented |
| DeleteEventStream | Implemented |
| DeleteGcmChannel | Not implemented |
| DeleteInAppTemplate | Not implemented |
| DeleteJourney | Not implemented |
| DeletePushTemplate | Not implemented |
| DeleteRecommenderConfiguration | Not implemented |
| DeleteSegment | Not implemented |
| DeleteSmsChannel | Implemented |
| DeleteSmsTemplate | Not implemented |
| DeleteUserEndpoints | Not implemented |
| DeleteVoiceChannel | Not implemented |
| DeleteVoiceTemplate | Not implemented |
| GetAdmChannel | Not implemented |
| GetApnsChannel | Not implemented |
| GetApnsSandboxChannel | Not implemented |
| GetApnsVoipChannel | Not implemented |
| GetApnsVoipSandboxChannel | Not implemented |
| GetApp | Implemented |
| GetApplicationDateRangeKpi | Not implemented |
| GetApplicationSettings | Implemented |
| GetApps | Implemented |
| GetBaiduChannel | Not implemented |
| GetCampaign | Not implemented |
| GetCampaignActivities | Not implemented |
| GetCampaignDateRangeKpi | Not implemented |
| GetCampaignVersion | Not implemented |
| GetCampaignVersions | Not implemented |
| GetCampaigns | Not implemented |
| GetChannels | Not implemented |
| GetEmailChannel | Not implemented |
| GetEmailTemplate | Not implemented |
| GetEndpoint | Implemented |
| GetEventStream | Implemented |
| GetExportJob | Not implemented |
| GetExportJobs | Not implemented |
| GetGcmChannel | Not implemented |
| GetImportJob | Not implemented |
| GetImportJobs | Not implemented |
| GetInAppMessages | Not implemented |
| GetInAppTemplate | Not implemented |
| GetJourney | Not implemented |
| GetJourneyDateRangeKpi | Not implemented |
| GetJourneyExecutionActivityMetrics | Not implemented |
| GetJourneyExecutionMetrics | Not implemented |
| GetJourneyRunExecutionActivityMetrics | Not implemented |
| GetJourneyRunExecutionMetrics | Not implemented |
| GetJourneyRuns | Not implemented |
| GetPushTemplate | Not implemented |
| GetRecommenderConfiguration | Not implemented |
| GetRecommenderConfigurations | Not implemented |
| GetSegment | Not implemented |
| GetSegmentExportJobs | Not implemented |
| GetSegmentImportJobs | Not implemented |
| GetSegmentVersion | Not implemented |
| GetSegmentVersions | Not implemented |
| GetSegments | Not implemented |
| GetSmsChannel | Implemented |
| GetSmsTemplate | Not implemented |
| GetUserEndpoints | Not implemented |
| GetVoiceChannel | Not implemented |
| GetVoiceTemplate | Not implemented |
| ListJourneys | Not implemented |
| ListTagsForResource | Implemented |
| ListTemplateVersions | Not implemented |
| ListTemplates | Not implemented |
| PhoneNumberValidate | Not implemented |
| PutEventStream | Implemented |
| PutEvents | Not implemented |
| RemoveAttributes | Not implemented |
| SendMessages | Not implemented |
| SendOTPMessage | Implemented |
| SendUsersMessages | Not implemented |
| TagResource | Implemented |
| UntagResource | Implemented |
| UpdateAdmChannel | Not implemented |
| UpdateApnsChannel | Not implemented |
| UpdateApnsSandboxChannel | Not implemented |
| UpdateApnsVoipChannel | Not implemented |
| UpdateApnsVoipSandboxChannel | Not implemented |
| UpdateApplicationSettings | Implemented |
| UpdateBaiduChannel | Not implemented |
| UpdateCampaign | Not implemented |
| UpdateEmailChannel | Not implemented |
| UpdateEmailTemplate | Not implemented |
| UpdateEndpoint | Implemented |
| UpdateEndpointsBatch | Not implemented |
| UpdateGcmChannel | Not implemented |
| UpdateInAppTemplate | Not implemented |
| UpdateJourney | Not implemented |
| UpdateJourneyState | Not implemented |
| UpdatePushTemplate | Not implemented |
| UpdateRecommenderConfiguration | Not implemented |
| UpdateSegment | Not implemented |
| UpdateSmsChannel | Implemented |
| UpdateSmsTemplate | Not implemented |
| UpdateTemplateActiveVersion | Not implemented |
| UpdateVoiceChannel | Not implemented |
| UpdateVoiceTemplate | Not implemented |
| VerifyOTPMessage | Implemented |
