BACKEND PROBLEM

22 views
Skip to first unread message

dannette opot

unread,
Apr 29, 2013, 2:58:59 AM4/29/13
to rapi...@googlegroups.com
Hi guyz,

I am creating a connection for sending responses to clients(rapidsms) .Here is the code:

try:

dannette opot

unread,
Apr 29, 2013, 3:05:35 AM4/29/13
to rapi...@googlegroups.com
dannette opot <dane...@gmail.com>
9:58 AM (0 minutes ago)
to rapidsms
Hi guyz,

I am creating a connection for sending notifications to a client(rapidsms) .Here is the code:

try:
     sendConn =Connection.objects.get(identity='072968970')
except: ObjectDoesNotExist:
     bEnd=Backend.objects.get(name = 'safaricom-modem')
     Connection.objects.create(identity = '0729681970',backend=bEnd)


.....but when i do:

 sendConn =Connection.objects.get(identity='072968970')
 msg="My Notification Message Here"
 msg=OutgoingMessage(sendConn,msg)
 msg.send()

....the message is not sent to that number.Actually the router indicates:[Outgoing: via message_tester]

Help.

Tim Akinbo

unread,
Apr 29, 2013, 3:14:01 AM4/29/13
to RapidSMS
The problem is that in your connection creation, you are using the "safaricom-modem" backend and in your message tester, the backend is actually "message_tester" and so the code tries to use the "safaricom-modem" backend to send the message which is not the same as the message_tester so you don't see it within the message tester.

If you're going to use the message tester, you might want to use the backend instead for that. Something tells me that this is not been done right. How are you creating the connection? Within an app handler or manually?

Tim Akinbo


--
You received this message because you are subscribed to the Google Groups "rapidsms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rapidsms+u...@googlegroups.com.
To post to this group, send email to rapi...@googlegroups.com.
Visit this group at http://groups.google.com/group/rapidsms?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

dannette opot

unread,
Apr 29, 2013, 3:17:03 AM4/29/13
to rapi...@googlegroups.com
Am creating the connection within the app.py file

dannette opot

unread,
Apr 29, 2013, 3:18:06 AM4/29/13
to rapi...@googlegroups.com
And i am trying to simulate a real scenario by using a phone to send the SMS,not the message_tester

Tim Akinbo

unread,
Apr 29, 2013, 3:23:47 AM4/29/13
to RapidSMS
In that case, you should use whatever backend that the message was received from and not hard code it.

If what you're trying to do is generate a response when a message is received, then you don't need to first create a connection and then an OutgoingMessage. All you need to do is message.respond('text here'). Secondly, connections are automatically created when a message is received and you can access it from the message object itself.

If you're using the latest and the "bestest" RapidSMS:
message.connections[0] will get you the connection from the message object.

If you're using a really old one, then it should be:
message.connection

HTH

Tim Akinbo

dannette opot

unread,
Apr 29, 2013, 3:25:51 AM4/29/13
to rapi...@googlegroups.com
I solved the problem. In my rapidsms_connection table, the client's contacts were created with the message_tester as the backend.I deleted this connection and recreated it using a new incoming text message.It now works.
Reply all
Reply to author
Forward
0 new messages