When I create a MFmessageViewController, I want to set the body of the text as the custom url scheme of my app, so the recipient of the text can open the app from the text. I can't get the text to appear as a URL though, only a string? Does anyone know how to do this?
NSString *bodyString = #"<a href='http://www.site.co.in/pathtolink'>Touch Me</a>\n";
Set the bodyString as Email Body, hope it would help you.
Related
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.
I started an application that can handle SMS or Mail url schemes but I don't want to open the default apps installed. I have tried doing this
[[UIApplication sharedApplication] openURL: url];
but this opens the default SMS and Mail apps.
I tried using the UIActivityViewController
NSString *url=#"mailto:sample#gmail.com";
NSURL *schemeURL = [NSURL URLWithString:url];
NSString * title =[NSString stringWithFormat:#"Send Email",url];
NSArray* dataToShare = #[url];
UIActivityViewController* activityViewController =[[UIActivityViewController alloc] initWithActivityItems:dataToShare applicationActivities:nil]
but this doesn't prefill the recipient field with the specified email.
It would be nice if the behaviour is the same with UIActivityViewController but let's us prefill information such as recipient.
Any suggestions ?
You can use non-default apps on macos but I don't think you can do so on iOS. Have a look at e.g. https://developer.apple.com/documentation/uikit/uiapplication/1648685-openurl?language=objc .
You could try with a URL similar to below to send with a given subject and body.
#"message://mailto://sample#gmail.com?subject=Subject&body=Body"
I think if you drop the message bit it will still work. I use it like that inside a HTML page inside an app somewhere.
If you need any special characters you will have to encode them in the subject and body.
Hi iam trying to send top to mobile number using Firebase Authentication,and am able to do that but my task is sending OTP to phone number and as per the country code, if the user choose wrong country code then OTP should not sent and if it is correct then only we have to send the OTP.and this OTP verification should be done only for the first time.If they already done the OTP verification after re-running the application ,we should directly go to home page.Can anyone help me to do that would be great ,thanks in advance.
I think the country code should not be editable. If it is for verification purposes only, you can get country code with the help of the below code.
let currentLocale = NSLocale.currentLocale()
let countryCode = currentLocale.objectForKey(NSLocaleCountryCode) as? String
After getting this you can append this with a mobile number like this.
let FinalNumber = String(format: "%#%#", countryCode,mobilenumber)
When it comes to navigating view controllers : this will help you
I have the code below which i am using to share the url on whatsapp using whatsapp url scheme, but when i do this i see empty message on the whatsapp message screen.
let itunesLink = "http://google.com";
let text = itunesLink.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLPathAllowedCharacterSet());
let url = NSURL(string: "whatsapp://send?text=\(text!)")
UIApplication.sharedApplication().openURL(url!);
When this code runs, i see the contacts and after i select the whatsapp account option i dont see the url and see the empty screen.
I am always confused why there are so many allowed characters in these sets. I suspect you may need to add more percent-encoding. This is what I use to encode URLs embedded in URLs:
let set = NSCharacterSet(charactersInString: ".-0123456789#ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~")
let text = itunesLink.stringByAddingPercentEncodingWithAllowedCharacters(set)
Because "/" is an allowed character in a URL Path, URLPathAllowedCharacterSet includes "/", and the "/" in itunesLink will not be percent-encoded, using the original program. That might be confusing Whatsapp. It certainly confuses me.
A few months ago I used to be able to pre-fill the dialog box with my own text so the user would only have to click share to share that text but it seems that Facebook has started to ignore that parameter like they say in this post: https://developers.facebook.com/blog/post/510/
So is there any other way around it so I can pre-fill a message that the user can easily share?
Thanks!
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
[super webViewDidFinishLoad:webView];
if (defaultStatus)
{
// Set the pre-filled status message
[_webView stringByEvaluatingJavaScriptFromString:
[NSString stringWithFormat:#"document.getElementsByName('feedform_user_message')[0].value = decodeURIComponent('%#')",
[SHKEncode(defaultStatus) stringByReplacingOccurrencesOfString:#"'" withString:#"\\'"]
]
];
// Make the text field bigger
[_webView stringByEvaluatingJavaScriptFromString:#"document.getElementsByName('feedform_user_message')[0].style.height='100px'"];
}
}
afaik it is not possible anymore to pre-fill the message box with the javascript api, which is a good thing. after all it is against the platform policies:
https://developers.facebook.com/docs/guides/policy/application_integration_points/
but: it should still be possible with the php api/sdk. you just have to allow the user to edit the message before you send it, with a textarea or input field. just make a post to /me/feed with the message parameter.