I am trying to build a calling app on slack that invokes a voip app installed on the computer. So when the slack app is given a particular command with a number it should invoke this desktop app and allow the user to make a call.
I have given the slack app calls:read
calls:write permissions but when i post a message from the service back to slack on response_url i am getting 500 error on slack.
slack_message = {
"response_type": "Call",
"call_initiation_url": "https://example.com",
"desktop_protocol_call_initiation_url": "sip:+15551231234?action=call"
}
header = {'Content-Type': 'application/json'}
response = requests.post(response_url, headers=header, data=json.dumps(slack_message))
Slack show 500 error.
However, posting back to response_url works when i post back a simple message, like shown below and i see it on the slack.
slack_message2 = {
"response_type": "in_channel",
"text": "It's 80 degrees right now."
}
Could some help in understanding what is going wrong ? I am stuck here.
Related
I am developing a MSTeams application, and inside I use a messaging extension. Upon opening the extension, a request is fired over to my message handler, which I use an azure function to handle. Alongside the request is a payload, with details about the context (in this case the conversation or chat) of where the messaging extension was opened from.
Now, I've built up a graph URL with the conversation ID from the payload:
const id = context.req.body.conversation.id
const graphEndpoint = encodeURIComponent(`https://graph.microsoft.com/beta/me/chats/${id}/members`)
I authenticate a user by calling microsoftTeams.authentication.authenticate({...}) before I make the call, and use the token in the request.
Sometimes, this call will succeed, and return the information I want. However, the other times it will fail with a 400, telling me I had a bad request, despite it being a GET request with no body.
I notice in bad requests, that the conversation ID doesn't trail with #thread.v2 or #unq.gbl.spaces etc. I have no clue why this is so inconsistent, or if it's my fault. Any help would be appreciated.
EDIT: I have also seen that the issue only occurs when the id starts with a:, and succeeds when it starts with 19:. However, the context in which I open the messaging extension is the same each time: In a 1:1 / User:User chat.
I have previously implemented installing the bot in the conversation to get this information, but this method is very undesirable. Perhaps a side point - it seems that the conversations where I have previously installed the bot seem to return the 19: id, and everything else a:.
Here's an example of the 400 response:
{
"error": {
"code": "BadRequest",
"message": "Bad Request",
"innerError": {
"date": "2021-01-25T09:43:26",
"request-id": "3bb55aa2-e694-4c80-952c-88842f482dc1",
"client-request-id": "3bb55aa2-e694-4c80-952c-88842f482dc1"
}
}
}
The conversation id you received in the turn-context is not the chat-id. The conversation id is different from conversation id. Conversation id the id between bot and the user and chat id the id of the chat. Both are different. You cannot use conversation id to call the graph API. Please use the chat id to call graph API. You can get the chat id using list chats API.
I'm using postman to see the response format of send message api in Twilio. The Api that I'm using is https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.
I have entered the basic authentication parameters (Account_Sid and AuthToken as username and password) the json request format is
{
"To":"My Number",
"From":"Twilio Number",
"Body":"Hello this msg is from postman"}
But I'm getting error 21603 which states "A 'From 'phone number is required". Can you please tell me where I'm wrong. The messages are sent when using Twilio console.
I can't see your Postman but, maybe this is what you're missing...
Click on the Body tab and make sure form-data is selected from the radio buttons.
Also if you go to Twilio docs page (https://www.twilio.com/docs/sms/send-messages) you can see the expected response if you click on the OUTPUT link (tab) that is located at the top right of the code sample.
im using slack to make chat bot so i can create a message center from my ios app to send message from ios app to slack.
getting following response from hitting joinChannel api https://slack.com/api/channels.join
cant get channel ids
{
"provided" : "admin,identify,chat:write:bot",
"ok" : false,
"needed" : "channels:write",
"error" : "missing_scope"
}
As the error message says you need the channels.write scope to use channels.join method.
Just add the missing scope to your access token and it will work.
I'm using YouTube Reporting Api to get my CMS account's datas as bulk reports.
I am using Api Explorer with my CMS user account. I have enabled YouTube Reporting API from console but whenever I'm trying the following request, I get 401 error. I believe that I'm missing something or doing something wrong but I couldn't find it. What is the exact reason of this issue?
Mr. Ibrahim Ulukaya , you are the one who created the PHP sample codes for YouTube Reporting API. How can I solve this issue?
Thank you! :)
This is my request;
POST https://youtubereporting.googleapis.com/v1/jobs?onBehalfOfContentOwner=contentOwner%3D%3DContent_Owner_Name&fields=id%2CreportTypeId&key={YOUR_API_KEY}
{
"reportTypeId": "content_owner_ad_performance_a1"
}
This is the Response;
401 OK
Show headers -
{
"error": {
"code": 401,
"message": "The request does not have valid authentication credentials.",
"status": "UNAUTHENTICATED"
}
}
Edit
When I don't add Content Owner name, I get 400 Error..
Here's my request;
POST https://youtubereporting.googleapis.com/v1/jobs?fields=name%2CreportTypeId&key={YOUR_API_KEY}
{
}
Here's the response;
400 OK
Show headers -
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
I solved this problem...
401 error happens because I was thinking that I should add my Content Owner Name at OnBehalfOfContentOwner section. According to YouTube documentation, It's supposed to be my Content Owner ID. (The content owner's external ID on which behalf the user is acting on.) When I added my Content Owner ID, the request was fine..
400 Error happens because I left the OnBehalfOfContentOwner section blank and didn't write anything. According to YouTube documentation, f the request does not specify a value for this parameter, the API server assumes that the request is being made for the user's own channel.. If it is acting as your own channel (not content owner), you cannot retrieve anything from Content Owner Reports. You can only choose something from Channel Reports. If you try retrieving data from Content Owner Reports while acting as your own channel, the request will be invalid because it cannot see the report in the Channel Report list.
The most important things are;
If you are trying to retrive Content Owner reports, you should use your Content Owner ID , not Content Owner name on OnBehalfOfContentOwner section.
You should choose a correct report id from the list which you are acting as...
Overview:
I am working on a VB.NET application that places a call into Twilio, the number is not a test number. I am using the C# library with the code written in VB.Net.
When I use this line of code:
Console.WriteLine(account.SendSmsMessage(Caller, to1, strBody))
I receive a text message on my phone however the post back is never posted to my website. I have included the URL of the site on the account under Messaging > Request URL.
When I reply to the message, Twilio does make a post to my site. From what I understand, a POST should have been made when Twilio was first sent a message from my application, however this is not the case.
When using this code, I do not get any text message and no POST is made.
Console.WriteLine(account.SendMessage(Caller, to1, strBody, PostBackURL))
I have tried SendSMSMessage, I have tried it with the URL on my account and without it,
nothing seems to effect the behavior.
I need the SmsMessageSid at the time the message is sent. From everything I have seen, Twilio does not provide a response other then what is sent to the PostBackURL, I could parse a response for the
SmsMessageSid however since there is no response that is not an option. If I am mistaken on that point that would be great, however it looks like the only way to get a reply is with the post back URL. Thanks for your help with this! Below you will find an excerpt of the code I am working with:
PostBackURL = "http%3A%2F%2F173.111.111.110%3A8001/XMLResponse.aspx"
' Create Twilio REST account object using Twilio account ID and token
account = New Twilio.TwilioRestClient(SID, Token)
message = New Twilio.Message
Try
'WORKS
'Console.WriteLine(account.SendSmsMessage(Caller, to1, strBody))
'DOES NOT WORK
Console.WriteLine(account.SendMessage(Caller, to1, strBody, PostBackURL))
Catch e As Exception
Console.WriteLine("An error occurred: {0}", e.Message)
End Try
Console.WriteLine("Press any key to continue")
Console.ReadKey()
I'm doing something similar with C# and like you, I'm not getting the POST to the callback URL. I don't know why that's not working, but if all you need is the sid when you send the message, you should be able to do this:
message = SendSmsMessage(Caller, to1, strBody))
and message.Sid will give you what you need, assuming no exceptions.