Sending messages with Telegram

485 views
Skip to first unread message

Matt Berg

unread,
Feb 16, 2016, 8:15:29 AM2/16/16
to rapidpro-dev
First - the telegram integration is incredibly exciting.  I think it will allow us to leverage RapidPro to create entirely new forms of apps.

We upgraded and are able to receive messages from Telegram but not able to send.  Is there anything in particular we might be missing to get this setup?

Thanks again,

Matt

Nic Pottier

unread,
Feb 16, 2016, 1:03:48 PM2/16/16
to Matt Berg, rapidpro-dev
Telegram's API is just plain HTTP/S, so nothing special needed there.

I would maybe add some debugging and make sure that the URL that is
being registered as a callback for your bot is indeed reachable from
the wider internet. (check your TEMBA_HOST in settings.py)

-Nic
> --
> You received this message because you are subscribed to the Google Groups
> "rapidpro-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rapidpro-dev...@googlegroups.com.
> To post to this group, send email to rapidp...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rapidpro-dev/a08eed0c-0712-42e2-96c2-c5f294474376%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Matt Berg

unread,
Feb 17, 2016, 2:59:36 AM2/17/16
to Nic Pottier, rapidpro-dev
Thanks Nic will give it a shot.

dwa...@ona.io

unread,
Mar 1, 2016, 7:12:42 AM3/1/16
to rapidpro-dev, mb...@ona.io
I have checked the TEMBA_HOST setting.
When sending telegram messages I can see the celery task processing successfully but user not receiving any message. 

Nic Pottier

unread,
Mar 1, 2016, 6:40:53 PM3/1/16
to Dennis Wambua, rapidpro-dev, Matt Berg
What does the sending log say? Are you getting a valid response from Telegram?

Note that telegram bots can only chat with users who have initiated a
chat with them, a bot can't initiate a conversation with a user until
the bot is added by the user.
> https://groups.google.com/d/msgid/rapidpro-dev/e3db1f7a-a0ec-48a1-80c3-2ebf076dab88%40googlegroups.com.

Matt Berg

unread,
Mar 9, 2016, 6:33:01 AM3/9/16
to rapidpro-dev, dwa...@ona.io, mb...@ona.io
We properly added the bot and the contact shows up in rapidpro with the telegram identifier.

We can receive without any issue.  It's just outbounds messages that are causing problems.

Has anyone else managed to get the telegram integration working?  Is there a step in our setup we are overlooking?

Thanks,

Matt

Nic Pottier

unread,
Mar 9, 2016, 9:36:24 AM3/9/16
to Matt Berg, rapidpro-dev, Dennis Wambua
Did you make sure you have the latest dependencies in pip-freeze?

What does the sending log say? Outbound is a simple HTTP call (though
through a Telegram library) so there shouldn't be much that can wrong
there.
> https://groups.google.com/d/msgid/rapidpro-dev/e62fbd0f-fcf4-4009-b40c-100a959c9b13%40googlegroups.com.

Dennis Wambua

unread,
Mar 11, 2016, 3:48:39 AM3/11/16
to Nic Pottier, Matt Berg, rapidpro-dev
Hi Nic,

We used pip-freeze.txt file to install the dependencies.

From the logs I am get the following

[2411] SENT - None None "None" None "None"
[pid: 17492|app: 0|req: 7/17] 196.207.140.148 () {52 vars in 1099 bytes} [Fri Mar 11 07:38:22 2016] POST /broadcast/send/?_format=json => generated 67 bytes in 146 msecs (HTTP/1.1 200) 2 headers in 65 bytes (1 switches on core 0)

I wonder why the response are None
--
Regards,

Dennis M. Wambua

Dennis Wambua

unread,
Mar 11, 2016, 4:52:50 AM3/11/16
to Nic Pottier, Matt Berg, rapidpro-dev
We have also noticed when i send a message in rapidpro telegram it sends an old text. I think they have been queued somewhere.

How do i clear the queue? 

Nic Pottier

unread,
Mar 11, 2016, 9:17:22 AM3/11/16
to Dennis Wambua, Matt Berg, rapidpro-dev
None is normal in the logs for that channel type since we don't have
any more details. (the telegram library is sending it, so we don't
have a trace)

To me it looks like things are being passed off to Telegram just fine,
so not sure what the issue might be. Does the same account work on
TextIt?

Note that outgoing messages to contacts won't work if they have
deleted (and blocked) the bot conversation. Users must initiate the
conversations first.

-Nic

Matt Berg

unread,
Mar 11, 2016, 9:18:56 AM3/11/16
to Nic Pottier, Dennis Wambua, rapidpro-dev
Nic,

Do you now how long the conversation remains open for? 

Ie) If I do /start and i'm added as a contact.  Can we message that person a month later?  Or does /start have to be initiated again.

Matt

Nic Pottier

unread,
Mar 11, 2016, 9:21:00 AM3/11/16
to Matt Berg, Dennis Wambua, rapidpro-dev
That we've seen so far I haven't seen that there's a timeout.

Matt Berg

unread,
Mar 11, 2016, 9:21:50 AM3/11/16
to Nic Pottier, Dennis Wambua, rapidpro-dev
We got it working.  It looks like it breaks when we put things in async mode.  Dennis will provide more info.

Dennis Wambua

unread,
Mar 11, 2016, 9:35:02 AM3/11/16
to Matt Berg, Nic Pottier, rapidpro-dev
When in async mode i.e CELERY_ALWAYS_EAGER = False the messages are been queued in SEND_MSG_TASK  and not processed at all even when celery and redis are running.
I had to manually clear the queue to get it to work.

Any ideas why?

Nic Pottier

unread,
Mar 11, 2016, 9:40:48 AM3/11/16
to Dennis Wambua, Matt Berg, rapidpro-dev
Sounds like you aren't running all the worker queues you need to:
http://rapidpro.github.io/rapidpro/docs/components/

You need celery workers popping tasks off of 'default', 'handler',
'flow' and 'msgs'.

There are recommendations for # of workers for each for large scale on
the hosting page.

-Nic

Dennis Wambua

unread,
Mar 11, 2016, 9:42:21 AM3/11/16
to Nic Pottier, Matt Berg, rapidpro-dev
Cool thanks
Reply all
Reply to author
Forward
0 new messages