Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Esempi di utilizzo di Amazon Pinpoint AWS CLI
I seguenti esempi di codice mostrano come eseguire azioni e implementare scenari comuni utilizzando Amazon Pinpoint. AWS Command Line Interface
Le azioni sono estratti di codice da programmi più grandi e devono essere eseguite nel contesto. Sebbene le azioni mostrino come richiamare le singole funzioni del servizio, è possibile visualizzarle contestualizzate negli scenari correlati.
Ogni esempio include un link al codice sorgente completo, in cui vengono fornite le istruzioni su come configurare ed eseguire il codice nel contesto.
Argomenti
Azioni
Il seguente esempio di codice mostra come usarecreate-app.
- AWS CLI
-
Esempio 1: creazione di un’applicazione
L’esempio
create-appseguente crea una nuova applicazione (progetto).aws pinpoint create-app \ --create-application-requestName=ExampleCorpOutput:
{ "ApplicationResponse": { "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example", "Id": "810c7aab86d42fb2b56c8c966example", "Name": "ExampleCorp", "tags": {} } }Esempio 2: creazione di un’applicazione con tag
L’esempio
create-appseguente crea una nuova applicazione (progetto) e associa un tag (chiave e valore) all’applicazione.aws pinpoint create-app \ --create-application-request Name=ExampleCorp,tags={"Stack"="Test"}Output:
{ "ApplicationResponse": { "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example", "Id": "810c7aab86d42fb2b56c8c966example", "Name": "ExampleCorp", "tags": { "Stack": "Test" } } }-
Per i dettagli sull'API, consulta CreateApp AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-sms-template.
- AWS CLI
-
Crea un modello di messaggio per i messaggi inviati attraverso il canale SMS
L’esempio
create-sms-templateseguente crea un modello di messaggio SMS.aws pinpoint create-sms-template \ --template-nameTestTemplate\ --sms-template-requestfile://myfile.json\ --regionus-east-1Contenuto di
myfile.json:{ "Body": "hello\n how are you?\n food is good", "TemplateDescription": "Test SMS Template" }Output:
{ "CreateTemplateMessageBody": { "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:templates/TestTemplate/SMS", "Message": "Created", "RequestID": "8c36b17f-a0b0-400f-ac21-29e9b62a975d" } }Per ulteriori informazioni, consulta Modelli di messaggio di Amazon Pinpoint nella Guida per l’utente di Amazon Pinpoint.
-
Per i dettagli sull'API, consulta CreateSmsTemplate AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-app.
- AWS CLI
-
Come eliminare un’applicazione
L’esempio
delete-appseguente elimina un’applicazione (progetto).aws pinpoint delete-app \ --application-id810c7aab86d42fb2b56c8c966exampleOutput:
{ "ApplicationResponse": { "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example", "Id": "810c7aab86d42fb2b56c8c966example", "Name": "ExampleCorp", "tags": {} } }-
Per i dettagli sull'API, consulta DeleteApp AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-apns-channel.
- AWS CLI
-
Per recuperare informazioni sullo stato e sulle impostazioni del APNs canale per un'applicazione
L'
get-apns-channelesempio seguente recupera informazioni sullo stato e le impostazioni del APNs canale per un'applicazione.aws pinpoint get-apns-channel \ --application-id9ab1068eb0a6461c86cce7f27ce0efd7\ --regionus-east-1Output:
{ "APNSChannelResponse": { "ApplicationId": "9ab1068eb0a6461c86cce7f27ce0efd7", "CreationDate": "2019-05-09T21:54:45.082Z", "DefaultAuthenticationMethod": "CERTIFICATE", "Enabled": true, "HasCredential": true, "HasTokenKey": false, "Id": "apns", "IsArchived": false, "LastModifiedDate": "2019-05-09T22:04:01.067Z", "Platform": "APNS", "Version": 2 } }-
Per i dettagli sull'API, vedere GetApnsChannel
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-app.
- AWS CLI
-
Come recuperare informazioni su un’applicazione (progetto)
L’esempio
get-appseguente recupera informazioni su un’applicazione (progetto).aws pinpoint get-app \ --application-id810c7aab86d42fb2b56c8c966example\ --regionus-east-1Output:
{ "ApplicationResponse": { "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example", "Id": "810c7aab86d42fb2b56c8c966example", "Name": "ExampleCorp", "tags": { "Year": "2019", "Stack": "Production" } } }-
Per i dettagli sull'API, consulta GetApp AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-apps.
- AWS CLI
-
Come recuperare informazioni su tutte le applicazioni
L’esempio
get-appsseguente recupera informazioni su tutte le tue applicazioni (progetti).aws pinpoint get-appsOutput:
{ "ApplicationsResponse": { "Item": [ { "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example", "Id": "810c7aab86d42fb2b56c8c966example", "Name": "ExampleCorp", "tags": { "Year": "2019", "Stack": "Production" } }, { "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/42d8c7eb0990a57ba1d5476a3example", "Id": "42d8c7eb0990a57ba1d5476a3example", "Name": "AnyCompany", "tags": {} }, { "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/80f5c382b638ffe5ad12376bbexample", "Id": "80f5c382b638ffe5ad12376bbexample", "Name": "ExampleCorp_Test", "tags": { "Year": "2019", "Stack": "Test" } } ], "NextToken": "eyJDcmVhdGlvbkRhdGUiOiIyMDE5LTA3LTE2VDE0OjM4OjUzLjkwM1oiLCJBY2NvdW50SWQiOiI1MTIzOTcxODM4NzciLCJBcHBJZCI6Ijk1ZTM2MGRiMzBkMjQ1ZjRiYTYwYjhlMzllMzZlNjZhIn0" } }La presenza del valore di risposta
NextTokenindica che è disponibile una maggiore quantità di output. Chiama il comando e fornisci quel valore come parametro di input diNextToken.-
Per i dettagli sull'API, consulta GetApps AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-campaign.
- AWS CLI
-
Come recuperare informazioni sullo stato, la configurazione e altre impostazioni di una campagna
L’esempio
get-campaignseguente recupera informazioni sullo stato, sulla configurazione e su altre impostazioni per una campagna.aws pinpoint get-campaign \ --application-id6e0b7591a90841d2b5d93fa11143e5a7\ --campaign-ida1e63c6cc0eb43ed826ffcc3cc90b30d\ --regionus-east-1Output:
{ "CampaignResponse": { "AdditionalTreatments": [], "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/6e0b7591a90841d2b5d93fa11143e5a7/campaigns/a1e63c6cc0eb43ed826ffcc3cc90b30d", "CreationDate": "2019-10-08T18:40:16.581Z", "Description": " ", "HoldoutPercent": 0, "Id": "a1e63c6cc0eb43ed826ffcc3cc90b30d", "IsPaused": false, "LastModifiedDate": "2019-10-08T18:40:16.581Z", "Limits": { "Daily": 0, "MaximumDuration": 60, "MessagesPerSecond": 50, "Total": 0 }, "MessageConfiguration": { "EmailMessage": { "FromAddress": "sender@example.com", "HtmlBody": "<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n</head>\n<body>Hello</body>\n</html>", "Title": "PinpointDemo" } }, "Name": "MyCampaign", "Schedule": { "IsLocalTime": false, "StartTime": "IMMEDIATE", "Timezone": "utc" }, "SegmentId": "b66c9e42f71444b2aa2e0ffc1df28f60", "SegmentVersion": 1, "State": { "CampaignStatus": "COMPLETED" }, "tags": {}, "TemplateConfiguration": {}, "Version": 1 } }-
Per i dettagli sull'API, consulta GetCampaign AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-campaigns.
- AWS CLI
-
Come recuperare informazioni sullo stato, la configurazione e altre impostazioni per tutte le campagne associate a un’applicazione
L’esempio
get-campaignsseguente recupera informazioni sullo stato, la configurazione e altre impostazioni per tutte le campagne associate a un’applicazione.aws pinpoint get-campaigns \ --application-id6e0b7591a90841d2b5d93fa11143e5a7\ --regionus-east-1Output:
{ "CampaignsResponse": { "Item": [ { "AdditionalTreatments": [], "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/6e0b7591a90841d2b5d93fa11143e5a7/campaigns/7e1280344c8f4a9aa40a00b006fe44f1", "CreationDate": "2019-10-08T18:40:22.905Z", "Description": " ", "HoldoutPercent": 0, "Id": "7e1280344c8f4a9aa40a00b006fe44f1", "IsPaused": false, "LastModifiedDate": "2019-10-08T18:40:22.905Z", "Limits": {}, "MessageConfiguration": { "EmailMessage": { "FromAddress": "sender@example.com", "HtmlBody": "<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n</head>\n<body>Hello</body>\n</html>", "Title": "PInpointDemo Test" } }, "Name": "MyCampaign1", "Schedule": { "IsLocalTime": false, "QuietTime": {}, "StartTime": "IMMEDIATE", "Timezone": "UTC" }, "SegmentId": "b66c9e42f71444b2aa2e0ffc1df28f60", "SegmentVersion": 1, "State": { "CampaignStatus": "COMPLETED" }, "tags": {}, "TemplateConfiguration": {}, "Version": 1 }, { "AdditionalTreatments": [], "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/6e0b7591a90841d2b5d93fa11143e5a7/campaigns/a1e63c6cc0eb43ed826ffcc3cc90b30d", "CreationDate": "2019-10-08T18:40:16.581Z", "Description": " ", "HoldoutPercent": 0, "Id": "a1e63c6cc0eb43ed826ffcc3cc90b30d", "IsPaused": false, "LastModifiedDate": "2019-10-08T18:40:16.581Z", "Limits": { "Daily": 0, "MaximumDuration": 60, "MessagesPerSecond": 50, "Total": 0 }, "MessageConfiguration": { "EmailMessage": { "FromAddress": "sender@example.com", "HtmlBody": "<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n</head>\n<body>Demo</body>\n</html>", "Title": "PinpointDemo" } }, "Name": "MyCampaign2", "Schedule": { "IsLocalTime": false, "StartTime": "IMMEDIATE", "Timezone": "utc" }, "SegmentId": "b66c9e42f71444b2aa2e0ffc1df28f60", "SegmentVersion": 1, "State": { "CampaignStatus": "COMPLETED" }, "tags": {}, "TemplateConfiguration": {}, "Version": 1 } ] } }-
Per i dettagli sull'API, consulta GetCampaigns AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-channels.
- AWS CLI
-
Come recuperare le informazioni sulla cronologia e lo stato di ciascun canale per un’applicazione
L’esempio
get-channelsseguente recupera le informazioni sulla cronologia e lo stato di ciascun canale per un’applicazione.aws pinpoint get-channels \ --application-id6e0b7591a90841d2b5d93fa11143e5a7\ --regionus-east-1Output:
{ "ChannelsResponse": { "Channels": { "GCM": { "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "CreationDate": "2019-10-08T18:28:23.182Z", "Enabled": true, "HasCredential": true, "Id": "gcm", "IsArchived": false, "LastModifiedDate": "2019-10-08T18:28:23.182Z", "Version": 1 }, "SMS": { "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "CreationDate": "2019-10-08T18:39:18.511Z", "Enabled": true, "Id": "sms", "IsArchived": false, "LastModifiedDate": "2019-10-08T18:39:18.511Z", "Version": 1 }, "EMAIL": { "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "CreationDate": "2019-10-08T18:27:23.990Z", "Enabled": true, "Id": "email", "IsArchived": false, "LastModifiedDate": "2019-10-08T18:27:23.990Z", "Version": 1 }, "IN_APP": { "Enabled": true, "IsArchived": false, "Version": 0 } } } }-
Per i dettagli sull'API, consulta GetChannels AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-email-channel.
- AWS CLI
-
Come recuperare le informazioni sullo stato e sulle impostazioni del canale di e-mail per un’applicazione
L’esempio
get-email-channelseguente recupera lo stato e le impostazioni del canale di e-mail per un’applicazione.aws pinpoint get-email-channel \ --application-id6e0b7591a90841d2b5d93fa11143e5a7\ --regionus-east-1Output:
{ "EmailChannelResponse": { "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "CreationDate": "2019-10-08T18:27:23.990Z", "Enabled": true, "FromAddress": "sender@example.com", "Id": "email", "Identity": "arn:aws:ses:us-east-1:AIDACKCEVSQ6C2EXAMPLE:identity/sender@example.com", "IsArchived": false, "LastModifiedDate": "2019-10-08T18:27:23.990Z", "MessagesPerSecond": 1, "Platform": "EMAIL", "RoleArn": "arn:aws:iam::AIDACKCEVSQ6C2EXAMPLE:role/pinpoint-events", "Version": 1 } }-
Per i dettagli sull'API, consulta GetEmailChannel AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-endpoint.
- AWS CLI
-
Recupero di informazioni sulle impostazioni e gli attributi di un endpoint specifico per un’applicazione
L’esempio
get-endpointseguente recupera le informazioni sulle impostazioni e gli attributi di un endpoint specifico per un’applicazione.aws pinpoint get-endpoint \ --application-id611e3e3cdd47474c9c1399a505665b91\ --endpoint-idtestendpoint\ --regionus-east-1Output:
{ "EndpointResponse": { "Address": "+11234567890", "ApplicationId": "611e3e3cdd47474c9c1399a505665b91", "Attributes": {}, "ChannelType": "SMS", "CohortId": "63", "CreationDate": "2019-01-28T23:55:11.534Z", "EffectiveDate": "2021-08-06T00:04:51.763Z", "EndpointStatus": "ACTIVE", "Id": "testendpoint", "Location": { "Country": "USA" }, "Metrics": { "SmsDelivered": 1.0 }, "OptOut": "ALL", "RequestId": "a204b1f2-7e26-48a7-9c80-b49a2143489d", "User": { "UserAttributes": { "Age": [ "24" ] }, "UserId": "testuser" } } }-
Per i dettagli sull'API, consulta GetEndpoint AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-gcm-channel.
- AWS CLI
-
Come recuperare le informazioni sullo stato e sulle impostazioni del canale GCM per un’applicazione
L’esempio
get-gcm-channelseguente recupera le informazioni sullo stato e le impostazioni sul canale GCM per un’applicazione.aws pinpoint get-gcm-channel \ --application-id6e0b7591a90841d2b5d93fa11143e5a7\ --regionus-east-1Output:
{ "GCMChannelResponse": { "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "CreationDate": "2019-10-08T18:28:23.182Z", "Enabled": true, "HasCredential": true, "Id": "gcm", "IsArchived": false, "LastModifiedDate": "2019-10-08T18:28:23.182Z", "Platform": "GCM", "Version": 1 } }-
Per i dettagli sull'API, consulta GetGcmChannel AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-sms-channel.
- AWS CLI
-
Recupero delle informazioni sullo stato e sulle impostazioni del canale SMS per un’applicazione
L’esempio
get-sms-channelseguente recupera lo stato e le impostazioni del canale di sms per un’applicazione.aws pinpoint get-sms-channel \ --application-id6e0b7591a90841d2b5d93fa11143e5a7\ --regionus-east-1Output:
{ "SMSChannelResponse": { "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "CreationDate": "2019-10-08T18:39:18.511Z", "Enabled": true, "Id": "sms", "IsArchived": false, "LastModifiedDate": "2019-10-08T18:39:18.511Z", "Platform": "SMS", "PromotionalMessagesPerSecond": 20, "TransactionalMessagesPerSecond": 20, "Version": 1 } }-
Per i dettagli sull'API, consulta GetSmsChannel AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-sms-template.
- AWS CLI
-
Recupera il contenuto e le impostazioni di un modello di messaggio per i messaggi inviati attraverso il canale SMS
L’esempio
get-sms-templateseguente recupera il contenuto e le impostazioni di un modello di messaggio SMS.aws pinpoint get-sms-template \ --template-nameTestTemplate\ --regionus-east-1Output:
{ "SMSTemplateResponse": { "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:templates/TestTemplate/SMS", "Body": "hello\n how are you?\n food is good", "CreationDate": "2023-06-20T21:37:30.124Z", "LastModifiedDate": "2023-06-20T21:37:30.124Z", "tags": {}, "TemplateDescription": "Test SMS Template", "TemplateName": "TestTemplate", "TemplateType": "SMS", "Version": "1" } }Per ulteriori informazioni, consulta Modelli di messaggio di Amazon Pinpoint nella Guida per l’utente di Amazon Pinpoint.
-
Per i dettagli sull'API, consulta GetSmsTemplate AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-voice-channel.
- AWS CLI
-
Come recuperare le informazioni sullo stato e sulle impostazioni del canale vocale per un’applicazione
L’esempio
get-voice-channelseguente recupera lo stato e le impostazioni del canale vocale per un’applicazione.aws pinpoint get-voice-channel \ --application-id6e0b7591a90841d2b5d93fa11143e5a7\ --regionus-east-1Output:
{ "VoiceChannelResponse": { "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7", "CreationDate": "2022-04-28T00:17:03.836Z", "Enabled": true, "Id": "voice", "IsArchived": false, "LastModifiedDate": "2022-04-28T00:17:03.836Z", "Platform": "VOICE", "Version": 1 } }-
Per i dettagli sull'API, consulta GetVoiceChannel AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-tags-for-resource.
- AWS CLI
-
Come recuperare un elenco di tag per una risorsa
L’esempio
list-tags-for-resourceseguente recupera tutti i tag (nomi e valori delle chiavi) associati alla risorsa specificata.aws pinpoint list-tags-for-resource \ --resource-arnarn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966exampleOutput:
{ "TagsModel": { "tags": { "Year": "2019", "Stack": "Production" } } }Per ulteriori informazioni, consulta 'Tagging Amazon Pinpoint Resources https://docs.aws.amazon.com/pinpoint/ latest/developerguide/tagging < -resources.html>'__ nella Amazon Pinpoint Developer Guide.
-
Per i ListTagsForResource
dettagli sull'AWS CLI API, consulta Command Reference.
-
Il seguente esempio di codice mostra come utilizzarephone-number-validate.
- AWS CLI
-
Recupera informazioni su un numero di telefono
L’esempio
phone-number-validateseguente recupera le informazioni relative a un numero di telefono.aws pinpoint phone-number-validate \ --number-validate-request PhoneNumber="+12065550142" \ --regionus-east-1Output:
{ "NumberValidateResponse": { "Carrier": "ExampleCorp Mobile", "City": "Seattle", "CleansedPhoneNumberE164": "+12065550142", "CleansedPhoneNumberNational": "2065550142", "Country": "United States", "CountryCodeIso2": "US", "CountryCodeNumeric": "1", "OriginalPhoneNumber": "+12065550142", "PhoneType": "MOBILE", "PhoneTypeCode": 0, "Timezone": "America/Los_Angeles", "ZipCode": "98101" } }Per ulteriori informazioni, consulta Canale SMS di Amazon Pinpoint nella Guida per l’utente di Amazon Pinpoint.
-
Per i dettagli sull'API, consulta PhoneNumberValidate AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaresend-messages.
- AWS CLI
-
Invio di un messaggio SMS utilizzando l’endpoint di un’applicazione
L’esempio
send-messagesseguente invia un messaggio diretto per un’applicazione con un endpoint.aws pinpoint send-messages \ --application-id611e3e3cdd47474c9c1399a505665b91\ --message-requestfile://myfile.json\ --regionus-west-2Contenuto di
myfile.json:{ "MessageConfiguration": { "SMSMessage": { "Body": "hello, how are you?" } }, "Endpoints": { "testendpoint": {} } }Output:
{ "MessageResponse": { "ApplicationId": "611e3e3cdd47474c9c1399a505665b91", "EndpointResult": { "testendpoint": { "Address": "+12345678900", "DeliveryStatus": "SUCCESSFUL", "MessageId": "itnuqhai5alf1n6ahv3udc05n7hhddr6gb3lq6g0", "StatusCode": 200, "StatusMessage": "MessageId: itnuqhai5alf1n6ahv3udc05n7hhddr6gb3lq6g0" } }, "RequestId": "c7e23264-04b2-4a46-b800-d24923f74753" } }Per ulteriori informazioni, consulta Canale SMS di Amazon Pinpoint nella Guida per l’utente di Amazon Pinpoint.
-
Per i dettagli sull'API, consulta SendMessages AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaresend-users-messages.
- AWS CLI
-
Come inviare un messaggio SMS a un utente di un’applicazione
L’esempio
send-users-messagesseguente invia un messaggio diretto per un utente di un’applicazione.aws pinpoint send-users-messages \ --application-id611e3e3cdd47474c9c1399a505665b91\ --send-users-message-requestfile://myfile.json\ --regionus-west-2Contenuto di
myfile.json:{ "MessageConfiguration": { "SMSMessage": { "Body": "hello, how are you?" } }, "Users": { "testuser": {} } }Output:
{ "SendUsersMessageResponse": { "ApplicationId": "611e3e3cdd47474c9c1399a505665b91", "RequestId": "e0b12cf5-2359-11e9-bb0b-d5fb91876b25", "Result": { "testuser": { "testuserendpoint": { "DeliveryStatus": "SUCCESSFUL", "MessageId": "7qu4hk5bqhda3i7i2n4pjf98qcuh8b7p45ifsmo0", "StatusCode": 200, "StatusMessage": "MessageId: 7qu4hk5bqhda3i7i2n4pjf98qcuh8b7p45ifsmo0", "Address": "+12345678900" } } } } }Per ulteriori informazioni, consulta Canale SMS di Amazon Pinpoint nella Guida per l’utente di Amazon Pinpoint.
-
Per i dettagli sull'API, consulta SendUsersMessages AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaretag-resource.
- AWS CLI
-
Come aggiungere tag a una risorsa
L’esempio seguente aggiunge due tag (nomi e valori di chiave) a una risorsa.
aws pinpoint list-tags-for-resource \ --resource-arnarn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example\ --tags-modeltags={Stack=Production,Year=2019}Questo comando non produce alcun output.
Per ulteriori informazioni, consulta 'Tagging Amazon Pinpoint Resources https://docs.aws.amazon.com/pinpoint/ latest/developerguide/tagging < -resources.html>'__ nella Amazon Pinpoint Developer Guide.
-
Per i TagResource
dettagli sull'AWS CLI API, consulta Command Reference.
-
Il seguente esempio di codice mostra come utilizzareuntag-resource.
- AWS CLI
-
Esempio 1: come rimuovere un tag da una risorsa
L’esempio
untag-resourceseguente rimuove il tag (nome e valore di chiave) dalla risorsa specificata.aws pinpoint untag-resource \ --resource-arnarn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example\ --tag-keysYearQuesto comando non produce alcun output.
Esempio 2: come rimuovere più tag da una risorsa
L’esempio
untag-resourceseguente rimuove i tag specificati (nomi e valori di chiave) da una risorsa.aws pinpoint untag-resource \ --resource-arnarn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example\ --tag-keysYearStackQuesto comando non produce alcun output.
Per ulteriori informazioni, consulta 'Tagging Amazon Pinpoint Resources https://docs.aws.amazon.com/pinpoint/ latest/developerguide/tagging < -resources.html>'__ nella Amazon Pinpoint Developer Guide.
-
Per i UntagResource
dettagli sull'AWS CLI API, consulta Command Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-sms-channel.
- AWS CLI
-
Come abilitare il canale SMS o aggiornare lo stato e le impostazioni del canale SMS per un’applicazione.
L’esempio
update-sms-channelseguente abilita il canale SMS per un canale SMS per un’applicazione.aws pinpoint update-sms-channel \ --application-id611e3e3cdd47474c9c1399a505665b91\ --sms-channel-requestEnabled=true\ --regionus-west-2Output:
{ "SMSChannelResponse": { "ApplicationId": "611e3e3cdd47474c9c1399a505665b91", "CreationDate": "2019-01-28T23:25:25.224Z", "Enabled": true, "Id": "sms", "IsArchived": false, "LastModifiedDate": "2023-05-18T23:22:50.977Z", "Platform": "SMS", "PromotionalMessagesPerSecond": 20, "TransactionalMessagesPerSecond": 20, "Version": 3 } }Per ulteriori informazioni, consulta Canale SMS di Amazon Pinpoint nella Guida per l’utente di Amazon Pinpoint.
-
Per i dettagli sull'API, consulta UpdateSmsChannel AWS CLI
Command Reference.
-