I have created a MySQL database that contains information about patients and their current state of treatment along with other relevant information. Preliminary i manged to create a website where you can query about patients(using either their name or room no) and it'll display the requested information.But now i need to find a way so that when someone writes a relevant query (like patient name or room no) in a SMS and sends it to a predefined number they'l receive the requested information about that patient on their mobile in an SMS.Kindly guide me how to deal with this?
Related
I'm trying to create a very simple messaging system using PHP and MySQL but I'm having some issues to decide how to structure things here.
A quick list of what I need to achieve.
The system needs to allow both registered users and guests send messages.
The messages will be received by the customer service department (this means that customers can't send messages to other customers).
The messages can come from 1) a contact form available in the Contact page of the website where are asked fist name, last name, email, mobile phone, subject and message; and 2) emails sent by users (then the system will receive the emails via webhook and store them properly).
The customer service department needs to able to reply to any message.
The customer service department can contact any user (registered or not) at any time. This means that they can reply to messages but also can "start" the conversation (example: A message asking to confirm/update details).
I started the design but I'm completely stuck at the moment. Everything is fine when there are only registered users and customer service members: I just need to relate each message to a user_id as sender or receiver. But, when we add guest users, the user_id is useless, because they are not registered (so no user id). This means I will need to store all first name, last name, email and mobile phone for them (creating redundant data in the case of registered users, because I already have that data for them)
The tables will contain a column created_at.
My problem is: guest users won't have a record in the users table, so I cannot just have a user_id field on the messages tables. Also, I need to tell who is sending the message (because our customer service department can send messages to registered/guest users).
Honestly I cannot find a way to achieve this without having columns that will be equal to null in most of the cases.
Any help on this will be appreciated.
Thanks in advance
You will need to have a record added for the guest, as a user account in the database. Set default values, and log his IP address so should he decide to sign up, you will update the guest record with the new user account.
Add an expiry and a cron job to delete any guest accounts which are inactive for x days.
You have encountered an example where the relational model doesn't neatly fit. It's a known issue, with several Stack Overflow posts.
The good news is - there's no "clean" solution in database design. There are a few common models, but they all have varying degrees of unpleasantness.
The bad news - you'll have to make the trade-offs, and live with the consequences.
I have a few little questions concerning contacts from Android.
I have a MySQL databases with users and their phone numbers and I want to retrieve the contacts from the contact list of the user phone which are matching with phone numbers in the database (-> users using the app in other words, a bit like whatsapp is doing when you see the contacts which are using the app..)
I was wondering how I could achieve that in an easy and rapid way.. I was guessing I could do as follow:
asynctask class which is retrieving all the contact list with a cursor
get the phone number of the current item in the cursor
execute a sql query to see if contact exist .. with LIKE %phonenumber% (through php script)
if exist, add the contact name to a list view
But this means that every times the user wants to see the list, there are a lot of requests that need to be done.
Does anyone have an idea of a better way to do it? An easier way ?
I created an script to get some information users send via SMS then create a Contact in Salesforce using that information with the Salesforce API and works fine, but I hard-coded the user and password so every time a user creates a Contact from SMS i´ll be the creator. How can I access user´s credentials for creating the Contact? I want to do something like: select Id from User WHERE Phone = $_GET['mobile'] and then make createdById equal to user's id. Is that possible without having an array or file with user´s passwords?
Thanks in advance.
Answered on success community by David "wOOt!" Liu
You can edit the CreatedById field to anyone you want using Apex - no credentials needed!
Salesforce needs to turn on this permission for your org first - I believe it's called "Create Audit Fields". This lets you modify fields such as CreatedDate, CreatedById, etc etc. Many orgs use this so it's actually a fairly common request - I just wrote code recently that changed a record's creator as well.
Some more definitions on Audit Fields can be found here:
http://www.salesforce.com/us/developer/docs/api/Content/system_fields.htm
I want to get details as below:
1) SalesForce API details to fetch user information from extension number
2) SalesForce API details to fetch Contact information from dialed number
3) SalesForce API details to log calls into SalesForce
So can anybody tell me what is the prerequirement for call api?Like any account creation,username and password required?
for (1) & (2) they're simple query calls, using the soap or rest api's you'd run a query,
select id, name, {whatever} from user where phone = 'the phone #'
select id, name, {whatever} from contact where phone = 'the phone #'
for (3) you would create a new record, typically a Task, with the relevant fields populated include the whoId field which would be the contactId of the person called.
You may find using one of the general purpose schema/query tools like SoqlX or Workbench useful as a discovery aid.
I have 2 pages for collecting payments for an online services business.
1st form collects basic information (name, address, dob, etc) from buyers and inserts into a mysql table
when 1st page is submitted it forwards user to a page where they can select service packages which is linked to paypal payment gateway.
The scenario that i am facing is, after submitting the first page (data gets inserted to mysql) but lets say user decides not to pay for packages on 2nd page, i have redundant data in mysql table
Is there a way to manage this? should i combine payment collection + information collection in one page?
please advise,
If you don't want a customer to enter twice his personnal/shipping information, implement an account system, where a user creates an account with email/password, and his personnal/shipping information is linked to that account.
If you don't want an account system, you can make the folowing: when a user comes back, and if he already entered shipping information and didn't complete she payment, suggest him to reuse the previous information (by his cookie for example).
But anyway, there is not much you can do against a user that chooses to re-enter information (or create multiple accounts)
You have no redundant data in your database, you have potential customers that are interested in your product - but somehow didn't complete the payment step.
You could contact them later - having their email - and do some aftersales.
What you can do is set a timestamp on the data entered in the first page. Periodically, have a script run through the database and remove entries that are older than the last sweep. For example, if you run it daily, remove everything older than 2 days. Hourly, everything more than 2 hours, etc.