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.

CommentFileSizeAuthor
#3 gosms.tgz10 KBrasumo
sms-rules-with-options.patch528 bytesrasumo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rasumo’s picture

Category: feature » bug

Changing the category of this as it's not really a feature request.

nmcclain’s picture

Great 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!

rasumo’s picture

FileSize
10 KB

You 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.

nmcclain’s picture

Status: Needs review » Reviewed & tested by the community

Hey @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!

rasumo’s picture

Hey @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.

nmcclain’s picture

Hi @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.

ojchris’s picture

Hello 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

mcpuddin’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the hardwork and patience rasumo. This has now been committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 04b313c on 7.x-1.x, 8.x-1.x by mcpuddin:
    Issue #1801614 by rasumo: Expanded support of token module.