Hubot Slack: How to send message includes channel link? - coffeescript

I wrote following hubot script to send remind.
OUT_CHANNEL = "remind"
module.exports = (robot) ->
robot.hear /test/, (res) ->
res.send "set reminder. I tell you at ##{OUT_CHANNEL} after this."
...
This script sends below messages.
"set reminder. I tell you at #remind after this."
But This case, the part of #remind is not link.
how to embed channel link in hubot message like human send?
Environment is below:
hubot 2.19.0
hubot-slack 3.4.2
slack-client 1.4.0
Slack.app 2.5.2

If you want Slack to show a link to a channel the correct syntax is:
<#C12345678[|text]>
Where #C12345678 is the ID of the public channel, and text can be any text (and is optional). So <#C12345678> will work too.
I am not familiar with the coffeesecript syntax, so please add any script related character encoded (e.g. ## for #) as necessary.
Please note that this will only work for public channel, but not for private Slack channel.
You can read more about how to correctly link items in Slack messages in the excellent Slack API documentationn.

Related

Mail stay in queue when i use Sendgrid in symfony6

I have set my Sendgrid single sender and validate it ( status = verified).
I use SMTP, create my key that i paste in my code (.env file of my app):
MAILER_DSN=sendgrid+smtp://#default
Then i try to test integration in Sendgrid by clicking on button and refresh my localhost/ page (of course the controller's route is "/" and it contains the code using mailer to send a mail as explain in mailer documentation).
On my vue i don't have error code but mail stay in queue status...
Here the screenshot taken of the profiler:
Can someone tell me why my mail stay queued?
Of course the From email address is mine ( the verified one) and the To is anotherone of mine.
Maybe i have to configure something in my outlook mail (the From one) ?
Sendgrid never match the verification, it stay in checking status until message :
Hmm, we haven't seen your email yet.
Please check your code, run it again, then click "Retry".
Thanks for reply,
Regards,
In your question you said that your MAILER_DSN environment variable is set to:
MAILER_DSN=sendgrid+smtp://#default
That is missing your API Key though. You need to create an API key in the SendGrid dashboard and then add the API key to the MAILER_DSN variable, between the // and the #default like this:
MAILER_DSN=sendgrid+smtp://API_KEY#default
One other thing, ensure that you have installed the SendGrid transport with this command:
composer require symfony/sendgrid-mailer
Yes, thanks you a lot for reply.
Of course all was set as you notify me.
I now have fix my issue, in fact the problem for me with the mail that remains in queued is that the messenger was installed so in asynchronous by default.
I had to add the option message_bus: false in my config/packages/mailer.yaml file not to have the asynchronous option used.
Hopefully this is useful for some people.
add the option message_bus: false in my config/packages/mailer.yaml:
framework:
mailer:
dsn: '%env(MAILER_DSN)%'
message_bus: false

How to match bold inputs in hubot coffeescript

I am working to develop a hubot slack application where we can give commands from the slack chatbot and give the response back using coffeescript.
now, I am able to use the slack bot with this.In cofeescript i have ,
module.exports = (robot) ->
robot.respond /hi/i, (msg) ->
console.log(msg.message.text)
sender = msg.message.user.name.toLowerCase()
msg.send "Hello small " + sender
msg.finish()
here if i give
hi
in slack bot, i receive
Hello small indhumathi
and when i try to give the same in bold "hi" it is not responding since the bold characters are not matched in the coffeescript to process.
So my requirement is to change the code which should accept both bold and unbold texts. Please help me in this. I am new to coffeescript.

Survey Monkey API: How to add email body as configured in surveymonkey UI?

I have configured my email collector to display the body in french and I sent survey invite through Survey Monkey. It worked well. Default template is used if this is not specified String in Survey Monkey API. Is there a way to get already configured email collector setup message to be sent? I want the emails to be in the language I had chosen in SM UI
The best way to create a new message based on a template right now is to copy a previous message.
To do this, you'll want to include the collector/message to use as a template when creating a new message like this:
POST /v3/collectors/{collector_id}/messages
{
"from_collector_id": "<collector_to_use_as_template>",
"from_message_id": "<message_to_use_as_template>"
}
Note that the message ID in the body needs to belong to the collector ID in the body.

What is the name of the post variable what is sending from paypal webhooks?

Paypal webhooks send me a post variable, but whats the name from that?
I can't found anything.
The posted variables depend on the event triggered. To actually see the post sent by PayPal , Follow the below steps :
1. Go to developer.paypal.com--> Dashboard and login .
2. In left move to "WebHooks Simulator" and put your url you want to receive the post to after selecting the event type and it will show you the data posted after clicking on submit .
You will see something like below :
When a webhook is sent, it sends headers as well as a payload. That documentation is spread between the two links below. What's not explained very well is the actual contents of the "resource" field. If for example the webhook is for a sale event type, then the contents of resource is the same as getting the info from GET /v1/payments/sale/
First link explains the main payload. Second link explains the headers.
https://developer.paypal.com/docs/api/#retrieve-a-webhook-event
https://developer.paypal.com/docs/integration/direct/rest-webhooks-overview/
$bodyReceived = file_get_contents('php://input');

Stop Hubot (with Flowdock) from responding to itself?

I'm using Hubot with the Hubot-Flowdock adapter.
I'm using robot.hear to respond to messages with a certain string in them (e.g. "chocolate").
I then call msg.send with a message, which also happens to contain the trigger string ("chocolate") in it.
This causes Hubot to hear itself, and then just loop endlessly, triggering over and over again.
I'm trying to find a way to get Hubot to not respond to itself.
From what I gather, the Hubot Campfire adapter seems to include a specific check to prevent Hubot from listening to itself:
https://github.com/github/hubot/blob/b96ea30654ef2dbf93f710c6e310c909fa1bdd65/src/adapters/campfire.coffee#L71
However, other adapters don't seem to have this.
Is there another way to write a Hubot script with robot.hear and msg.send such that it will not respond to itself?
I found the answer to this - Hubot is not meant to respond/hear itself.
It's the responsibility of each adapter to handle filtering these messages out.
Some adapter (e.g. hubot-hipchat) will actually set the hubot bot name to the name of the user you authenticate in Hubot as.
In the case of hubot-flowdock, it will check the hubot bot name against the Flowdock "Display name" of the user you authenticate as - so you just need to make sure those match up (either by changing the "Display name" on the Flowdock account page, or using the -n flag or HUBOT_NAME environment variable to set the bot name).