How do you send a campaign to a custom channel in pinpoint? - aws-pinpoint

I've created a separate "custom channel" in AWS Pinpoint using the example documentation (beta), but the campaigns I send don't match any endpoints.
I've updated the project to use my Lambda function:
aws pinpoint update-application-settings \
--application-id my-pinpoint-id \
--write-application-settings-request '{\"CampaignHook\": { \"LambdaFunctionName\": \"arn:aws:lambda:us-east-1:my-application-id:function:MyLambdaFunction\", \"Mode\": \"DELIVERY\" }}'
... and I've created a segment with various endpoint ChannelTypes, e.g. SMS,
EMAIL, APNS, GCM, CUSTOM. But when I send anything to that channel via the Console no notifications get sent---it says "Endpoints targeted 0". I thought that all endpoints would go through my Lambda function....
Any idea how to send something to a segment via a custom channel?

Related

The Azure Alerts using webhook to Slack is not working

I'm using Azure Alerts to use webhooks. I added the webhook in the action group. The URL I used is the one from Slack.
I also added a Notification Type Email. The notification email gets triggered but I am not receiving any message in the Slack channel.
I was able to push messages to the webhooks using postman hence I know my webhook is correct. But Azure Alert is not able to trigger the webhook. I am not receiving any messages in the Slack channel.
Azure Monitor sends a notification with its own schema definition. Slack doesn't recognize it, so you cannot see any notifications in the channel. It is possible to create a Logic App or Azure Function to transform the default schema.
Here the more information about it:
https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-common-schema
Slack expect a json object when using webhooks. When sending directly from azure alert you will get bad request.
Every slack channel has an e-mail adress. You can post messages to the channel using that email in azure alerts
Anyone looking for using Slack and Azure Alerts. This seems to work fine:
...
webhook_receiver {
name = "Slack"
service_uri = "https://hooks.slack.com/services/secret"
use_common_alert_schema = false
}
Then in the scheduled query rules alert:
...
action {
action_group = [data.azurerm_monitor_action_group.actiongroup.id]
email_subject = "Disk storage at less than 10%"
custom_webhook_payload = "{ \"text\" : \"Warning: Storage has less than 10% diskspace remaining!\"}"
}

Is there a way to get the status of an Event Grid trigger for azure function (Complete /Pending or Running)

by Httptrigger Azure function, if you send a POST request you receive something like this as a response:
{
"id": "66ee5d08196874aeb99c9e62ddc7b190",
"statusQueryGetUri": "https://asynchttpfunction.azurewebsites.net/runtime/webhooks/durabletask/instances/66ee5d08196945aeb44c9e62ddc7b190?taskHub=Orchestration&connection=Storage&code=FSVfJyGODSeKHPO0cM8Po9e1jMT7MghVMGuJqTaGTN56E1RUHnlVJg==",
"sendEventPostUri": "https://asynchttpfunction.azurewebsites.net/runtime/webhooks/durabletask/instances/66ee5d08196945aeb44c9e62ddc7b190/raiseEvent/{eventName}?taskHub=Orchestration&connection=Storage&code=FSVfJyGODSeKHPO0cM8Po9e1jMT7MghVMGuJqTaGTN56E1RUHnlVJg==",
"terminatePostUri": "https://asynchttpfunction.azurewebsites.net/runtime/webhooks/durabletask/instances/66ee5d08196945aeb44c9e62ddc7b190/terminate?reason={text}&taskHub=Orchestration&connection=Storage&code=FSVfJyGODSeKHPO0cM8Po9e1jMT7MghVMGuJqTaGTN56E1RUHnlVJg==",
"rewindPostUri": "https://asynchttpfunction.azurewebsites.net/runtime/webhooks/durabletask/instances/66ee5d08196945aeb44c9e62ddc7b190/rewind?reason={text}&taskHub=Orchestration&connection=Storage&code=FSVfJyGODSeKHPO0cM8Po9e1jMT7MghVMGuJqTaGTN56E1RUHnlVJg==",
"purgeHistoryDeleteUri": "https://asynchttpfunction.azurewebsites.net/runtime/webhooks/durabletask/instances/66ee5d08196945aeb44c9e62ddc7b190?taskHub=Orchestration&connection=Storage&code=FSVfJyGODSeKHPO0cM8Po9e1jMT7MghVMGuJqTaGTN56E1RUHnlVJg=="
}
The statusQueryGetUri provides information of the long running orchestration instance. If you follow this link you will receive a suitable runtimeStatus that describes the status of the orchestration instance along with some other useful information.here
My question is now:
actually we don't send a POST request to an Event grid Azure function trigger, Is there any way to get the status of the Azure function? Complete or is still running?
The Azure Event Grid is an eventing Pub/Sub model where the interest of source is distributed to the subscribed event handler endpoint or resource in the reliable manner with a retry policy and dead-lettering option. The AEG is waiting for delivery response processing max. 60 seconds.
There is no built-in the features what you are asking in the AEG, however you can use the REST API for metrics of the specific subscription to obtain its counters value:
MatchedEventCount,
DeliveryAttemptFailCount,
DeliverySuccessCount,
DroppedEventCount,
DeadLetteredCount
The following GET is an example for getting a subscription metrics:
https://management.azure.com/subscriptions/mysubId/resourceGroups/mygroup/providers/Microsoft.EventGrid/topics/mytester/providers/Microsoft.EventGrid/eventSubscriptions/mysubscription/providers/Microsoft.Insights/metrics?api-version=2018-01-01&interval=PT5M&metricnames=MatchedEventCount,DeliveryAttemptFailCount,DeliverySuccessCount,DroppedEventCount,DeadLetteredCount
Note, that the authorization header with a bearer token is required for this call.
More details about the monitoring an event message delivery can be found here.

