Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I needed to use additional data from incoming messages in rules but I realized the sms_incoming rule is invoked with number and message directly. I've added a patch that sends the options array along with number and message so you can use hook_token_info_alter to provide your own tokens.
Comment | File | Size | Author |
---|---|---|---|
#3 | gosms.tgz | 10 KB | rasumo |
sms-rules-with-options.patch | 528 bytes | rasumo | |
Comments
Comment #1
rasumo CreditAttribution: rasumo commentedChanging the category of this as it's not really a feature request.
Comment #2
nmcclain CreditAttribution: nmcclain commentedGreat patch - I applied it successfully and confirmed incoming SMSs still work with Rules for me like normal.
I wasn't able to fully test adding my own custom token to an incoming SMS message. Could you share a sample implementation where you provide your own tokens for an incoming SMS? I was able to implement hook_token_info_alter and hook_rules_data_info_alter successfully (I think), but my token isn't actually replaced when the rule is executed. I suspect I am missing something - any hints? That would help me test that other tokens work. Thanks!
Comment #3
rasumo CreditAttribution: rasumo commentedYou were almost done, just modify (or implement) hook_tokens to do the actual replacement and that should do it. I've attached the tokens and rules files from a gateway module I'm working on.
Comment #4
nmcclain CreditAttribution: nmcclain commentedHey @rasumo - you rock!! Thanks for helping me over the hump!
I can confirm this patch works as advertised - I was able to extend the sms_twilio module to hand off the SMS recipient number to Rules.
Marking this as RTBC!
Comment #5
rasumo CreditAttribution: rasumo commentedHey @nmcclain - I'm new to this whole DO review and commit process. Just checking if/when the patch will be committed so I can let clients know they can download the dev version.
Comment #6
nmcclain CreditAttribution: nmcclain commentedHi @rasumo - We need one of the SMS Framework module maintainers to commit this. I just sent a note to @mcpuddin asking if he can take a look in the coming weeks.
Comment #7
ojchris CreditAttribution: ojchris commentedHello All.
I made a post a while ago with no response so far. I would appreciate if you guys could help my query here:
http://drupal.org/node/1830328
I'm about to purchase some SMS units from routeSMS but I wanted to be sure the gateway works with drupal and that drupal intuitively supports SMS before going ahead.
Thanks
Comment #8
mcpuddin CreditAttribution: mcpuddin commentedThanks for the hardwork and patience rasumo. This has now been committed.