I want custom message send to telegram, but i recive empty message.
ex:
Graylog2:
%message.id%
Source: %source%
Name: %name%
Name: ${name}
Thanks.
You can try this code inside message field of plugin:
[${stream.title}](${stream_url})
${foreach backlog message}
```${message.message}```
${end}
Related
I am currently using Telegram as a tool to start & watch/log a script with the node-telegram-bot-api.
The idea is to have a text with 'Uploaded Files: 1/10' and then will be edited according to the status of the upload in the backend.
bot.sendMessage(telegramChatID, 'Uploaded Files: 1/10', {
'disable_notification': true
});
But how do I get the message_id of the text sent by the bot so I can edit it later on?
Thanks for any help!
i am using the microsoft bot sdk in combination with an restify server (In package.json: "botbuilder": "^4.11.0"). I start a waterfall dialog that triggers a long running API. I save the the conversation reference and the id of the sent message to create an reply after the API call is completed:
replyToId = (await stepContext.context.sendActivity({ attachments: [ac]})).id; (in Dialog)
this.conversationReference = TurnContext.getConversationReference(context.activity); (in bot.ts)
After the completion of the API call, I want to create a reply to the last message of the dialog:
await this.adapter.continueConversation(this.conversationReference, async turnContext => {
await turnContext.sendActivity(newMessage);
});
newMessage is the Activity-object that contains further information for the user about the result of the API call.
The problem is that newMessage is not displayed as an reply to the existing message but as a separate message, although newMessage.replyToId is set to this.replyToId:
Additional information: Both messages, the last of the dialog and the "reply" are adaptive cards, but it does not make a difference if I send just simple text, same behaviour.
Would be grateful for any help :)
Instead of using "replyToId", put the id of the message you want to reply to, at the end of the conversation reference. As an example, if your conversationReference has a conversationId of 19:ac....cf#thread.skype, change it to: 19:ac...cf#thread.skype;messageid=12345678, where 12345678 is what you are currently using for "replyToId"
I want to create a Bot that automatically keeps posting in a Telegram channel.I am using Node.js.
I am using Telegraf.js wrapper for Telegram API. You may even suggest any other suitable wrapper for this task.
If your Channel is public. You need set admin in you channel.
Use: ctx.telegram.sendMessage(Channels_Username, 'your message')
Example:
ctx.telegram.sendMessage('#birodarlar', 'Hi everyone')
If your Channel is Private You need set admin in you channel.Use: ctx.telegram.sendMessage(Channels_id, 'your message')
Example:
ctx.telegram.sendMessage('-145542325454', 'Hi everyone')
you can wiev your channels id with this link
https://core.telegram.org/bots/api#sendmessage
for 5 minutes you need public it and know channel id with url parsing
Telegraph documentation is very comprehensive and you can find it at https://telegraf.js.org. I'm sure it will answer most of your questions.
If you want your bot to keep posting messages in a channel, simply execute this line of code in a loop:
ctx.telegram.sendMessage(CHANNEL_ID, 'your message')
Don't forget to replace CHANNEL_ID and 'your message' with your own values.
I have created the bot in azure services using LUIS, which used as chatbot and can create conversations using dialogs.
At some point, I am trying to push messages to chatbot using Direct Line API 3.0, I'm using Postman to send the messages to bot.
I followed the instructions from this page, https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-send-activity?view=azure-bot-service-4.0
I'm able to send message to the conversation as bot, below is the image I sent message from Postman and got successful response.
But my issue is, after the message is sent, the bot tries to analyse even though it's not user message. Bot starts to send message from default message handler like below,
Even after sending the message successfully, my bot triggers the default message handler, which is expected only to happen for user messages but not for bot messages.
Also, I have checked with webchat channel, which it doesn't trigger this default message handler. This is happening only in DirectLine API, can anyone help me on this.
Instead of sending the message as type "message", you should send it as "event".
This way your MessagesController will see it as an ActivityType of Event instead of Message and you can process however you want without spaghettifying your actual message handling
If you want to send different kinds of event to make it even easier, then you can 'name' you event by supplying the 'name' field with a value in your json.
Third, if you need to include data with the message, you would supply a value in the 'value' field of your json.
The github page for the standard webchat client has some great information on sending events. It might shed a bit more light on the json.
You can read more about the 'event' activity type here
You message json would look something more like this:
{
"type": "event",
"from": {
"id": "user1"
},
"name": "theEvent",
"value": "someDataMyBotNeeds"
}
Is there a way to update the status of a message sent from the Slack Web API?
I'm using Slack to build a bot that send Slack messages as SMS using Twilio and I would like to notice the user that the message hasn't been sent if the Twilio call response is an error.
Any suggestions?
I can suggest a blog post by one of my colleagues that walks you through building an SMS Slack bot in Python. You can use it as a guide to translate the setup to Node.js.
The tutorial there shows you how to both send SMS messages to Slack and receive Slack messages via SMS.
Specifically, the following route for receiving Slack messages as SMS:
#app.route('/slack', methods=['POST'])
def slack_post():
if request.form['token'] == SLACK_WEBHOOK_SECRET:
channel = request.form['channel_name']
username = request.form['user_name']
text = request.form['text']
response_message = username " in " channel " says: " text
twilio_client.messages.create(to=USER_NUMBER, from_=TWILIO_NUMBER,
body=response_message)
return Response(), 200
In addition to the code above you could handle any Twilio errors received on a message Status ErrorCode ErrorMessage and notify a user in Slack via the chat.update method.