Azure Servicebus REST API : How to retrieve MessageId

I want to use REST API to send message to a servicebus topic.
Everything's working fine, the message is sent on the topic.
My client received an ACK fron servicebus by receiving an HTTP code 201, a void body, and some headers.
But I didn't received the messageId. I need it to retrieve treatment status in my internal product.
However, as at described into the documentation (https://learn.microsoft.com/en-us/rest/api/servicebus/message-headers-and-properties), the MessageId should be returned.
Is it normal? And how can I retrieve the MessageId?
The only other option is to set the MessageId by the client way, but I don't like this solution because it is not the responsability of the client to do that.

Sending Push Notifications using OneSignal to Multiple Users

I have a NodeJS backend application I'm trying to configure to be able to send Push notifications to an IOS frontend application. I want to be able to send notifications to specific users (intend to use PlayerIds to send notifications). I am not sure how to obtain the users playerIds that I want to send.
var message = {
app_id: "5eb5a37e-b458-11e3-ac11-000c2940e62c",
contents: {"en": "English Message"},
include_player_ids: ["6392d91a-b206-4b7b-a620-cd68e32c3a76","76ece62b-bcfe-468c-8a78-839aeaa8c5fa","8e0f21fa-9a5a-4ae7-a9a6-ca1f24294b86"]
};
sendNotification(message);
My question is how can I pull these player_ids dynamically and match them against users in my DB? Thanks!
Onesignal documentation https://documentation.onesignal.com/reference#create-notification
You can set your user id from your DB by calling setExternalUserId, example:
OneSignal.setExternalUserId("123");
You can then use "filters" with include_external_user_ids on the OneSignal create notification REST API POST call on your server with the tag field to target your users.

Send Extra payloads params in SNS notification register and get back same params when notification receives

I am implementing AWS SNS with AWS SES.
I am registering notification that calls my http endpoint handler and i am receiving perfect notification object. But along with notification identity i want to send my extra payloads that can be received when registered endpoints called. I am doing it in nodeJS
here is the snippet of registering notification
var params = {
Identity: 'myemail#mydomain.com', /* required */
NotificationType: 'Bounce', //["Delivery","Bounce","Complaint"], /* required */
SnsTopic: 'arn:aws-arnstring'
};
ses.setIdentityNotificationTopic(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
is there anyway to send extra params like Identity and NotificationType ?
thanks in advance
There does not appear to b a mechanism for adding metadata, however... the notification should contain source inside the mail object, which looks like it would be the sending email address.
Arguably, there's no need for additional metadata, because there's also the messageId provided with the notifications. This is the same identifier you got back when you submitted the message.
If you saved the metadata locally (or even in simpledb, dynamodb, rds, or even S3) under that ID when the message was submitted, you'd be able to look it up again. If you don't save something with each message you send, then you don't have a way to "close the loop" and track the fact that you've received a notification of bounce, complaint, or delivery of each message to each recipient from SES.
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/notification-contents.html
It isn't currently possible to send extra parameters along with the notification. You should submit this feature request to the Amazon SES team, either via the Amazon SES forums or through AWS Developer Support.

Resources