Im currently trying to send a message from Teams to a bot.
If I'm sending the message via Postman the bot receives the message.
When I'm trying to send a message from Teams the bot does not receive the message.
I assume that I have made an mistake in my json where my Authorization is. Can anyone tell me if my header is correct or where my mistake is?
Related
Currently using this code to send workspace invites via Slack API, this is working but for some emails it is getting this failed_to_send_invite error. At first I thought it was because of using test emails, but now we also encountered it with a gmail email. Any idea why this error occurs? Documentation only says "The invite failed to send." as the description for this error.
response = slack.admin_users_invite(team_id=workspace_id, email=invitee_email, channel_ids=channel_id, custom_message=custom_msg, guest_expiration_ts=guest_expiry_epoch,is_restricted="true")
I had taken backup of my mail box using below rest API
GET https://graph.microsoft.com/v1.0/me/messages
But from My side this email msg deleted and i want to restore it again .
How i can do it using Rest API.
I tried with
POST https://graph.microsoft.com/v1.0/me/messages
and body with message.
but the message added as a draft not actual message.
Please help.
That is correct, when you create an email it will always save as draft unless it has been sent.
Try find the returned message id from the message creation POST, then issue a secondary POST to send it:
POST https://graph.microsoft.com/v1.0/me/messages/{id}/send
Ref: message: send
I want to subscribe to Slack Events API for any message posted in a slack channel. These are the following steps I took as given in Slack Event API documentations.
I created a slack app with following permission scopes :
channels:history, groups:history, im:history, mpim:history
In Event Subscriptions, I enabled events, verified Request URL ( "https://api.example.com/slack/event/push") successfully, and subscribed to the following Team Events :
channel_history_changed, group_history_changed, message.channels, message.groups, message.im, message.mpim
I made the user go through oauth authorization to install the app. The url is shown below with scope and redirect uri. (PHP Code)
$url = "https://slack.com/oauth/authorize/?client_id=" . SLACK_CLIENT_ID .
"&scope=users.profile:read,users:read,groups:history,channels:history,im:history,mpim:history" .
"&redirect_uri=" . urlencode('https://api.example.com/slack/oauth/callback') .
"&state=XXXXXXXXX";
I receive a code from slack which I exchange for access token.
Access Token: xoxp-XXXXXXXXX-XXXXXXXXX-XXXXXXX-XXXXXXXXXXXXXXXXXXXX
Scope: identify,channels:history,groups:history,im:history,mpim:history,users:read,users.profile:read
Team Id: XXXXXXXX
I checked the apps and integration of the team to see if the app was installed and yes it is in the list of Apps.
Now as per my understanding when any message is posted in any channel of the team, a POST request should be made to my verified URL ( "https://api.example.com/slack/event/push"). But I don't get any POST request there.
I thought maybe the URL is broken but I tested it with a counter and every time the URL is hit it increments the counter. So the URL is fine.
Is there a step I missed somewhere? I don't know what to try next.
I contacted Slack support and they were very helpful. The logs at slack showed that Slack was actually sending POST requests to my Request url. So my setup worked fine. But my API framework was failing to parse the request body and hence sending internal server error (500) to Slack. We figured this out by using requestb.in.
All I had to do was change the way I parsed request body.
Having the channel be public is VERY important!
I'm using Rails with Zenvia API to send Text Messages to my users.
But if a message fails to send, how could I send the same message without creating a new message ID? Is there a method to it?
Today when I try to send again the same message, it returns "Message with same ID already sent".
Turns out Zenvia API does not have a way to resend messages with same ID. At least not within 24 hours.
The solution I found was to create a token that would serve as a "fake" ID and passed it to the API. If the message for any reason fails to send, I create a new token and send it again.
Initially I have been using the TwiML response to send response to my text messages. But since my requirement has changed and I need to send more than 10 messages in response to my text hence I am now using the Twilio API to send the message out. So to fix this now I am trying to send nothing as the TwiML response for my Text Messages and instead using the Twilio API to send the actual messages out. I also have a TwiML bin URL attached to my short code as a Message Fall Back URL in case Twilio is not able to connect to my REST API URL. So now when a Text message is received by Twilio it connects to my REST API and the response is sent. But I am getting the response from the Message FallBack URL first and then the actual response for my text message via the Twilio API. Is there anyway to avoid this? I can remove the Message Fall back URL but then what would happen in the actual case when Twilio is not able to connect to my server?
This is how I have added the code:
var twilioResponse = new Twilio.TwiML.TwilioResponse();
...... have code that uses Twilio API to send out more than 10 messages.
...... Since the messages are going out via Twilio API hence returning NULL to the TwiML response
return Request.CreateResponse(HttpStatusCode.OK, twilioResponse.Element);
More Updates:
As I mentioned earlier I'm using the REST API to send an SMS. When a Text request comes Twilio server calls my URL supplied to the REST call.
Sometimes my server is little slow in responding - in which case twilio gets the fallback URL message and passes on the text message.
How do I increase the timeout ? This timeout is the time the server responding with TWIML.
Please help - any pointers are appreciated.
Twilio evangelist here.
My first suggestion would be to check your accounts App Monitor to see if Twilio is logging any errors. The Fallback URL should not be getting requested unless Twilio fails to get a valid response from the primary URL.
The default timeout for a Twilio request is 15 seconds, so if your server is taking longer than that to respond there may be a bigger issue happening with your server or network.
Hope that helps.