I have 10000 users, and i want to push notification SNS to each user, with different message.
So, i cannot use Topic in this case.
The problem is it delay too much. (About 1h30 hour for this to complete)
Any solution?
Thank you so much!
Endpoint is something like internal AWS Identificator for combination: platform+device token or smth else. When we want to send an message we use it as address point instead of real.
About adding Endpoint to SNS. Generally it looks like so:
You should register your platform in AWS SNS and receive e.g. for IOS - iOS app's Application ARN. It can be done via e.g. AWS Web Console
After you should create for each target user its endpoint with method like this:
$endPoint = $snsClient->createPlatformEndpoint([
'PlatformApplicationArn' => $SNS_APP_ARN,
'Token' => 'phone token'
]);
phone token for push notification is device-token. Endpoint generally is array/object which contains EndpointArn. Use it address when send message.
After that you can send an message to specific endpoint.
$snsClient->publish(
array(
'Message' => $pushMessage,
'TargetArn' => $endpointArn
));
Related
How to read particular user latest messages i have userId but i want to read all messages send by that user.
I want if there is any bot functions which can be used for this.
I also want to know can i read reactions on a particular message of that user
It's pretty easy to filter the messages by sender id. You should:
Disable the privacy mode.
A bot running in privacy mode will not receive all messages that
people send to the group.
When you have an incoming update, check for the update.message.from.id to know if he's the target user.
use copyMessage or forwardMessage to send his message to yourself.
Here's a simple example using PHP/TeleBot:
$tg = new TeleBot('your-token');
if ($tg->user->id == 'target-user-id') {
$tg->forwardMessage([
'chat_id' => 'your-user-id',
'from_chat_id' => $tg->chat->id,
'message_id' => $tg->message->message_id,
]);
}
You can also check out this repository to more know and get inspired:
https://github.com/mkleymenov/telespy-bot
I use Symfony 5, ApiPlatform and Twilio
My goal is to send a message to a client, then get his answer through a webhook and store it.
So I've open my route through ngrok
ngrok http -host-header=rewrite localhost:{{port}}
And setup my twilio message settings like this :
And implemented a function to send a sms :
$client = new Client($sid, $authtoken);
$client->messages->create(
'myNumber',
array(
'from' => '+twilioNumber',
'body' => $message,
'statusCallback' => "https://a7c6f2ea3843.ngrok.io/twilio/response",
'statusCallbackMethod' => 'POST',
)
);
when I send a message, I receive a callback on this my webhook /twilio/response with the status sent and delivered.
But I never receive the callback w the content of the sms I sent to twilio in reponse of the one I received
Do I miss some configuration? Or am i missing something? Thanks for your help
For anyone who would run into this kind of problem, it was an error of configuration.
On twilio console of your number you can find a link Modify the Messaging Service configuration just above the webhooks
I needed to click on it and configure it to receive the incoming messages and enter the webhook I needed to recover data when one was received.
The webhook I had configured as shown above only send data to confirm that an sms had been send and received from twilio to your client.
I have a weird problem, I send notifications via FCM to topics in iOS devices.
Sometimes when the device is connected to slow internet or no internet, and then connects back to the internet, all notification sent prior are not received, and new sent notifications after will be delayed!
For example: A device would be connected back to internet all is fine but I receive the notification delayed 10min and when I receive it the very first moment it's shown, it will say in the dialog: 10min ago!
If I restart the iPhone after that, everything will be fixed again! and I can receive notifications normally.
This issue happened to me in two different devices so I am sure its not from the phone. and other apps notifications would be working without problem as well.
I am thinking maybe its something wrong with my fcm notification configurations that I send from the server, can anyone point if I am missing something here.
Message configuration:
$message = CloudMessage::fromArray([
"condition" => $the_conditions,
"notification" => [
"title" => $title,
"body" => $body,
],
"data" => $data_passed,
//Apple:
"apns" => [
"headers" => [
"apns-priority" => "10",
],
"payload" => [
"aps" => [
"alert" => [
"title" => $title,
"body" => $body,
],
"sound" => $sound,
"thread-id" => "thread_$item_id"
],
],
],
]);
I require high availability notifications that need to be sent immediately.
Note: I am using a php library to send the notification from server: kreait/firebase-php
I'm the maintainer of the SDK you're using 👋
Firstly, the message you composed is perfectly fine, there's nothing wrong with it.
In the context of the SDK I regularly receive issue reports about FCM messages being delivered with big delays or not at all, and unfortunately, there's no way to check if and when a message has been delivered from an Admin SDK. If you send a message to Firebase and Firebase doesn't respond with an error (e.g. when the payload is invalid, when a device token is not registered or when the server is unavailable), we have to assume that the delivery was successful.
To ensure highly reliable messages I currently see two ways how you could achieve that:
Use another messaging service that promises highly reliable delivery like e.g https://pushy.me/ (this is not a recommendation, I'm not affiliated to Pushy and have never used it)
When sending a message from your backend server, include a transaction ID in the data payload, and store it in a database. From the receiving client, issue a request back to your backend server to confirm the message reception. This way you could see if and when a message has been confirmed and can re-send it after a defined amount of time. This has some drawbacks of course - perhaps the client received the message, but the confirmation call failed, or messages could still be sent twice. It's just a naive idea from the top of my head 😅
LinkedIN has recently released support for webhooks and we are successful in creating a webhook url. We are able to authorise a user administrator of a company to our app and get permissions to write and read from the REST API.
However we are not receiving any webhook updates from the app for that company. And there is no documentation on how to subscribe to a particular company like in other social-media API:s witch we have vast experience from (fb,IG,Twitter).
The documentation on LinkedIn is very limited on the subject. And we are not sure what we can expect from the webhook requests from linkedIn. What is the reason we are not getting Webhooks for that company?
We dont even get webhook calls for the organisation owning the app.
Any help appreciated.
https://learn.microsoft.com/en-us/linkedin/shared/api-guide/webhook-validation?context=linkedin/context
I figure it out I need to add header json to output for validation.
Here is my code in php
if (isset($_REQUEST['challengeCode'])) {
header('Content-Type: application/json');
echo json_encode([
'challengeCode' => $_REQUEST['challengeCode'],
'challengeResponse' => hash_hmac('sha256', $_REQUEST['challengeCode'], 'client secret'),
]);
exit;
}
and for webhook subscription
$api->setApiHeaders([
'X-Restli-Protocol-Version' => '2.0.0',
]);
$developerUrn = urlencode("urn:li:developerApplication:developerid");
$personUrn = urlencode("urn:li:person:personid");
$orgUrn = urlencode(""urn:li:organization:pageid");
$endpoint = "(developerApplication:$developerUrn,user:$personUrn,entity:$orgUrn,eventType:ORGANIZATION_SOCIAL_ACTION_NOTIFICATIONS)";
$api->api("eventSubscriptions/$endpoint", ['webhook' => "WEBHOOK_URL"], 'PUT');
Webhooks are a closed beta feature at this time:
Who can use this: Any developer using a webhooks API (currently available only for social action notifications on company posts to beta partners)
Source: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/recent-changes
Firebase Messaging version 5.6.0. I am attempting to handle a data only message in the foreground via Firebase Messaging on iOS 9.0 (10 if needed), but it is not calling FIRMessagingDelegate's messaging:didReceiveMessage per the documentation. I see the message come in # FIRMessaging.m's appDidReceiveMessage:message, but never comes through to the delegate.
This is the snippet from the cloud function that sends data to the topic per sending to a topic:
const message = {
data: {
test: '123'
}
topic: 'example'
}
admin.messaging().send(message);
Did I miss something?
Update: I do receive the data if I implement application:didReceiveRemoteNotification:userInfo
fetchCompletionHandler:completionHandler.
Thanks to Kat at Firebase support, here is the answer.
Use legacy sendToTopic instead of send, as send quietly adds content_available=1 which gets treated as APNs silent notification. Here is the updated version:
admin.messaging().sendToTopic('example', {
data: {
test: '123'
}
});
// Always use strings for key/values in the data object.
Below verbatim from Kat at Firebase support:
How the FCM data message is handled would depend on your setting for content_available.
If you have content_available = 1, the message is sent via APNs and is treated similar as an APNs silent notification. This is handled in the application:didReceiveRemoteNotification: callback when the app is running in foreground or background (i.e. not killed). See this related StackOverflow post for more information.
Without content_available, the message is sent via FCM direct channel. This only handled in the messaging:didReceiveMessage: when app is in foreground.
Note that messages sent via the Admin SDK's send() method uses the FCM HTTP v1 API which have content_available=1 by default, so they are always sent via APNs. If you want to configure the content_available field, you'll need to use the Admin SDK's sendToDevice() method which uses the legacy protocols.
In addition, here is the list of legacy protocols.