Build a Windows phone chat app with Post and Get request - post

I am supposed to create a simple chat app using httppost and get in order to send message and to get message.
This is what I am supposed to get after sending the request to the API:
{"conversation":
{"id":35,"created_at":"2014-11-16T19:21:11.000+01:00",
"updated_at":"2014-11-16T19:21:11.000+01:00",
"conversation_type":null,"option_id":null,
"messages":[
{"body":"lol","created_at":"2014-11-16T19:21:13.000+01:00","user_id":34},
{"body":"payday","created_at":"2014-11-16T19:25:57.000+01:00","user_id":34},
{"body":"lol","created_at":"2014-11-16T20:19:26.000+01:00","user_id":34},
{"body":"izi","created_at":"2014-11-17T01:09:36.000+01:00","user_id":34},
{"body":"LOWL","created_at":"2014-11-17T01:11:34.000+01:00","user_id":34}
],
"users":[
{"id":34,"email":"zegfault42#gmail.com","first_name":"Hugo","name":"Barbier"},
{"id":36,"email":"ismael.bourg#gmail.com","first_name":"Ismael","name":"Bourg"}
]
}
}
And I am supposed to make a post request in order to reply message. I just want to know what I can do and how I can design it.

Please read more about HTTP Post & Get methods, REST services.
It is very simple. You can find it on the internet.
Also, I had similar questions when I started developing.
Check the answer to my question here-
Request & Response Windows Phone
Hope this helps

Related

Is it possible create bots for iMessage?

I'm exploring possibilities of creating a Bot for iMessages. I went through the "Messages SDK" provided by Apple for iMessage extensions and didn't find any leads.
Android has Telephony(https://developer.android.com/reference/android/provider/Telephony) which I could use as a starting point. But I couldn't find anything similar on iOS.
If anyone knows how I could achieve this, it would be of great help.
You might want to check out Jared, an open-source iMessage chatbot which reads from the message database.
https://github.com/ZekeSnider/Jared
You could check out https://sendblue.co
Here is their documentation: https://docs.sendblue.co
I assume you can send and receive iMessages by simply hitting their endpoint with a post request, like so:
const url = `https://api.sendblue.co/api/send-message` ;
axios.post(url, {
number: '+19998887777',
content: 'Hello world!',
statusCallback: 'https://example.com/message-status/1234abcd',
},
headers: {
"sb-api-key-id": << apiKey >> ,
"sb-api-secret-key": << apiSecret >>
},
}).then(response => {
console.log(response.data);
}).catch(error => {
console.error(error);
});
You can receive iMessages by registering a webhook with them.
Cheers
iMessages is a closed platform, I don't think I have that possibility.
you can check
https://developer.apple.com/business-chat/
Business Chat
is a powerful new way for organizations to connect with customers directly from within Messages. Using Business Chat, your customers can get answers to questions, resolve issues and complete transactions on their iPhone, iPad, Mac and Apple Watch. Customers can find your business and start conversations from Safari, Maps, Search and Siri.
I have an idea! You could just add a phone number or an email to the chat that is connected to a bot script which would send messages directly from that phone number/email. I think that would work.

using iTunes lookup with apps that are not on the store yet

I am using the URL
http://itunes.apple.com/lookup?bundleId=com.myCompany.myApp
to get a JSON file with the information about my app. This works if the app is already published on the App Store but I am still developing it and the result coming from that URL contains just this:
{
"resultCount":0,
"results": []
}
I have tried to use
http://sandbox.itunes.apple.com/lookup?bundleId=com.myCompany.myApp
and
https://sandbox.itunes.apple.com/lookup?bundleId=com.myCompany.myApp
and I receive
Http/1.1 Service Unavailable
Any ideas?
It's not possible to do that. I'd suggest using another way to get the data you need or mocking the response you expect while the app isn't available and forward the request to Apple as soon as data is available.

get Blank Response Subscription Status URL IAP from Apple server, Status Update Notifications, statusUpdateNotification

Status Update Notifications, statusUpdateNotification
I set Subscription Status URL in my APP in iTunes account like https://www.xxxxxx.xx/iospushnotification.php
I also successfully tested nscurl --ats-diagnostics https://www.xxxxxx.xx/iospushnotification.php
I also implemented php code in iospushnotification.php file to get JSON response
I purchased successfully Auto renewal Subscriptions Sandbox but I did not get any Status Update Notifications I get blank [] JSON response from apple server to my server.
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Subscriptions.html#//apple_ref/doc/uid/TP40008267-CH7-SW6
if anyone still cares 2 years later, I found a solution, assuming you're using PHP.
from the stackoverflow post Receive JSON POST with PHP we need to do something like this:
$appleData = file_get_contents('php://input');
then try to json_decode($appleData) from there.
(I've never had to do something so weird to get POST data before, but I've mostly used frameworks before; unfortunately, I do not currently have that luxury...)

Sending message with custom URL though Geoloqi

I'm looking into Geoloqi as a service for sending messages and I'm wondering about the url parameter described here:
https://developers.geoloqi.com/api/message/send
Can I use a custom protocol/URL scheme to launch my app in response to a sent message.
(I would assume yes, but need to be sure before progressing further with it).
According to the web page you've linked, one of the parameters that can be sent along with the "POST" is a URL that can be opened when the notification is tapped.
It's here that I think you could put your custom URL. No way to know if the server will accept a custom scheme (e.g. "bradrobinson://hi/there") though without trying.

SendGrid - Custom Event Notification App in header

I am trying to use SendGrid's Event Notification App (http://sendgrid.com/documentation/display/apps/EventNotification) for emails of certain categories. The Event Notification on my SendGrid account is empty. The header I'm putting on my email is:
X-SMTPAPI: {"category":"category","filters":{"eventnotification":{"settings":{"url":"theurl"}}}}
But I'm not getting a callback on my url. A simple curl post on this given url gives me the expected output, so I'm pretty sure that should be working with SendGrid too.
Do you have any ideas on what the header should look like? I couldn't find too much documentation on the website for this specific app...
Thanks!
Here is an example of the header that I am successfully sending with my Sendgrid emails:
headers("X-SMTPAPI" => "{\"unique_args\": {\"customer_id\":\"#{customer.id}\",\"email_batch_id\":\"#{batch_id}\"}, \"category\":\"monthly_statement\"}")
Make sure you have the correct events checked under the event notification settings in Sendgrid.

Resources