I regularly spin up and spin down elastic beanstalk environments which have my team's email set as the notification address. Is there a way I can automatically confirm subscription to all of the SNS topics that are created instead of having to manually click a link in an email every time (and miss a few)?
It seems you are programmatically creating environments. You may consider automatically confirming subscriptions using the SNS ConfirmSubscription API
http://docs.aws.amazon.com/sns/latest/APIReference/API_ConfirmSubscription.html
Also another option is to create your own topic and subscribe your email to it. Then reuse the topic for all your environments using the "Notification Topic ARN" option setting instead of providing an email address when launching a new beanstalk environment. That way you subscribe the topic once and then forget about it.
There is no good way that I know of to do this. The easiest way I can think of would be instead of subscribing an email to the topic, subscribe an SQS queue, and then have a separate process reading from that SQS queue and sending emails to your team email address. It's not pretty, but it will work, and you won't lose any messages.
There is no need to create a new SNS topic for each environment.
For example, when configuring notifications using configuration options, using this option:
Notification Topic ARN β [...] You can also set this option to use an
existing SNS topic for notifications. A topic that you attach to your
environment by using this option is not deleted when you change this
option or terminate the environment.
Then for each new environment the mailing-list is only receiving this type of e-mail for which there is no need to confirm subscription:
This is a publish notification test for environment
'your-new-environment-name', to verify permissions to attach an SNS topic
to the environment.
-- If you wish to stop receiving notifications from this topic, please click or visit the link below to unsubscribe:
https://sns.eu-west-1.amazonaws.com/unsubscribe.html?some_key..
Related
Ejabberd newbie here. I hope this question makes sense.
We had a need to setup our own XMPP server so that customers on web and a Bria client can utilize it. I was able to get the basics up and running using ejabberd.
All users will be in the 'xmpp.exampledomain.com'
We also have a custom SMS gateway we built (which is really a server which can accept json APIs).
So what I am trying to accomplish:
Our platform would create a 'normal' xmpp user so the user can login to ejabberd.
This user can add roster contacts of other 'normal' xmpp users.
If this user wants to send messages via SMS, we would instruct them to add roster contacts (i assume) with the format 12125551234#sms.exampledomain.com. (adding the contact works currently)
If a user sends a message to this "SMS" contact, have ejabberd call our custom SMS gateway via a json API instead of attempting to deliver via normal xmpp.
Is this even possible?
For inbound from the SMS Gateway server, can call the ejabberd API send message function, so inbound is fairly easy.
I appreciate any suggestions
thanks
What you want was called a "transport" in the old days of IRC, ICQ, AIM and MSN. They were programs that you installed next to ejabberd (or other Jabber servers). Example usage:
you download a transport for ICQ
configure it to have access to ICQ,
and then configure ejabberd to connect to that transport, and allow users to contact it at address icq.example.com.
There are very old tutorials for your curiosity:
https://www.ejabberd.im/tutorials-transports/index.html
I don't know if the old "SMS-Jabber transports" will work nowadays. Searching revelaed few results:
https://www.jethrocarr.com/2013/06/03/smstoxmpp/
https://sourceforge.net/projects/jabbersms/
https://www.jabber.cz/wiki/SMS_transport
Alternatively, as you mentioned you already have a SMS program, if you can get your hands on Erlang or Elixir, you can write an ejabberd module that registers at sms.example.com, and forwards XMPP messages as json API...
I want to create a hook which is called whenever an offline message is created. Example: user-a(online) send a message to user-b(offline). Then as per ejabberd the message is stored and sent when user-b comes online. But in this situation, I want to call a local server POST URL with the data. How to create such a hook?
This hook is created so that I can from the local server send a push notification. Thus whenever a user comes online he/she will get the offline message as the push notification.
There is no step by step implementation for this. If anyone knows this it will be of great help.
There are two hooks called when a message is sent to a local account that is offline: ejabberd_sm calls offline_message_hook. And mod_offline calls store_offline_message. Search for that in the ejabberd source code, and you will find example code to use them.
Building on Badlop's answer, I have created a module that does exactly what you need to achieve from an offline_hook. Only with a difference that you'll have to connect a component to ejabberd instead of getting messages on REST API.
I'm trying to integrate sonarcloud (not sonarqube) with a Slack channel. I want to have the same behaviour in Slack that the one we have in Github or Travis integration: I mean a push notification on a channel.
In Slack exists the option of a webhook but it's limited because only accepts an input format:
{
"text": "message"
}
On the other side, on sonarcloud, there is the possibility to send a POST message to a webhook, but doesn't exist the chance to choose the format of the message, because it's predefined. Has someone any idea about how to connect these two services?
I have thought to use a AWS lambda in order to adapt the message as a bridge but i'm looking for simpler ideas which do not require more infrastructure.
I've used email notifications from sonar cloud and added Zapier "Gmail-Slack" integration for emails with a specific filter. A bit hacky but it works well.
A little late, but for people who might be looking for the answer on this one. I didn't integrate SonarCloud with Slack (yet), but I've had success integrating both CircleCI and SonarCloud with GeckoBoard using zapier which is an online service. It can accept a webhook and then allows you to connect it to a different service (ie, Geckoboard or Slack) by selecting and modifying values in that webhook before sending it on in the correct format. Quite easy to do as well; no programming and no servers to maintain. Hope this helps.
I want to push notification messages from azure notification hub to the FCM using topics.
Example: I want to send a message to the FCM from notification hub. but this message will be directed to topics. When using postman for example, I just have to send this json:
{
"to" : "/topics/scalability",
"notification":{"body":"topics message sent"}
}
to https://fcm.googleapis.com/fcm/send (while providing the FCM key ofcourse).
By doing this, I am able to receive the notification on a chrome app I put in place (the app is just the same as you can find here
Now my problem is that when I send this same message on Notification hub (Azure), I don't receive it on my web app. My understanding is that the Notification Hub does not push the message (json) in its simple format, but why is that ?
Since I successfully pushed the message to FCM, isn't the FCM supposed to interpret the
"to" : "/topics/scalability
part ?
I found a workaround. I send notifications using the simple version of the Notification hub method:
// Send the message to FCM NotificationOutcome outCome = await this.hubClient.SendGcmNativeNotificationAsync(payload).
I then receive all the messages from my chrome app
Azure Notification Hub supports registering tags with individual device. And you can use tag expressions to target specific sets of devices, or more specifically registrations, when sending a push notification through Notification Hubs. For targeting, you should use tag expression instead FCM βtoβ property. Please see below article for more details on routing/expressions.
https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-tags-segment-push-message
I know this is an old question but I also was confused by this when starting my first Topics-based notification hub app, so hope this saves someone, somewhere some time. What SHOULD, in my opinion, be explicitly stated somewhere in the azure NH documentation, is that using the hub with PNS such as Firebase will OVERRIDE any PNS specific Topics functionality. My understanding is that if you decide to go the Hub route, you ditch Firebase Topics etc and work exclusively with Hub Tags.
If you think about it, it actually makes a lot of sense as it means the Hub is dealing with Topic filtering rather than firing off all messages and making the PNS systems do their individual things.
So in short, if you go the NH route, you cant use PNS topics, I found the two don't play nicely together.
I'm working on a project that consumes Service Now API (Rest). To do so our client has registered us as a user in order to login and make all service calls we need to. This project has an interface where users can login once they have an account on Service Now as well, the username they type to log in has nothing to do with service now by the way, but later they associate theirs service now users to it. They can do some operations through this interface, where all of them are done using the integration user/pass not their service now users theirselves, even because they do not need to share their passwords with us. But it's needed to track the correct user to register on service now and I'm in trouble specifically about commenting on an incident. The endpoint to comment is the following :
http://hostname/api/now/table/incident/{sys_id}
where request body is a json object just as simple as :
{
"comments": "My comment is foo bar"
}
but when this comment is registered on Service Now it is under integration user instead the user which commented. Is there any way I could keep a specific user, considering I already have the user id on Service Now ready to inform it on the request the way it should be.
I tried reading Service Now documentation but had no clue how to solve it, altought I've found something about impersonate
This is happening because you're being proxied through the "Integration User" instead of your own account. As long as this is the case, your comments are going to be attributed to the Integration User.
I can think of two ways to fix this issue.
Ask the client to log you into their system directly as a user.
Implement a special API (Scripted REST API, available in Geneva or later) that allows you to identify the Incident and enter the comment, and then the script forges the comment on your behalf, attributing authorship correctly.
The first solution can be expensive due to possible additional licensing costs.
The second solution will require a willing client to devote 2-3 hours of development time, depending on the programmer.
Firstly, you need an integration user with suffient rights. Our integration user has suffient rights out of the box, but your story could be different. A quick check is to try impersonate as other user using menu.
Login as integration user to ServiceNow instance.
Go to https://{instance}.service-now.com/nav_to.do
Click on username at top right corner. This is a drop down.
There should be at least three menu items: "Profile", "Impersonate User", and "Logout". If you do not have "Impersonate User" in this menu, your integration user miss some permissions. Contact system administrator if you miss this menu item to configure appropriate permissions.
Then you need to find sys_id of user that you want to impersonate. For example:
https://{instance}.service-now.com/api/now/table/sys_user?sysparm_query=user_name={username}&sysparm_fields=sys_id
If you have suffient privileges, you could invoke the folling endpoint with sys id of user that you want to impersonate:
HTTP POST to https://{instance}.service-now.com/api/now/ui/impersonate/{user_sys_id} with body "{}" and content type "application/json". You need to provide HTTP basic authentication to this query as your integration user.
The response code on success is 200. The response body could be ignored. The interesting result of this response is a set of cookies for impersonated user in response headers. These cookies could be used for subsequent REST API calls until they expire. Use some HTTP rest client dependent method to capture them and to provide them to next calls.
For Apache HTTP Client (Java), I'm creating http client context using:
HttpClientContext context = HttpClientContext.create();
context.setCookieStore(new BasicCookieStore());
Pass thing context to impersonation request and to subsequent API calls until I get 401 reply, after that I'm reaquiring cookies. Setting new cookie store is important, as otherwise some default cookies store is used.
Two things to note:
This API looks like internal one, so it could change at any time. If it happens, look for what "Impresonate User" menu item does, and repeat it youselves.
ServiceNow permissions are quite fine-grained, so the target user could lack permissions to perform operation. In some cases, if there is no permission to update the field the operation PATCH on object returns reponse 200, but field is not updated. This introduces a surprising mode of failure when you use impersonation.