Is there are TwiML Request Paramter for Message Time/Date - twilio-php

According to the docs, when Twilio receives a message from a Twilio numbers it makes a synchronous HTTP request to the message URL configured for that number. Twilio sends the the parameters listed at https://www.twilio.com/docs/api/twiml/sms/twilio_request
Is it possible to have the date/time sent and/or received passed to the configured URL as well, and if so, how?

Dates and Times are addressed as such and are attached to the messages resource.
{
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"api_version": "2010-04-01",
"body": "Hey test message",
"error_code": null,
"error_message": null,
"num_segments": "1",
"num_media": "0",
"date_created": "Mon, 16 Aug 2010 03:45:01 +0000",
"date_sent": "Mon, 16 Aug 2010 03:45:03 +0000",
"date_updated": "Mon, 16 Aug 2010 03:45:03 +0000",
"direction": "outbound-api",
"from": "+14158141829",
"price": "-0.02000",
"sid": "MMXXXXXXXXXXXXXXXXXXXXXXXXX",
"status": "sent",
"to": "+15558675309",
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/MMXXXXXXXXXXXXXXXXXXXXXXXXXXXec.json"
}

Related

MSgraph, takes up to 48 hours before changes are visible

We use MSgraph and EWS API for our products.
When we do changes in our test Microsoft 365 environment (Add/change/delete - roomlists and rooms) we see the changes immediately when testing with EWS Editor.
But it takes up to 48 hours before we se the changes by using MSgraph Explorer.
I would guess that this is not expected behavior?
We understand it might take some time (Up to 30 minutes) but up to 48 hours?
Our test environment is a pure Microsoft 365 tenant (No hybrid)
The MSgraph API calls we test is:
GET /places/microsoft.graph.room and GET /places/microsoft.graph.roomlist
It seems that this issue might have been introduced after our environment was moved to the Norwegian datacenter.
No error messages from MSgraph, all seems normal..
Here is the results from MSgraph when i ask for roomlist:
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#places/microsoft.graph.roomList",
"value": [
{
"id": "32d75744-113e-4bec-91c4-811623d11521",
"displayName": "Test2",
"address": null,
"geoCoordinates": null,
"phone": "",
"emailAddress": "Test2#loop24.no"
},
{
"id": "1d535e8b-c44d-498a-9046-dbbe1ae3be75",
"displayName": "TestList",
"address": null,
"geoCoordinates": null,
"phone": "",
"emailAddress": "testlist#loop24.no"
},
{
"id": "b9ea8bd6-32da-4d6d-b38e-db6c03f4fa54",
"displayName": "RoomList",
"address": null,
"geoCoordinates": null,
"phone": "",
"emailAddress": "roomlist#loop24.no"
Here is the results from EWSEditor (This is correct)
Call Get Roomlist roomlist#loop24.no Roomlist

Why is my message queued but not sent by Twilio?

I'm trying to send a message to my phone with curl:
curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/<my-trial-sid>/Messages.json' \
--data-urlencode 'To=+<my-phone-number>' \
--data-urlencode 'From=+15005550006' \
--data-urlencode 'Body=Hello from twilio' \
-u <my-trial-sid>:<my-trial-token>
However I never get the message on the phone. The response show status as 'queued'. What's keeping it from being sent?
The complete response I get:
{"sid": "SM18ce5f04a0ed4d6e8bfdc91d862d7b7f", "date_created": "Wed, 08 Mar 2017 01:59:07 +0000", "date_updated": "Wed, 08 Mar 2017 01:59:07 +0000", "date_sent": null, "account_sid": "<my-trial-sid>", "to": "+<my-phone-number>", "from": "+15005550006", "messaging_service_sid": null, "body": "Sent from your Twilio trial account - Hello from twilio", "status": "queued", "num_segments": "1", "num_media": "0", "direction": "outbound-api", "api_version": "2010-04-01", "price": null, "price_unit": "USD", "error_code": null, "error_message": null, "uri": "/2010-04-01/Accounts/<my-trial-sid>/Messages/SM18ce5f04a0ed4d6e8bfdc91d862d7b7f.json", "subresource_uris": {"media": "/2010-04-01/Accounts/<my-trial-sid>/Messages/SM18ce5f04a0ed4d6e8bfdc91d862d7b7f/Media.json"}}%
Can't find any relevant log entries on the console either. What am I missing?
Twilio developer evangelist here.
It looks like you are using your test credentials here. Test credentials will never actually send an SMS, they just allow you to make sure you are making the API request correctly.
You should do make the same API call but with your regular credentials and messages will be sent. If you are still on a trial account then this message will not cost you anything.

GeoJSON Python Eve Example

I am trying to make a GeoJSON query work as per the Eve documentation (v0.6.1-dev): http://python-eve.org/features.html
However, the query in postman returns an error:
Postman GET: http://localhost:5000/people?where={"location": {"$near": {"$geometry": {"type":"Point", "coordinates": [10.0, 20.0]}, "$maxDistance": 1000}}}
Error:
500 Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
The 'people' collection contains the location as show below:
Postman GET: http://localhost:5000/people
"_items": [
{
"_updated": "Wed, 30 Sep 2015 10:26:51 GMT",
"firstname": "John",
"lastname": "Doe",
"born": "Thu, 27 Aug 1970 14:37:13 GMT",
"role": [
"author"
],
**"location": {
"type": "Point",
"coordinates": [
100,
0
]
},**
"_links": {
"self": {
"href": "people/560bb8eb6adf7d0e70f26cd0",
"title": "person"
}
},
Any idea why this does not work ?
Try to switch on debug mode (set DEBUG = True in settings) and see what the actual error is. It is very likely that there is no geo index for the field (Eve does not automatically create indexes for you).
UPDATE: Starting with v0.6, you can also ask Eve to maintain the index for you, see the mongo_indexes keyword in the docs

Dropbox Core API 0 bytes size in metadata for image

I'm using Dropox Core API for my App. I retrieve all the metadata with the good endpoint. But sometimes I got metadata like this :
"size": "0 bytes",
"rev": "38af1b183490",
"thumb_exists": true,
"bytes": 2453963,
"modified": "Mon, 07 Apr 2014 23:13:16 +0000",
"client_mtime": "Thu, 29 Aug 2013 01:12:02 +0000",
"path": "/Photos/flower.jpg",
"photo_info": {
"lat_long": [
37.77256666666666,
-122.45934166666667
],
"time_taken": "Wed, 28 Aug 2013 18:12:02 +0000"
},
"is_dir": false,
"icon": "page_white_picture",
"root": "dropbox",
"mime_type": "image/jpeg",
"revision": 14511
The problem is "size": "0 bytes". The thumbnail exits and the image too, but this data mess up my app, because I check the size before download the file, to avoid to download too big files. I could avoid to download pictures with size equal to zero but it is just a way to get around the problem while images are valids.
Is there any reasons to get a 0 bytes size ? What does it mean ?

Limiting Twitter API results to tweets sent to all users (no #replies)?

I'm trying to find a way to just get tweets to all users. The JSON code indicates these as "to_user" null. For example the tweet below edent tweets to everyone, thus the to_user=null.
I tried a few alternatives without success:
http://search.twitter.com/search.json?q=to:null%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:0%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:%20from:edent&result_type=mixed
{
"created_at": "Thu, 28 Jun 2012 06:55:58 +0000",
"from_user": "edent",
"from_user_id": 14054507,
"from_user_id_str": "14054507",
"from_user_name": "Terence Eden",
"geo": null,
"id": 218236278402068480,
"id_str": "218236278402068480",
"iso_language_code": "en",
"metadata": {
"result_type": "recent"
},
"profile_image_url": "http://a0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
"profile_image_url_https": "https://si0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
"source": "<a href="http://twitter.com/">web</a>",
"text": "RT #straczynski: #edent Clearly the man was ahead of his time.",
"to_user": null,
"to_user_id": 0,
"to_user_id_str": "0",
"to_user_name": null,
"in_reply_to_status_id": 218075066452287500,
"in_reply_to_status_id_str": "218075066452287488"
},
If you're just looking to get tweets from a particular user that aren't to anyone, use the /get/statuses/user_timeline REST API endpoint instead of the Search API. /get/statuses/user_timeline has an exclude_replies parameter that should do what you're looking for.
The Search API doesn't have any way to exclude replies. Your only option is to get tweets matching whatever other parameters you pass, and process them on your end to remove any whose text starts with "#".

Resources