For the Twilio Action - SendMessage, Where can i find the `conversationSid` ? This is to respond to an existing webchat - twilio

I have a basic twilio-flex 2.0 setup in my local. I have a plugin which basically renders a button. I am responding to a "customer" message which pops up in my list. I have a the button's "onClick" implemented to send a pretyped message , I am unable to find the conversationSid, that I need to plug into this below.
Actions.invokeAction('SendMessage',
{
body: "TBD",
conversationSid: "Where can i find this?"
})})
For the sake of testing, I was able to find the conversationSid in the browser console and plugged it in there and message is sent.
The documentation shows that the conversationSid is optional, but without it, nothing is sent.
Any help or direction would be much appreciated ?

Thanks to #csevero , i was able to figure out the way
conversationSid: this.manager.store.getState().flex.chat.messageList.activeChatChannel

Related

Add buttons in whatsapp message response twilio

I currently have the following code which successfully replies any message I send with "Ola":
#app.route("/bot", methods=["POST"])
def bot():
incoming_msg = request.values.get('Body', '').lower()
resp = MessagingResponse()
msg = resp.message()
quote = 'Ola'
msg.body(quote)
return str(resp)
I would like to have response buttons to my reply. Please see attached image, I'd like to add the "Got it" button with my message text. Is that possible for python. Thanks.
To send quick reply or call to action buttons over WhatsApp using Twilio, you need to create a template and add the buttons to the template. To trigger the template, you need to send a message containing the text of the template in the body. This is all covered in more detail in the Twilio documentation on using buttons in WhatsApp.
Note, you need to have a working WhatsApp number in your account to create and send templates. You cannot use the Sandbox to test out this feature.

Twilio REST API to Flex

Looking for a little guidance here. The docs don't really cover this use case, so can someone please let me know if 1) this is possible, and 2) how to accomplish it?
Sequence:
REST Api to create a task
|
That task ends up as an incoming SMS in Twilio Flex
|
A worker accepts/responds via the Flex console
|
that message is sent to the user via text (SMS)
I've been testing in postman, and got it to the point where I can create a task, and it shows up in Flex, but it comes in as a default task with no sms component.
The docs are pretty thin regarding what the task creation fields can be, let alone what their values need to be.
Attributes = { "type" : "web", "to": "2024105613", "from" : "+14086871234", "queue" : "Everyone", "task-reason" : "service_request", "body" : "joel test" }
Please let me know if the use case / sequence I'm attempting is possible, and if so, do you have any pointers on what I'm doing wrong?
Thanks in advance!
More info/clarification:
What I'm hoping to do is have the worker see the incoming help request/task (that was sent in via the REST API) in Flex, and then respond in flex to the user which shows up on the user's device as a text message.
Right now, I can get the task to show up in flex, and I see the phone number that it "came" from, but I struggling with how I can have the worker respond via sms from the Flex portal.

Twilio Send Message API Error 21603

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.

Events not being logged in with AppEventsLogger

I'm trying to use react-native-fbsdk for Facebook analytics. When I go to the events debugging page to check if it works, I can see a couple events like App Activation and App Installs and other stuff like Completed App Session. Of these, I'm manually logging App Activation whereas the rest is I think the sdk provides by default.
The problem is, it's not logging many other custom events that I'm trying to log.
How do I debug this? Thanks in advance.
When you send the custom events, are you setting the page_scoped_user_id correctly? Here is a raw JSON cutom event, per docs.
{
url : "https://graph.facebook.com/<app_id>/activities",
form: {
event: 'CUSTOM_APP_EVENTS',
custom_events: JSON.stringify([{
_eventName: "fb_mobile_purchase",
_valueToSum: 55.22,
_fb_currency: 'USD'
}]),
advertiser_tracking_enabled: 0,
application_tracking_enabled: 0,
extinfo: JSON.stringify(['mb1']),
page_id: <page_id>,
page_scoped_user_id: recipientId
}
}
The last value, recipientId, is misleading. If you want to log something the user sent, you would want to log the senderId property of that incoming message.

StatusCallback does not work as expected

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.

Resources